|
4 | 4 | # "potodo", |
5 | 5 | # "jinja2", |
6 | 6 | # "requests", |
| 7 | +# "docutils", |
7 | 8 | # ] |
8 | 9 | # /// |
9 | 10 | import subprocess |
|
14 | 15 | from git import Repo |
15 | 16 | from jinja2 import Template |
16 | 17 |
|
| 18 | +import repositories |
17 | 19 | import visitors |
18 | 20 | from completion import branches_from_devguide, get_completion |
19 | 21 |
|
|
26 | 28 | ) |
27 | 29 | subprocess.run(['make', '-C', Path(clones_dir, 'cpython/Doc'), 'venv'], check=True) |
28 | 30 | subprocess.run(['make', '-C', Path(clones_dir, 'cpython/Doc'), 'gettext'], check=True) |
29 | | - for language in ('es', 'fr', 'id', 'it', 'ja', 'ko', 'pl', 'pt-br', 'tr', 'uk', 'zh-cn', 'zh-tw'): |
30 | | - completion_number = get_completion(clones_dir, language) |
31 | | - visitors_number = visitors.get_number_of_visitors(language) |
32 | | - completion_progress.append((language, completion_number, visitors_number)) |
| 31 | + for language, repo in repositories.get_languages_and_repos(): |
| 32 | + if repo: |
| 33 | + completion_number = get_completion(clones_dir, repo) |
| 34 | + visitors_number = visitors.get_number_of_visitors(language) |
| 35 | + else: |
| 36 | + completion_number, branch, visitors_number = 0., "", 0 |
| 37 | + completion_progress.append((language, repo, completion_number, visitors_number)) |
33 | 38 | print(completion_progress[-1]) |
34 | 39 |
|
35 | 40 | template = Template(""" |
|
49 | 54 | </tr> |
50 | 55 | </thead> |
51 | 56 | <tbody> |
52 | | -{% for language, completion, visitors in completion_progress | sort(attribute=1) | reverse %} |
| 57 | +{% for language, repo, completion, visitors in completion_progress | sort(attribute=2) | reverse %} |
53 | 58 | <tr> |
| 59 | + {% if repo %} |
54 | 60 | <td data-label="language"> |
55 | | - <a href="https://github.com/python/python-docs-{{ language }}" target="_blank"> |
| 61 | + <a href="https://github.com/{{ repo }}" target="_blank"> |
56 | 62 | {{ language }} |
57 | 63 | </a> |
58 | 64 | </td> |
|
61 | 67 | {{ '{:,}'.format(visitors) }} |
62 | 68 | </a> |
63 | 69 | </td> |
| 70 | + {% else %} |
| 71 | + <td data-label="language">{{ language }}</td> |
| 72 | + <td data-label="visitors">0</td> |
| 73 | + {% endif %} |
64 | 74 | <td data-label="completion"> |
65 | 75 | <div class="progress-bar" style="width: {{ completion | round(2) }}%;">{{ completion | round(2) }}%</div> |
66 | 76 | </td> |
|
0 commit comments