Mercurial > libervia-website
comparison tasks/task_generate_doc.py @ 20:a24d362796be
use python module to run sphinx:
this way we are sure to run the right version with right Python environment.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 30 Nov 2021 17:38:36 +0100 |
parents | b5fc67c97c50 |
children | 5fd933e238bb |
comparison
equal
deleted
inserted
replaced
19:608cec27bfea | 20:a24d362796be |
---|---|
1 #!/ur/bin/env python3 | 1 #!/ur/bin/env python3 |
2 | 2 |
3 import sys | |
3 import os.path | 4 import os.path |
4 from sat.core.i18n import _ | 5 from sat.core.i18n import _ |
5 from sat.core.log import getLogger | 6 from sat.core.log import getLogger |
6 from sat.tools.common import regex | 7 from sat.tools.common import regex |
7 from libervia.server.tasks import task | 8 from libervia.server.tasks import task |
39 if self.doc_path is None and self.sub_docs is None: | 40 if self.doc_path is None and self.sub_docs is None: |
40 log.info("No documentation found for {site_name}, skipping".format( | 41 log.info("No documentation found for {site_name}, skipping".format( |
41 site_name = self.site_name)) | 42 site_name = self.site_name)) |
42 return | 43 return |
43 | 44 |
44 sphinx = self.findCommand('sphinx-build') | |
45 | |
46 # we first generate the sub documentations | 45 # we first generate the sub documentations |
47 for name, sub_doc_path in list(self.sub_docs.items()): | 46 for name, sub_doc_path in list(self.sub_docs.items()): |
48 sub_dir = regex.pathEscape(name or '') | 47 sub_dir = regex.pathEscape(name or '') |
49 build_path = os.path.join(self.build_path, 'doc', sub_dir) | 48 build_path = os.path.join(self.build_path, 'doc', sub_dir) |
50 await self.runCommand(sphinx, sub_doc_path, build_path) | 49 await self.runCommand( |
50 sys.executable, "-m", "sphinx", sub_doc_path, build_path, | |
51 ) | |
51 | 52 |
52 # then the root one | 53 # then the root one |
53 if self.doc_path is not None: | 54 if self.doc_path is not None: |
54 build_path = os.path.join(self.build_path, 'doc') | 55 build_path = os.path.join(self.build_path, 'doc') |
55 await self.runCommand(sphinx, self.doc_path, build_path) | 56 await self.runCommand( |
57 sys.executable, "-m", "sphinx", self.doc_path, build_path, | |
58 ) | |
56 | 59 |
57 log.info(_("documentation has been generated")) | 60 log.info(_("documentation has been generated")) |