Mercurial > p > roundup > code
comparison roundup/dist/command/build_doc.py @ 4810:7b575e1f7368
setup.py build_doc: try Python-installed Sphinx if command
line tool is not found
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Sun, 25 Aug 2013 08:45:27 +0300 |
| parents | bca7c59ac400 |
| children | 7612b86bec69 |
comparison
equal
deleted
inserted
replaced
| 4809:80febeb6d897 | 4810:7b575e1f7368 |
|---|---|
| 24 | 24 |
| 25 def run(self): | 25 def run(self): |
| 26 """Run this command, i.e. do the actual document generation.""" | 26 """Run this command, i.e. do the actual document generation.""" |
| 27 | 27 |
| 28 sphinx = find_executable('sphinx-build') | 28 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 | |
| 29 if not sphinx: | 40 if not sphinx: |
| 30 self.warn("could not find sphinx-build in PATH") | 41 self.warn("could not find sphinx-build in PATH") |
| 31 self.warn("cannot build documentation") | 42 self.warn("cannot build documentation") |
| 32 return | 43 return |
| 33 | 44 |
| 34 doc_dir = os.path.join('share', 'doc', 'roundup', 'html') | 45 doc_dir = os.path.join('share', 'doc', 'roundup', 'html') |
| 35 temp_dir = os.path.join(self.build_temp, 'doc') | 46 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] |
| 37 spawn(cmd) | 48 spawn(cmd) |
