Skip to content

Commit bd7cbd1

Browse files
committed
Clone / update basic repositories depending on presence
1 parent 2619283 commit bd7cbd1

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

generate.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import json
24
import concurrent.futures
35
import itertools
@@ -20,22 +22,29 @@
2022
generation_time = datetime.now(timezone.utc)
2123

2224

23-
def get_completion_progress() -> Iterator['LanguageProjectData']:
25+
def get_completion_progress() -> Iterator[LanguageProjectData]:
2426
clones_dir = Path('clones')
25-
Repo.clone_from(
26-
'https://github.com/python/devguide.git',
27-
devguide_dir := Path(clones_dir, 'devguide'),
28-
depth=1,
29-
)
27+
if not (devguide_dir := Path(clones_dir, 'devguide')).exists():
28+
Repo.clone_from('https://github.com/python/devguide.git', devguide_dir, depth=1)
29+
else:
30+
Repo(devguide_dir).git.pull()
3031
latest_branch = branches_from_peps()[0]
31-
Repo.clone_from(
32-
'https://github.com/python/cpython.git',
33-
cpython_dir := Path(clones_dir, 'cpython'),
34-
depth=1,
35-
branch=latest_branch,
36-
)
32+
if not (cpython_dir := Path(clones_dir, 'cpython')).exists():
33+
Repo.clone_from(
34+
'https://github.com/python/cpython.git',
35+
cpython_dir,
36+
depth=1,
37+
branch=latest_branch,
38+
)
39+
else:
40+
Repo(cpython_dir).git.pull()
3741
subprocess.run(['make', '-C', cpython_dir / 'Doc', 'venv'], check=True)
38-
subprocess.run(['make', '-C', cpython_dir / 'Doc', 'gettext'], check=True)
42+
try:
43+
subprocess.run(['make', '-C', cpython_dir / 'Doc', 'gettext'], check=True)
44+
except subprocess.CalledProcessError as e:
45+
e.add_note(
46+
'Try pruning clones/cpython/Doc/venv and/or clones/cpython/Doc/build/doctrees-gettext.'
47+
)
3948

4049
languages_built: dict[str, str] = {
4150
language: translated_name

0 commit comments

Comments
 (0)