meson.build: check for missing python modules
Check those modules that aren't part of the python installation and bail out of meson where they're missing. This is technically wrong because we don't need them at build-time and only at run-time but pragmatically sensible because we waste too much time dealing with those bugs. Fixes #200 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
9c399c8eac
commit
c0628f1f19
|
@ -7,7 +7,7 @@ jobs:
|
|||
steps:
|
||||
- run:
|
||||
command: |
|
||||
dnf install -y meson gettext python3-devel pygobject3-devel python3-flake8 desktop-file-utils libappstream-glib python3-pytest python3-pyxdg python3-pyyaml
|
||||
dnf install -y meson gettext python3-devel pygobject3-devel python3-flake8 desktop-file-utils libappstream-glib python3-pytest python3-pyxdg python3-pyyaml python3-svgwrite
|
||||
- checkout
|
||||
- run:
|
||||
command: |
|
||||
|
|
21
meson.build
21
meson.build
|
@ -28,9 +28,26 @@ i18n = import('i18n')
|
|||
subdir('po')
|
||||
subdir('data')
|
||||
|
||||
# Find the directory to install our Python code
|
||||
pymod = import('python')
|
||||
py3 = pymod.find_installation()
|
||||
|
||||
# external python modules that are required for running Tuhi
|
||||
python_modules = [
|
||||
'svgwrite',
|
||||
'xdg',
|
||||
'gi',
|
||||
'yaml',
|
||||
]
|
||||
if meson.version().version_compare('>=0.51')
|
||||
py3 = pymod.find_installation(modules: python_modules)
|
||||
else
|
||||
py3 = pymod.find_installation()
|
||||
|
||||
foreach module: python_modules
|
||||
if run_command(py3, '-c', 'import @0@'.format(module)).returncode() != 0
|
||||
error('Failed to find required python module \'@0@\'.'.format(module))
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
python_dir = py3.get_install_dir()
|
||||
install_subdir('tuhi',
|
||||
install_dir: python_dir,
|
||||
|
|
Loading…
Reference in New Issue