From e0bba9d3e0afc26de622cb987e87873df6352b65 Mon Sep 17 00:00:00 2001 From: Walter-Gates-Bose <95227055+Walter-Gates-Bose@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:43:57 -0500 Subject: [PATCH 1/2] Use the `conf.py` file from your currently checked out branch. This is stated as how things work in the FAQ. --- sphinx_multiversion/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sphinx_multiversion/main.py b/sphinx_multiversion/main.py index 9870b314..ad465723 100644 --- a/sphinx_multiversion/main.py +++ b/sphinx_multiversion/main.py @@ -12,6 +12,7 @@ import subprocess import sys import tempfile +import shutil from sphinx import config as sphinx_config from sphinx import project as sphinx_project @@ -240,6 +241,7 @@ def main(argv=None): # Find config confpath = os.path.join(repopath, confdir) try: + shutil.copy(os.path.join(confdir_absolute, "conf.py"), confpath) current_config = load_sphinx_config(confpath, confoverrides) except (OSError, sphinx_config.ConfigError): logger.error( From 8b16e3606b111fa7028669eee742c700318be9f0 Mon Sep 17 00:00:00 2001 From: Walter-Gates-Bose <95227055+Walter-Gates-Bose@users.noreply.github.com> Date: Sat, 2 Mar 2024 12:52:38 -0500 Subject: [PATCH 2/2] Always make sphinx config aware of the sphinx-multiversion options. --- sphinx_multiversion/main.py | 66 ++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/sphinx_multiversion/main.py b/sphinx_multiversion/main.py index ad465723..ea942161 100644 --- a/sphinx_multiversion/main.py +++ b/sphinx_multiversion/main.py @@ -31,7 +31,7 @@ def working_dir(path): os.chdir(prev_cwd) -def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults): +def load_sphinx_config_worker(q, confpath, confoverrides): try: with working_dir(confpath): current_config = sphinx_config.Config.read( @@ -39,35 +39,35 @@ def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults): confoverrides, ) - if add_defaults: - current_config.add( - "smv_tag_whitelist", sphinx.DEFAULT_TAG_WHITELIST, "html", str - ) - current_config.add( - "smv_branch_whitelist", - sphinx.DEFAULT_TAG_WHITELIST, - "html", - str, - ) - current_config.add( - "smv_remote_whitelist", - sphinx.DEFAULT_REMOTE_WHITELIST, - "html", - str, - ) - current_config.add( - "smv_released_pattern", - sphinx.DEFAULT_RELEASED_PATTERN, - "html", - str, - ) - current_config.add( - "smv_outputdir_format", - sphinx.DEFAULT_OUTPUTDIR_FORMAT, - "html", - str, - ) - current_config.add("smv_prefer_remote_refs", False, "html", bool) + current_config.add( + "smv_tag_whitelist", sphinx.DEFAULT_TAG_WHITELIST, "html", str + ) + current_config.add( + "smv_branch_whitelist", + sphinx.DEFAULT_TAG_WHITELIST, + "html", + str, + ) + current_config.add( + "smv_remote_whitelist", + sphinx.DEFAULT_REMOTE_WHITELIST, + "html", + str, + ) + current_config.add( + "smv_released_pattern", + sphinx.DEFAULT_RELEASED_PATTERN, + "html", + str, + ) + current_config.add( + "smv_outputdir_format", + sphinx.DEFAULT_OUTPUTDIR_FORMAT, + "html", + str, + ) + current_config.add("smv_prefer_remote_refs", False, "html", bool) + current_config.pre_init_values() current_config.init_values() except Exception as err: @@ -77,7 +77,7 @@ def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults): q.put(current_config) -def load_sphinx_config(confpath, confoverrides, add_defaults=False): +def load_sphinx_config(confpath, confoverrides): q = multiprocessing.Queue() proc = multiprocessing.Process( target=load_sphinx_config_worker, @@ -181,9 +181,7 @@ def main(argv=None): confoverrides[key] = value # Parse config - config = load_sphinx_config( - confdir_absolute, confoverrides, add_defaults=True - ) + config = load_sphinx_config(confdir_absolute, confoverrides) # Get relative paths to root of git repository gitroot = pathlib.Path(