Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Commit dc568d8

Browse files
authored
Merge pull request #3 from leokoppel/master
Compatability with sphinx >=1.7 (from leokoppel)
2 parents 920edec + 93fe262 commit dc568d8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

sphinxcontrib/versioning/git.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ def extract(stdout):
308308
tar.extract(member=info, path=target)
309309
if os.path.splitext(info.name)[1].lower() == '.rst':
310310
mtimes.append(info.name)
311-
for info in (i for i in queued_links if os.path.exists(os.path.join(target, i.linkname))):
311+
for info in queued_links:
312+
# There used to be a check for broken symlinks here, but it was buggy
312313
tar.extract(member=info, path=target)
313314
except tarfile.TarError as exc:
314315
log.debug('Failed to extract output from "git archive" command: %s', str(exc))

sphinxcontrib/versioning/sphinx_.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import os
77
import sys
88

9-
from sphinx import application, build_main, locale
9+
from sphinx import application, locale
10+
from sphinx.cmd.build import build_main
1011
from sphinx.builders.html import StandaloneHTMLBuilder
1112
from sphinx.config import Config as SphinxConfig
1213
from sphinx.errors import SphinxError
@@ -57,7 +58,10 @@ def builder_inited(app):
5758

5859
# Add versions.html to sidebar.
5960
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']
6165
elif 'versions.html' not in app.config.html_sidebars['**']:
6266
app.config.html_sidebars['**'].append('versions.html')
6367

@@ -163,9 +167,9 @@ def setup(app):
163167
class ConfigInject(SphinxConfig):
164168
"""Inject this extension info self.extensions. Append after user's extensions."""
165169

166-
def __init__(self, dirname, filename, overrides, tags):
170+
def __init__(self, *args):
167171
"""Constructor."""
168-
super(ConfigInject, self).__init__(dirname, filename, overrides, tags)
172+
super(ConfigInject, self).__init__(*args)
169173
self.extensions.append('sphinxcontrib.versioning.sphinx_')
170174

171175

@@ -231,7 +235,7 @@ def build(source, target, versions, current_name, is_root):
231235
:param bool is_root: Is this build in the web root?
232236
"""
233237
log = logging.getLogger(__name__)
234-
argv = ('sphinx-build', source, target)
238+
argv = (source, target)
235239
config = Config.from_context()
236240

237241
log.debug('Running sphinx-build for %s with args: %s', current_name, str(argv))
@@ -259,7 +263,7 @@ def read_config(source, current_name):
259263
config = Config.from_context()
260264

261265
with TempDir() as temp_dir:
262-
argv = ('sphinx-build', source, temp_dir)
266+
argv = (source, temp_dir)
263267
log.debug('Running sphinx-build for config values with args: %s', str(argv))
264268
child = multiprocessing.Process(target=_read_config, args=(argv, config, current_name, queue))
265269
child.start()

0 commit comments

Comments
 (0)