Skip to content

Commit b574d91

Browse files
committed
update output
1 parent ab1af81 commit b574d91

File tree

2 files changed

+80
-35
lines changed

2 files changed

+80
-35
lines changed

scripts/generate_checklist.py

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@
1515

1616
parser = argparse.ArgumentParser(description="Find equivalent files in cpython and rustpython")
1717
parser.add_argument("--cpython", type=pathlib.Path, required=True, help="Path to cpython source code")
18-
parser.add_argument("--updated-libs", type=pathlib.Path, required=False,
19-
help="Libraries that have been updated in RustPython")
2018
parser.add_argument("--notes", type=pathlib.Path, required=False, help="Path to notes file")
2119

2220
args = parser.parse_args()
2321

24-
def check_pr(pr_id) -> bool:
22+
def check_pr(pr_id: str) -> bool:
2523
if pr_id.startswith("#"):
2624
pr_id = pr_id[1:]
27-
pr_id = int(pr_id)
28-
req = f"https://api.github.com/repos/RustPython/RustPython/pulls/{pr_id}"
25+
int_pr_id = int(pr_id)
26+
req = f"https://api.github.com/repos/RustPython/RustPython/pulls/{int_pr_id}"
2927
response = requests.get(req).json()
3028
return response["merged_at"] is not None
3129

@@ -34,38 +32,37 @@ class LibUpdate:
3432
pr: Optional[str] = None
3533
done: bool = True
3634

37-
updated_libs = {}
38-
if args.updated_libs:
39-
# check if the file exists in the rustpython lib directory
40-
updated_libs_path = args.updated_libs
41-
if updated_libs_path.exists():
42-
with open(updated_libs_path) as f:
43-
for line in f:
44-
line = line.strip()
45-
if not line.startswith("//") and line:
46-
line = line.split(" ")
47-
if len(line) == 2:
48-
is_done = True
49-
try:
50-
is_done = check_pr(line[1])
51-
except Exception as e:
52-
warnings.warn(f"Failed to check PR {line[1]}: {e}")
53-
updated_libs[line[0]] = LibUpdate(line[1])
54-
elif len(line) == 1:
55-
updated_libs[line[0]] = LibUpdate()
56-
else:
57-
raise ValueError(f"Invalid line: {line}")
35+
def parse_updated_lib_issue(issue_body: str) -> dict[str, LibUpdate]:
36+
lines = issue_body.splitlines()
37+
updated_libs = {}
38+
for line in lines:
39+
if line.strip().startswith("- "):
40+
line = line.strip()[2:]
41+
out = line.split(" ")
42+
out = [x for x in out if x]
43+
assert len(out) < 3
44+
if len(out) == 1:
45+
updated_libs[out[0]] = LibUpdate()
46+
elif len(out) == 2:
47+
updated_libs[out[0]] = LibUpdate(out[1], check_pr(out[1]))
48+
return updated_libs
49+
50+
def get_updated_libs() -> dict[str, LibUpdate]:
51+
issue_id = "5736"
52+
req = f"https://api.github.com/repos/RustPython/RustPython/issues/{issue_id}"
53+
response = requests.get(req).json()
54+
return parse_updated_lib_issue(response["body"])
55+
56+
updated_libs = get_updated_libs()
5857

59-
else:
60-
raise FileNotFoundError(f"Path {updated_libs_path} does not exist")
6158
if not args.cpython.exists():
6259
raise FileNotFoundError(f"Path {args.cpython} does not exist")
6360
if not args.cpython.is_dir():
6461
raise NotADirectoryError(f"Path {args.cpython} is not a directory")
6562
if not args.cpython.is_absolute():
6663
args.cpython = args.cpython.resolve()
6764

68-
notes = {}
65+
notes: dict = {}
6966
if args.notes:
7067
# check if the file exists in the rustpython lib directory
7168
notes_path = args.notes
@@ -74,13 +71,13 @@ class LibUpdate:
7471
for line in f:
7572
line = line.strip()
7673
if not line.startswith("//") and line:
77-
line = line.split(" ")
78-
if len(line) > 1:
79-
rest = " ".join(line[1:])
80-
if line[0] in notes:
81-
notes[line[0]].append(rest)
74+
line_split = line.split(" ")
75+
if len(line_split) > 1:
76+
rest = " ".join(line_split[1:])
77+
if line_split[0] in notes:
78+
notes[line_split[0]].append(rest)
8279
else:
83-
notes[line[0]] = [rest]
80+
notes[line_split[0]] = [rest]
8481
else:
8582
raise ValueError(f"Invalid note: {line}")
8683

scripts/notes.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
__future__ Related test is `test_future_stmt`
2+
abc `_collections_abc.py`
3+
abc `_py_abc.py`
4+
code Related test is `test_code_module`
5+
codecs `_pycodecs.py`
6+
collections See also #3418
7+
ctypes #5572
8+
datetime `_pydatetime.py`
9+
decimal `_pydecimal.py`
10+
dis See also #3846
11+
importlib #4565
12+
io `_pyio.py`
13+
io #3960
14+
io #4702
15+
locale #3850
16+
mailbox #4072
17+
multiprocessing #3965
18+
os Blocker: Some tests requires async comprehension
19+
os #3960
20+
os #4053
21+
pickle #3876
22+
pickle `_compat_pickle.py`
23+
pickle `test/pickletester.py` supports `test_pickle.py`
24+
pickle `test/test_picklebuffer.py`
25+
pydoc `pydoc_data`
26+
queue See also #3608
27+
re Don't forget sre files `sre_compile.py`, `sre_constants.py`, `sre_parse.py`
28+
shutil #3960
29+
site Don't forget `_sitebuiltins.py`
30+
venv #3960
31+
warnings #4013
32+
33+
// test
34+
35+
test_array #3876
36+
test_gc #4158
37+
test_marshal #3458
38+
test_mmap #3847
39+
test_posix #4496
40+
test_property #3430
41+
test_set #3992
42+
test_structseq #4063
43+
test_super #3865
44+
test_support #4538
45+
test_syntax #4469
46+
test_sys #4541
47+
test_time #3850
48+
test_time #4157

0 commit comments

Comments
 (0)