Debian Codegraph @

test cases/python3/2 extmodule/meson.build

raw
1 project('Python extension module', 'c',
2 default_options : ['buildtype=release'])
3 # Because Windows Python ships only with optimized libs,
4 # we must build this project the same way.
5
6 py3_mod = import('python3')
7 py3 = py3_mod.find_python()
8 py3_dep = dependency('python3', required : false)
9 cc = meson.get_compiler('c')
10
11 if py3_dep.found()
12 message('Detected Python version: ' + py3_dep.version())
13 # Building extensions for Python 3 using Visual Studio 2015
14 # no longer works (or, rather, they build but don't run).
15 # Disable the tests in this case.
16 if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1')
17 error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.')
18 endif
19
20 subdir('ext')
21
22 test('extmod',
23 py3,
24 args : files('blaster.py'),
25 env : ['PYTHONPATH=' + pypathdir])
26
27 # Check we can apply a version constraint
28 dependency('python3', version: '>=@0@'.format(py3_dep.version()))
29
30 else
31 error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.')
32 endif
33
34 py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false)
35 if py3_pkg_dep.found()
36 python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir')
37 endif