Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to follow the FAQ. Use the conf.py file from your currently checked out branch. #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions sphinx_multiversion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,43 +31,43 @@ 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(
confpath,
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:
Expand All @@ -76,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,
Expand Down Expand Up @@ -180,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(
Expand Down Expand Up @@ -240,6 +239,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(
Expand Down