Skip to content

Commit 2748a0d

Browse files
Compatibility for py3.8
1 parent 1ae1ecc commit 2748a0d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

sphinx_versioned/__main__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def main(
6060
False, "--floating-badge", "--badge", help="Turns the version selector menu into a floating badge."
6161
),
6262
ignore_conf: bool = typer.Option(
63-
False, "--ignore-conf", help="Ignores conf.py configuration file arguments for sphinx-versioned-docs. Warning: conf.py will still be used in sphinx!"
63+
False,
64+
"--ignore-conf",
65+
help="Ignores conf.py configuration file arguments for sphinx-versioned-docs. Warning: conf.py will still be used in sphinx!",
6466
),
6567
quite: bool = typer.Option(
6668
True, help="Silent `sphinx`. Use `--no-quite` to get build output from `sphinx`."
@@ -120,12 +122,14 @@ def main(
120122
-------
121123
:class:`sphinx_versioned.build.VersionedDocs`
122124
"""
123-
logger_format = "| <level>{level: <8}</level> | - <level>{message}</level>"
124-
125+
# Logger init
125126
log.remove()
127+
logger_format = "| <level>{level: <8}</level> | - <level>{message}</level>"
126128
log.add(sys.stderr, format=logger_format, level=loglevel.upper())
127129

130+
# Parse --branch into either select/exclude variables
128131
select_branch, exclude_branch = parse_branch_selection(branches)
132+
129133
config = {
130134
"reset_intersphinx_mapping": reset_intersphinx_mapping,
131135
"sphinx_compatibility": sphinx_compatibility,
@@ -138,18 +142,18 @@ def main(
138142
"verbose": verbose,
139143
"quite": quite,
140144
}
141-
145+
# Filtered config dict, containing only variables which are `True`
142146
filtered_config = {x: y for x, y in config.items() if y}
143147

148+
# VersionedDocs instance
144149
DocsBuilder = VersionedDocs(
145150
chdir=chdir,
146151
local_conf=local_conf,
147152
output_dir=output_dir,
148153
git_root=git_root,
149154
ignore_conf=ignore_conf,
150-
config=filtered_config
155+
config=filtered_config,
151156
)
152-
153157
return DocsBuilder.run()
154158

155159

sphinx_versioned/build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ class VersionedDocs:
3232
Documentation output directory.
3333
git_root : :class:`str`
3434
If git root differs from chdir/CWD, that location can be supplied via this variable.
35+
ignore_conf : :class:`bool`
36+
Ignores conf.py configuration file arguments for sphinx-versioned-docs.
3537
config : :class:`dict`
3638
CLI configuration arguments.
3739
"""
3840

39-
def __init__(self, chdir: str, local_conf: str, output_dir: str, git_root: str, ignore_conf:bool, config: dict) -> None:
41+
def __init__(
42+
self, chdir: str, local_conf: str, output_dir: str, git_root: str, ignore_conf: bool, config: dict
43+
) -> None:
4044
# chdir if required
4145
if chdir:
4246
self.chdir = pathlib.Path(chdir)
@@ -103,7 +107,7 @@ def read_conf(self) -> bool:
103107
log.debug(f"Configuration file arugments: {sv_conf_values}")
104108

105109
# Make a master config variable
106-
self.config = sv_conf_values | self._raw_cli_config
110+
self.config = {**sv_conf_values, **self._raw_cli_config}
107111
log.debug(f"master config: {self.config}")
108112
return
109113

0 commit comments

Comments
 (0)