|
| 1 | +from __future__ import annotations |
| 2 | + |
1 | 3 | import json |
2 | 4 | import concurrent.futures |
3 | 5 | import itertools |
|
20 | 22 | generation_time = datetime.now(timezone.utc) |
21 | 23 |
|
22 | 24 |
|
23 | | -def get_completion_progress() -> Iterator['LanguageProjectData']: |
| 25 | +def get_completion_progress() -> Iterator[LanguageProjectData]: |
24 | 26 | 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() |
30 | 31 | 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() |
37 | 41 | 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 | + ) |
39 | 48 |
|
40 | 49 | languages_built: dict[str, str] = { |
41 | 50 | language: translated_name |
|
0 commit comments