Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53e5de7

Browse files
committed
Allow to overwrite the python-docs-theme source.
1 parent 3c0f039 commit 53e5de7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

build_docs.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22

33
"""Build the Python docs for various branches and various languages.
44
5-
Usage:
6-
7-
build_docs.py [-h] [-d] [-q] [-b 3.7] [-r BUILD_ROOT] [-w WWW_ROOT]
8-
[--skip-cache-invalidation] [--group GROUP] [--git]
9-
[--log-directory LOG_DIRECTORY]
10-
[--languages [fr [fr ...]]]
11-
12-
135
Without any arguments builds docs for all active versions configured in the
146
global VERSIONS list and all languages configured in the LANGUAGES list,
157
ignoring the -d flag as it's given in the VERSIONS configuration.
@@ -473,14 +465,14 @@ def build_one(
473465
logging.info("Build done for version: %s, language: %s", version.name, language.tag)
474466

475467

476-
def build_venv(build_root, version):
468+
def build_venv(build_root, version, theme):
477469
"""Build a venv for the specific version.
478470
This is used to pin old Sphinx versions to old cpython branches.
479471
"""
480472
requirements = [
481473
"blurb",
482474
"jieba",
483-
"python-docs-theme",
475+
theme,
484476
"sphinx=={}".format(version.sphinx_version),
485477
]
486478
venv_path = os.path.join(build_root, "venv-with-sphinx-" + version.sphinx_version)
@@ -731,6 +723,12 @@ def parse_args():
731723
action="store_true",
732724
help="Get build_docs and dependencies version info",
733725
)
726+
parser.add_argument(
727+
"--theme",
728+
default="python-docs-theme",
729+
help="Python package to use for python-docs-theme: Usefull to test branches:"
730+
" --theme git+https://github.com/obulat/python-docs-theme@master",
731+
)
734732
return parser.parse_args()
735733

736734

@@ -780,7 +778,7 @@ def main():
780778
scope.set_tag("language", language_tag)
781779
language = languages_dict[language_tag]
782780
try:
783-
venv = build_venv(args.build_root, version)
781+
venv = build_venv(args.build_root, version, args.theme)
784782
build_one(
785783
version,
786784
args.quick,

0 commit comments

Comments
 (0)