diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-16 23:53:16 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-17 16:17:40 -0500 |
commit | 32b14b1bb533e10c7344c2e04125a226553c9b9f (patch) | |
tree | 86075efb9a75a9381db1440779358bdf10b0f323 /mesonbuild/modules | |
parent | 0d3be23377c82f844aa7f9e9cb6074a8813400a4 (diff) | |
download | meson-32b14b1bb533e10c7344c2e04125a226553c9b9f.zip meson-32b14b1bb533e10c7344c2e04125a226553c9b9f.tar.gz meson-32b14b1bb533e10c7344c2e04125a226553c9b9f.tar.bz2 |
hotdoc module: run hotdoc as an external command during configure
We need to run it as an external command at build time anyway, and we
detect it by looking it up as an ExternalProgram. It seems odd to then
import it into Meson's python interpreter and run the main function.
Moreover, this errors out when you are running two different pythons,
one for Meson and one for hotdoc. For example, when hotdoc is installed
normally, but you're testing Meson against a nondefault newer version of
python.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/hotdoc.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py index 800f766..6a0c48b 100644 --- a/mesonbuild/modules/hotdoc.py +++ b/mesonbuild/modules/hotdoc.py @@ -15,6 +15,7 @@ '''This module provides helper functions for generating documentation using hotdoc''' import os +import subprocess from collections import OrderedDict from mesonbuild import mesonlib @@ -392,12 +393,14 @@ class HotDocModule(ExtensionModule): self.hotdoc = ExternalProgram('hotdoc') if not self.hotdoc.found(): raise MesonException('hotdoc executable not found') + version = self.hotdoc.get_version(interpreter) + if not mesonlib.version_compare(version, f'>={MIN_HOTDOC_VERSION}'): + raise MesonException(f'hotdoc {MIN_HOTDOC_VERSION} required but not found.)') - try: - from hotdoc.run_hotdoc import run # noqa: F401 - self.hotdoc.run_hotdoc = run - except Exception as e: - raise MesonException(f'hotdoc {MIN_HOTDOC_VERSION} required but not found. ({e})') + def run_hotdoc(cmd): + return subprocess.run(self.hotdoc.get_command() + cmd, stdout=subprocess.DEVNULL).returncode + + self.hotdoc.run_hotdoc = run_hotdoc self.methods.update({ 'has_extensions': self.has_extensions, 'generate_doc': self.generate_doc, |