10
10
[--languages [fr [fr ...]]]
11
11
12
12
13
- Without any arguments builds docs for all branches configured in the
14
- global BRANCHES value and all languages configured in LANGUAGES,
15
- ignoring the -d flag as it's given in the BRANCHES configuration.
13
+ Without any arguments builds docs for all active versions configured in the
14
+ global VERSIONS list and all languages configured in the LANGUAGES list ,
15
+ ignoring the -d flag as it's given in the VERSIONS configuration.
16
16
17
17
-q selects "quick build", which means to build only HTML.
18
18
58
58
59
59
VERSION = "19.0"
60
60
61
- BRANCHES = [
62
- # version, git branch, isdev
63
- ("3.6" , "3.6" , False ),
64
- ("3.7" , "3.7" , False ),
65
- ("3.8" , "3.8" , False ),
66
- ("3.9" , "3.9" , True ),
67
- ("3.10" , "master" , True ),
68
- ]
69
-
70
-
61
+ # status in {"EOL", "security", "stable", "pre-release", "in development"}
62
+ Version = namedtuple ("Version" , ["name" , "branch" , "status" ])
71
63
Language = namedtuple (
72
64
"Language" , ["tag" , "iso639_tag" , "name" , "in_prod" , "sphinxopts" ]
73
65
)
74
66
67
+ # EOL and security are not automatically built, no need to remove them
68
+ # from the list.
69
+ VERSIONS = [
70
+ Version ("2.7" , "2.7" , "EOL" ),
71
+ Version ("3.5" , "3.5" , "security" ),
72
+ Version ("3.6" , "3.6" , "security" ),
73
+ Version ("3.7" , "3.7" , "stable" ),
74
+ Version ("3.8" , "3.8" , "stable" ),
75
+ Version ("3.9" , "3.9" , "pre-release" ),
76
+ Version ("3.10" , "master" , "in development" ),
77
+ ]
78
+
75
79
XELATEX_DEFAULT = (
76
80
"-D latex_engine=xelatex" ,
77
81
"-D latex_elements.inputenc=" ,
@@ -299,32 +303,26 @@ def setup_switchers(html_root):
299
303
300
304
301
305
def build_one (
302
- version ,
303
- git_branch ,
304
- isdev ,
305
- quick ,
306
- venv ,
307
- build_root ,
308
- group ,
309
- log_directory ,
310
- language : Language ,
306
+ version , quick , venv , build_root , group , log_directory , language : Language ,
311
307
):
312
308
checkout = os .path .join (
313
- build_root , version , "cpython-{lang}" .format (lang = language .tag )
309
+ build_root , version .name , "cpython-{lang}" .format (lang = language .tag )
310
+ )
311
+ logging .info (
312
+ "Build start for version: %s, language: %s" , version .name , language .tag
314
313
)
315
- logging .info ("Build start for version: %s, language: %s" , version , language .tag )
316
314
sphinxopts = list (language .sphinxopts )
317
315
sphinxopts .extend (["-q" ])
318
316
if language .tag != "en" :
319
- locale_dirs = os .path .join (build_root , version , "locale" )
317
+ locale_dirs = os .path .join (build_root , version . name , "locale" )
320
318
locale_clone_dir = os .path .join (locale_dirs , language .iso639_tag , "LC_MESSAGES" )
321
319
locale_repo = "https://github.com/python/python-docs-{}.git" .format (
322
320
language .tag
323
321
)
324
322
git_clone (
325
323
locale_repo ,
326
324
locale_clone_dir ,
327
- translation_branch (locale_repo , locale_clone_dir , version ),
325
+ translation_branch (locale_repo , locale_clone_dir , version . name ),
328
326
)
329
327
sphinxopts .extend (
330
328
(
@@ -333,12 +331,16 @@ def build_one(
333
331
"-D gettext_compact=0" ,
334
332
)
335
333
)
336
- git_clone ("https://github.com/python/cpython.git" , checkout , git_branch )
334
+ git_clone ("https://github.com/python/cpython.git" , checkout , version . branch )
337
335
maketarget = (
338
- "autobuild-" + ("dev" if isdev else "stable" ) + ("-html" if quick else "" )
336
+ "autobuild-"
337
+ + ("dev" if version .status == "in development" else "stable" )
338
+ + ("-html" if quick else "" )
339
339
)
340
340
logging .info ("Running make %s" , maketarget )
341
- logname = "cpython-{lang}-{version}.log" .format (lang = language .tag , version = version )
341
+ logname = "cpython-{lang}-{version}.log" .format (
342
+ lang = language .tag , version = version .name
343
+ )
342
344
python = os .path .join (venv , "bin/python" )
343
345
sphinxbuild = os .path .join (venv , "bin/sphinx-build" )
344
346
blurb = os .path .join (venv , "bin/blurb" )
@@ -368,7 +370,7 @@ def build_one(
368
370
)
369
371
shell_out (["chgrp" , "-R" , group , log_directory ])
370
372
setup_switchers (os .path .join (checkout , "Doc" , "build" , "html" ))
371
- logging .info ("Build done for version: %s, language: %s" , version , language .tag )
373
+ logging .info ("Build done for version: %s, language: %s" , version . name , language .tag )
372
374
373
375
374
376
def copy_build_to_webroot (
@@ -603,13 +605,17 @@ def main():
603
605
setup_logging (args .log_directory )
604
606
venv = os .path .join (args .build_root , "venv" )
605
607
if args .branch :
606
- branches_to_do = [
607
- branch
608
- for branch in BRANCHES
609
- if str ( branch [ 0 ]) == args .branch or branch [ 1 ] == args .branch
608
+ versions_to_build = [
609
+ version
610
+ for version in VERSIONS
611
+ if version . name == args .branch or version . branch == args .branch
610
612
]
611
613
else :
612
- branches_to_do = BRANCHES
614
+ versions_to_build = [
615
+ version
616
+ for version in VERSIONS
617
+ if version .status != "EOL" and version .status != "security"
618
+ ]
613
619
if args .languages :
614
620
languages = [languages_dict [tag ] for tag in args .languages ]
615
621
else :
@@ -619,17 +625,15 @@ def main():
619
625
languages = [
620
626
language for language in LANGUAGES if language .tag in DEFAULT_LANGUAGES_SET
621
627
]
622
- for version , git_branch , devel in branches_to_do :
628
+ for version in versions_to_build :
623
629
for language in languages :
624
630
if sentry_sdk :
625
631
with sentry_sdk .configure_scope () as scope :
626
- scope .set_tag ("version" , version )
632
+ scope .set_tag ("version" , version . name )
627
633
scope .set_tag ("language" , language .tag )
628
634
try :
629
635
build_one (
630
636
version ,
631
- git_branch ,
632
- devel ,
633
637
args .quick ,
634
638
venv ,
635
639
args .build_root ,
@@ -650,7 +654,7 @@ def main():
650
654
logging .error (
651
655
"Exception while building %s version %s: %s" ,
652
656
language .tag ,
653
- version ,
657
+ version . name ,
654
658
err ,
655
659
)
656
660
if sentry_sdk :
0 commit comments