|
6 | 6 | import os |
7 | 7 | import sys |
8 | 8 |
|
9 | | -from sphinx import application, build_main, locale |
| 9 | +from sphinx import application, locale |
| 10 | +from sphinx.cmd.build import build_main |
10 | 11 | from sphinx.builders.html import StandaloneHTMLBuilder |
11 | 12 | from sphinx.config import Config as SphinxConfig |
12 | 13 | from sphinx.errors import SphinxError |
@@ -57,7 +58,10 @@ def builder_inited(app): |
57 | 58 |
|
58 | 59 | # Add versions.html to sidebar. |
59 | 60 | if '**' not in app.config.html_sidebars: |
60 | | - app.config.html_sidebars['**'] = StandaloneHTMLBuilder.default_sidebars + ['versions.html'] |
| 61 | + try: |
| 62 | + app.config.html_sidebars['**'] = StandaloneHTMLBuilder.default_sidebars + ['versions.html'] |
| 63 | + except AttributeError as e: |
| 64 | + app.config.html_sidebars['**'] = ['versions.html'] |
61 | 65 | elif 'versions.html' not in app.config.html_sidebars['**']: |
62 | 66 | app.config.html_sidebars['**'].append('versions.html') |
63 | 67 |
|
@@ -163,9 +167,9 @@ def setup(app): |
163 | 167 | class ConfigInject(SphinxConfig): |
164 | 168 | """Inject this extension info self.extensions. Append after user's extensions.""" |
165 | 169 |
|
166 | | - def __init__(self, dirname, filename, overrides, tags): |
| 170 | + def __init__(self, *args): |
167 | 171 | """Constructor.""" |
168 | | - super(ConfigInject, self).__init__(dirname, filename, overrides, tags) |
| 172 | + super(ConfigInject, self).__init__(*args) |
169 | 173 | self.extensions.append('sphinxcontrib.versioning.sphinx_') |
170 | 174 |
|
171 | 175 |
|
@@ -231,7 +235,7 @@ def build(source, target, versions, current_name, is_root): |
231 | 235 | :param bool is_root: Is this build in the web root? |
232 | 236 | """ |
233 | 237 | log = logging.getLogger(__name__) |
234 | | - argv = ('sphinx-build', source, target) |
| 238 | + argv = (source, target) |
235 | 239 | config = Config.from_context() |
236 | 240 |
|
237 | 241 | log.debug('Running sphinx-build for %s with args: %s', current_name, str(argv)) |
@@ -259,7 +263,7 @@ def read_config(source, current_name): |
259 | 263 | config = Config.from_context() |
260 | 264 |
|
261 | 265 | with TempDir() as temp_dir: |
262 | | - argv = ('sphinx-build', source, temp_dir) |
| 266 | + argv = (source, temp_dir) |
263 | 267 | log.debug('Running sphinx-build for config values with args: %s', str(argv)) |
264 | 268 | child = multiprocessing.Process(target=_read_config, args=(argv, config, current_name, queue)) |
265 | 269 | child.start() |
|
0 commit comments