Skip to content

Commit b930842

Browse files
sneakers-the-ratlwasser
authored andcommitted
pass env to language session
1 parent 98f3d23 commit b930842

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{"href": "https://www.pyopensci.org/images/favicon.ico"},
9696
]
9797

98-
html_baseurl = "https://www.pyopensci.org/python-package-guide/"
98+
html_baseurl = "/python-package-guide/"
9999
if not sphinx_env == "production":
100100
# for links in language selector when developing locally
101101
html_baseurl = "/"

noxfile.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def docs_test(session):
7878
env={'SPHINX_ENV': 'production'})
7979
# When building the guide with additional parameters, also build the translations in RELEASE_LANGUAGES
8080
# with those same parameters.
81-
session.notify("build-release-languages", [*TEST_PARAMETERS, *session.posargs])
81+
session.notify("build-release-languages", ["production", *TEST_PARAMETERS, *session.posargs])
8282

8383
def _autobuild_cmd(posargs: list[str], output_dir = OUTPUT_DIR) -> list[str]:
8484
cmd = [SPHINX_AUTO_BUILD, *BUILD_PARAMETERS, str(SOURCE_DIR), str(output_dir), *posargs]
@@ -274,7 +274,6 @@ def build_release_languages(session):
274274
session.install("-e", ".")
275275
for lang in RELEASE_LANGUAGES:
276276
session.log(f"Building [{lang}] guide")
277-
session.run(SPHINX_BUILD, *BUILD_PARAMETERS, "-D", f"language={lang}", ".", OUTPUT_DIR / lang, *session.posargs)
278277
if lang == 'en':
279278
out_dir = OUTPUT_DIR
280279
else:
@@ -328,6 +327,9 @@ def _sphinx_env(session) -> str:
328327
``SPHINX_ENV`` environment variable, defaulting to "development"
329328
"""
330329
if session.posargs and session.posargs[0] in SPHINX_ENVS:
331-
return session.posargs.pop(0)
330+
env = session.posargs.pop(0)
331+
session.log(f"Using SPHINX_ENV={env} from posargs")
332332
else:
333-
return os.environ.get('SPHINX_ENV', 'development')
333+
env = os.environ.get('SPHINX_ENV', 'development')
334+
session.log(f"Using SPHINX_ENV={env} from os.environ")
335+
return env

0 commit comments

Comments
 (0)