changeset 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 608cec27bfea
children 67487063f421
files tasks/task_generate_doc.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tasks/task_generate_doc.py	Wed Jun 16 18:17:17 2021 +0000
+++ b/tasks/task_generate_doc.py	Tue Nov 30 17:38:36 2021 +0100
@@ -1,5 +1,6 @@
 #!/ur/bin/env python3
 
+import sys
 import os.path
 from sat.core.i18n import _
 from sat.core.log import getLogger
@@ -41,17 +42,19 @@
                 site_name = self.site_name))
             return
 
-        sphinx = self.findCommand('sphinx-build')
-
         # we first generate the sub documentations
         for name, sub_doc_path in list(self.sub_docs.items()):
             sub_dir = regex.pathEscape(name or '')
             build_path = os.path.join(self.build_path, 'doc', sub_dir)
-            await self.runCommand(sphinx, sub_doc_path, build_path)
+            await self.runCommand(
+                sys.executable, "-m", "sphinx", sub_doc_path, build_path,
+            )
 
         # then the root one
         if self.doc_path is not None:
             build_path = os.path.join(self.build_path, 'doc')
-            await self.runCommand(sphinx, self.doc_path, build_path)
+            await self.runCommand(
+                sys.executable, "-m", "sphinx", self.doc_path, build_path,
+            )
 
         log.info(_("documentation has been generated"))