Skip to content

Commit 20ec68b

Browse files
Compatibility for py3.8
1 parent 74cc0c4 commit 20ec68b

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class VersionedDocs:
3333
Documentation output directory.
3434
git_root : :class:`str`
3535
If git root differs from chdir/CWD, that location can be supplied via this variable.
36+
ignore_conf : :class:`bool`
37+
Ignores conf.py configuration file arguments for sphinx-versioned-docs.
3638
config : :class:`dict`
3739
CLI configuration arguments.
3840
"""
@@ -101,7 +103,7 @@ def read_conf(self) -> bool:
101103
log.debug(f"Configuration file arugments: {sv_conf_values}")
102104

103105
# Make a master config variable
104-
self.config = sv_conf_values | self._raw_cli_config
106+
self.config = {**sv_conf_values, **self._raw_cli_config}
105107
log.debug(f"master config: {self.config}")
106108
return
107109

0 commit comments

Comments
 (0)