Skip to content

Commit 3da40df

Browse files
hugovkAA-Turner
andauthored
Update release-cycle.json URL (#143)
Co-authored-by: Adam Turner <[email protected]>
1 parent afdc452 commit 3da40df

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

completion.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@
44
from tempfile import TemporaryDirectory
55

66
import git
7+
import urllib3
78
from potodo import potodo
89

910

1011
@cache
11-
def branches_from_devguide(devguide_dir: Path) -> list[str]:
12-
p = devguide_dir.joinpath('include/release-cycle.json')
13-
data = json.loads(p.read_text())
12+
def branches_from_peps() -> list[str]:
13+
resp = urllib3.request('GET', 'https://peps.python.org/api/release-cycle.json')
14+
data = json.loads(resp.data)
1415
return [
1516
branch for branch in data if data[branch]['status'] in ('bugfix', 'security')
1617
]
1718

1819

1920
def get_completion(clones_dir: str, repo: str) -> tuple[float, str, float]:
2021
clone_path = Path(clones_dir, 'translations', repo)
21-
for branch in branches_from_devguide(Path(clones_dir, 'devguide')) + [
22-
'master',
23-
'main',
24-
]:
22+
for branch in branches_from_peps() + ['master', 'main']:
2523
try:
2624
clone_repo = git.Repo.clone_from(
2725
f'https://github.com/{repo}.git', clone_path, branch=branch

generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import translated_names
1616
import contribute
17-
from completion import branches_from_devguide, get_completion
17+
from completion import branches_from_peps, get_completion
1818
from repositories import Language, get_languages_and_repos
1919

2020
generation_time = datetime.now(timezone.utc)
@@ -27,7 +27,7 @@ def get_completion_progress() -> Iterator['LanguageProjectData']:
2727
devguide_dir := Path(clones_dir, 'devguide'),
2828
depth=1,
2929
)
30-
latest_branch = branches_from_devguide(devguide_dir)[0]
30+
latest_branch = branches_from_peps()[0]
3131
Repo.clone_from(
3232
'https://github.com/python/cpython.git',
3333
cpython_dir := Path(clones_dir, 'cpython'),

0 commit comments

Comments
 (0)