diff --git a/graalpython/com.oracle.graal.python.test/src/tox/leftpad/tox.ini b/graalpython/com.oracle.graal.python.test/src/tox/leftpad/tox.ini index 0915e7d20b..90baa3820c 100644 --- a/graalpython/com.oracle.graal.python.test/src/tox/leftpad/tox.ini +++ b/graalpython/com.oracle.graal.python.test/src/tox/leftpad/tox.ini @@ -3,7 +3,7 @@ envlist = graalpy [testenv] deps = - pytest==6.0.1 + pytest==8.4.2 commands = pytest --assert=plain tests {posargs} diff --git a/graalpython/hpy/docs/requirements.txt b/graalpython/hpy/docs/requirements.txt index c7f929385d..4d5b85f2fa 100644 --- a/graalpython/hpy/docs/requirements.txt +++ b/graalpython/hpy/docs/requirements.txt @@ -5,4 +5,4 @@ sphinx-rtd-theme==2.0.0 sphinx-autobuild==2021.3.14 sphinx-c-autodoc==1.3.0 clang==17.0.6 -docutils==0.16 # docutils >= 0.17 fails to render bullet lists :/ +docutils==0.18.1 # Latest release supported by Sphinx 5.0.2 diff --git a/graalpython/hpy/hpy/tools/autogen/__main__.py b/graalpython/hpy/hpy/tools/autogen/__main__.py index 59cdf04872..aec206741f 100644 --- a/graalpython/hpy/hpy/tools/autogen/__main__.py +++ b/graalpython/hpy/hpy/tools/autogen/__main__.py @@ -2,7 +2,8 @@ Parse public_api.h and generate various stubs around """ import sys -import py +from pathlib import Path + import pycparser from packaging import version @@ -57,7 +58,7 @@ def main(): if len(sys.argv) != 2: print('Usage: python -m hpy.tools.autogen OUTDIR') sys.exit(1) - outdir = py.path.local(sys.argv[1]) + outdir = Path(sys.argv[1]) generate(DEFAULT_GENERATORS, outdir) diff --git a/graalpython/hpy/hpy/tools/autogen/autogenfile.py b/graalpython/hpy/hpy/tools/autogen/autogenfile.py index d4fddb74c7..c14c74b6dc 100644 --- a/graalpython/hpy/hpy/tools/autogen/autogenfile.py +++ b/graalpython/hpy/hpy/tools/autogen/autogenfile.py @@ -11,6 +11,13 @@ */ """ + +def resolve_relative_path(root, relative_path): + if hasattr(root, 'join'): + return root.join(relative_path) + return root / relative_path + + class AutoGenFile: LANGUAGE = 'C' PATH = None @@ -27,7 +34,8 @@ def generate(self): def write(self, root): cls = self.__class__ clsname = '%s.%s' % (cls.__module__, cls.__name__) - with root.join(self.PATH).open('w', encoding='utf-8') as f: + target = resolve_relative_path(root, self.PATH) + with target.open('w', encoding='utf-8') as f: if self.DISCLAIMER is not None: f.write(self.DISCLAIMER.format(clsname=clsname)) f.write('\n') diff --git a/graalpython/hpy/hpy/tools/autogen/doc.py b/graalpython/hpy/hpy/tools/autogen/doc.py index 9824768866..46f619f874 100644 --- a/graalpython/hpy/hpy/tools/autogen/doc.py +++ b/graalpython/hpy/hpy/tools/autogen/doc.py @@ -1,7 +1,7 @@ import textwrap import re -from .autogenfile import AutoGenFile +from .autogenfile import AutoGenFile, resolve_relative_path from .parse import toC from .ctx import autogen_ctx_h from .conf import (DOC_C_API_PAGES_SPECIAL_CASES, @@ -64,7 +64,8 @@ def write(self, root): if not self.BEGIN_MARKER or not self.END_MARKER: raise RuntimeError("missing BEGIN_MARKER or END_MARKER") n_begin = len(self.BEGIN_MARKER) - with root.join(self.PATH).open('r', encoding='utf-8') as f: + target = resolve_relative_path(root, self.PATH) + with target.open('r', encoding='utf-8') as f: content = f.read() start = content.find(self.BEGIN_MARKER) if start < 0: @@ -75,7 +76,7 @@ def write(self, root): raise RuntimeError(f'end marker "{self.END_MARKER}" not found in' f'file {self.PATH}') new_content = self.generate(content[(start+n_begin):end]) - with root.join(self.PATH).open('w', encoding='utf-8') as f: + with target.open('w', encoding='utf-8') as f: f.write(content[:start + n_begin] + new_content + content[end:]) diff --git a/graalpython/hpy/hpy/tools/autogen/parse.py b/graalpython/hpy/hpy/tools/autogen/parse.py index 6615eb1d50..578317b458 100644 --- a/graalpython/hpy/hpy/tools/autogen/parse.py +++ b/graalpython/hpy/hpy/tools/autogen/parse.py @@ -2,17 +2,17 @@ import sys import attr import re -import py import pycparser import shutil +from pathlib import Path from pycparser import c_ast from pycparser.c_generator import CGenerator from sysconfig import get_config_var from .conf import SPECIAL_CASES, RETURN_CONSTANT -PUBLIC_API_H = py.path.local(__file__).dirpath('public_api.h') -CURRENT_DIR = py.path.local(__file__).dirpath() -AUTOGEN_H = py.path.local(__file__).dirpath('autogen.h') +CURRENT_DIR = Path(__file__).resolve().parent +PUBLIC_API_H = CURRENT_DIR / 'public_api.h' +AUTOGEN_H = CURRENT_DIR / 'autogen.h' def toC(node): @@ -209,13 +209,13 @@ def __init__(self, filename): elif sys.platform == 'win32': cpp_cmd = [shutil.which("cl.exe")] if sys.platform == 'win32': - cpp_cmd += ['/E', '/I%s' % CURRENT_DIR] + cpp_cmd += ['/E', '/I%s' % str(CURRENT_DIR)] else: - cpp_cmd += ['-E', '-I%s' % CURRENT_DIR] + cpp_cmd += ['-E', '-I%s' % str(CURRENT_DIR)] msvc = "cl.exe" in cpp_cmd[0].casefold() - csource = pycparser.preprocess_file(filename, + csource = pycparser.preprocess_file(str(filename), cpp_path=str(cpp_cmd[0]), cpp_args=cpp_cmd[1:]) diff --git a/graalpython/hpy/hpy/tools/autogen/testing/test_autogen.py b/graalpython/hpy/hpy/tools/autogen/testing/test_autogen.py index 2e1a971d63..28421d1196 100644 --- a/graalpython/hpy/hpy/tools/autogen/testing/test_autogen.py +++ b/graalpython/hpy/hpy/tools/autogen/testing/test_autogen.py @@ -1,6 +1,5 @@ import textwrap import difflib -import py import pytest from hpy.tools.autogen.parse import HPyAPI from hpy.tools.autogen.ctx import autogen_ctx_h, autogen_ctx_def_h @@ -26,11 +25,11 @@ def src_equal(exp, got): class BaseTestAutogen: @pytest.fixture - def initargs(self, tmpdir): - self.tmpdir = tmpdir + def initargs(self, tmp_path): + self.tmpdir = tmp_path def parse(self, src): - fname = self.tmpdir.join('test_api.h') + fname = self.tmpdir / 'test_api.h' # automatically add useful typedefs src = """ #define STRINGIFY(X) #X @@ -39,7 +38,7 @@ def parse(self, src): typedef int HPy; typedef int HPyContext; """ + src - fname.write(src) + fname.write_text(src) return HPyAPI.parse(fname) diff --git a/graalpython/hpy/requirements-autogen.txt b/graalpython/hpy/requirements-autogen.txt index 8c9e2a7384..320fc259c8 100644 --- a/graalpython/hpy/requirements-autogen.txt +++ b/graalpython/hpy/requirements-autogen.txt @@ -1,4 +1,3 @@ pycparser==2.21 -py==1.11.0 -packaging==19.2 -attrs==19.3.0 +packaging==25.0 +attrs==23.2.0 diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index 15dd3d3116..88bb301f28 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -1876,7 +1876,6 @@ def tox_example(args=None): "packaging==25.0", "platformdirs==4.3.8", "pluggy==1.5.0", - "py==1.11.0", "pyparsing==3.2.3", "six==1.17.0", "toml==0.10.2",