Skip to content

Commit 1d10b14

Browse files
committed
[GR-76437] Update HPy dependency pins
PullRequest: graalpython/4630
2 parents 89010bc + 150762f commit 1d10b14

9 files changed

Lines changed: 31 additions & 24 deletions

File tree

graalpython/com.oracle.graal.python.test/src/tox/leftpad/tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist = graalpy
33

44
[testenv]
55
deps =
6-
pytest==6.0.1
6+
pytest==8.4.2
77
commands =
88
pytest --assert=plain tests {posargs}
99

graalpython/hpy/docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ sphinx-rtd-theme==2.0.0
55
sphinx-autobuild==2021.3.14
66
sphinx-c-autodoc==1.3.0
77
clang==17.0.6
8-
docutils==0.16 # docutils >= 0.17 fails to render bullet lists :/
8+
docutils==0.18.1 # Latest release supported by Sphinx 5.0.2

graalpython/hpy/hpy/tools/autogen/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Parse public_api.h and generate various stubs around
33
"""
44
import sys
5-
import py
5+
from pathlib import Path
6+
67
import pycparser
78
from packaging import version
89

@@ -57,7 +58,7 @@ def main():
5758
if len(sys.argv) != 2:
5859
print('Usage: python -m hpy.tools.autogen OUTDIR')
5960
sys.exit(1)
60-
outdir = py.path.local(sys.argv[1])
61+
outdir = Path(sys.argv[1])
6162

6263
generate(DEFAULT_GENERATORS, outdir)
6364

graalpython/hpy/hpy/tools/autogen/autogenfile.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
*/
1212
"""
1313

14+
15+
def resolve_relative_path(root, relative_path):
16+
if hasattr(root, 'join'):
17+
return root.join(relative_path)
18+
return root / relative_path
19+
20+
1421
class AutoGenFile:
1522
LANGUAGE = 'C'
1623
PATH = None
@@ -27,7 +34,8 @@ def generate(self):
2734
def write(self, root):
2835
cls = self.__class__
2936
clsname = '%s.%s' % (cls.__module__, cls.__name__)
30-
with root.join(self.PATH).open('w', encoding='utf-8') as f:
37+
target = resolve_relative_path(root, self.PATH)
38+
with target.open('w', encoding='utf-8') as f:
3139
if self.DISCLAIMER is not None:
3240
f.write(self.DISCLAIMER.format(clsname=clsname))
3341
f.write('\n')

graalpython/hpy/hpy/tools/autogen/doc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import textwrap
22
import re
33

4-
from .autogenfile import AutoGenFile
4+
from .autogenfile import AutoGenFile, resolve_relative_path
55
from .parse import toC
66
from .ctx import autogen_ctx_h
77
from .conf import (DOC_C_API_PAGES_SPECIAL_CASES,
@@ -64,7 +64,8 @@ def write(self, root):
6464
if not self.BEGIN_MARKER or not self.END_MARKER:
6565
raise RuntimeError("missing BEGIN_MARKER or END_MARKER")
6666
n_begin = len(self.BEGIN_MARKER)
67-
with root.join(self.PATH).open('r', encoding='utf-8') as f:
67+
target = resolve_relative_path(root, self.PATH)
68+
with target.open('r', encoding='utf-8') as f:
6869
content = f.read()
6970
start = content.find(self.BEGIN_MARKER)
7071
if start < 0:
@@ -75,7 +76,7 @@ def write(self, root):
7576
raise RuntimeError(f'end marker "{self.END_MARKER}" not found in'
7677
f'file {self.PATH}')
7778
new_content = self.generate(content[(start+n_begin):end])
78-
with root.join(self.PATH).open('w', encoding='utf-8') as f:
79+
with target.open('w', encoding='utf-8') as f:
7980
f.write(content[:start + n_begin] + new_content + content[end:])
8081

8182

graalpython/hpy/hpy/tools/autogen/parse.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
import sys
33
import attr
44
import re
5-
import py
65
import pycparser
76
import shutil
7+
from pathlib import Path
88
from pycparser import c_ast
99
from pycparser.c_generator import CGenerator
1010
from sysconfig import get_config_var
1111
from .conf import SPECIAL_CASES, RETURN_CONSTANT
1212

13-
PUBLIC_API_H = py.path.local(__file__).dirpath('public_api.h')
14-
CURRENT_DIR = py.path.local(__file__).dirpath()
15-
AUTOGEN_H = py.path.local(__file__).dirpath('autogen.h')
13+
CURRENT_DIR = Path(__file__).resolve().parent
14+
PUBLIC_API_H = CURRENT_DIR / 'public_api.h'
15+
AUTOGEN_H = CURRENT_DIR / 'autogen.h'
1616

1717

1818
def toC(node):
@@ -209,13 +209,13 @@ def __init__(self, filename):
209209
elif sys.platform == 'win32':
210210
cpp_cmd = [shutil.which("cl.exe")]
211211
if sys.platform == 'win32':
212-
cpp_cmd += ['/E', '/I%s' % CURRENT_DIR]
212+
cpp_cmd += ['/E', '/I%s' % str(CURRENT_DIR)]
213213
else:
214-
cpp_cmd += ['-E', '-I%s' % CURRENT_DIR]
214+
cpp_cmd += ['-E', '-I%s' % str(CURRENT_DIR)]
215215

216216
msvc = "cl.exe" in cpp_cmd[0].casefold()
217217

218-
csource = pycparser.preprocess_file(filename,
218+
csource = pycparser.preprocess_file(str(filename),
219219
cpp_path=str(cpp_cmd[0]),
220220
cpp_args=cpp_cmd[1:])
221221

graalpython/hpy/hpy/tools/autogen/testing/test_autogen.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import textwrap
22
import difflib
3-
import py
43
import pytest
54
from hpy.tools.autogen.parse import HPyAPI
65
from hpy.tools.autogen.ctx import autogen_ctx_h, autogen_ctx_def_h
@@ -26,11 +25,11 @@ def src_equal(exp, got):
2625
class BaseTestAutogen:
2726

2827
@pytest.fixture
29-
def initargs(self, tmpdir):
30-
self.tmpdir = tmpdir
28+
def initargs(self, tmp_path):
29+
self.tmpdir = tmp_path
3130

3231
def parse(self, src):
33-
fname = self.tmpdir.join('test_api.h')
32+
fname = self.tmpdir / 'test_api.h'
3433
# automatically add useful typedefs
3534
src = """
3635
#define STRINGIFY(X) #X
@@ -39,7 +38,7 @@ def parse(self, src):
3938
typedef int HPy;
4039
typedef int HPyContext;
4140
""" + src
42-
fname.write(src)
41+
fname.write_text(src)
4342
return HPyAPI.parse(fname)
4443

4544

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
pycparser==2.21
2-
py==1.11.0
3-
packaging==19.2
4-
attrs==19.3.0
2+
packaging==25.0
3+
attrs==23.2.0

mx.graalpython/mx_graalpython.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,6 @@ def tox_example(args=None):
20392039
"packaging==25.0",
20402040
"platformdirs==4.3.8",
20412041
"pluggy==1.5.0",
2042-
"py==1.11.0",
20432042
"pyparsing==3.2.3",
20442043
"six==1.17.0",
20452044
"toml==0.10.2",

0 commit comments

Comments
 (0)