summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@hora-obscura.de>2019-07-18 04:38:42 +0000
committerStefan Sauer <ensonic@hora-obscura.de>2019-07-18 04:38:42 +0000
commit103bfae82558a16395e2203800da4c041fa792e0 (patch)
treead23edcb49eba2991bffcdb5fa7243374c36af0d
parent3a87f89913ddc8e33977d15388cb77c869eaf15c (diff)
parent1f44b1c692de1347ba88e58bbbd227de05454e62 (diff)
downloadgtk-doc-103bfae82558a16395e2203800da4c041fa792e0.tar.gz
Merge branch '86-gtkdoc-fixxref-script-fails-at-runtime-because-pygments-python3-module-is-not-found' into 'master'
meson: Check for required Python 3 modules Closes #86 See merge request GNOME/gtk-doc!35
-rw-r--r--meson.build19
1 files changed, 16 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 14a57df..85e83ca 100644
--- a/meson.build
+++ b/meson.build
@@ -1,11 +1,13 @@
project('gtk-doc', 'c',
version: '1.30.1',
license: 'GPL2+',
- meson_version: '>= 0.48.0',
+ meson_version: '>= 0.50.0', # needed for https://mesonbuild.com/Python-module.html#path
)
gnome = import('gnome')
-python = import('python3')
+python = import('python') # Meson new Python module https://mesonbuild.com/Python-module.html
+
+python3 = python.find_installation('python3')
version = meson.project_version()
package_name = meson.project_name()
@@ -34,7 +36,18 @@ python3_req = '>= 3.4.0'
python3_dep = dependency('python3', version: python3_req)
-python_prg = python.find_python()
+python_prg = python3
+
+# Python 3 required modules
+python3_required_modules = ['pygments']
+
+foreach p : python3_required_modules
+ # Source: https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported
+ script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
+ if run_command(python3, '-c', script).returncode() != 0
+ error('Required Python3 module \'' + p + '\' not found')
+ endif
+endforeach
pkgconfig_prg = find_program('pkg-config', required: true)
xsltproc_prg = find_program('xsltproc', required: true)