Skip to content

Commit 7ebd13c

Browse files
committed
setup.py build_doc: try Python-installed Sphinx if command
line tool is not found
1 parent 0ddb9d3 commit 7ebd13c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

roundup/dist/command/build_doc.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@ def run(self):
2626
"""Run this command, i.e. do the actual document generation."""
2727

2828
sphinx = find_executable('sphinx-build')
29+
if sphinx:
30+
sphinx = [sphinx]
31+
else:
32+
try: # try to find version installed with Python tools
33+
# tested with Sphinx 1.1.3
34+
import sphinx as sp
35+
except ImportError:
36+
pass
37+
else:
38+
sphinx = [sys.executable, sp.__file__]
39+
2940
if not sphinx:
3041
self.warn("could not find sphinx-build in PATH")
3142
self.warn("cannot build documentation")
3243
return
3344

3445
doc_dir = os.path.join('share', 'doc', 'roundup', 'html')
3546
temp_dir = os.path.join(self.build_temp, 'doc')
36-
cmd = [sphinx, '-d', temp_dir, 'doc', doc_dir]
47+
cmd = sphinx + ['-d', temp_dir, 'doc', doc_dir]
3748
spawn(cmd)

0 commit comments

Comments
 (0)