Debian Codegraph @

test cases/python/2 extmodule/meson.build

raw
1 project('Python extension module', 'c',
2 default_options : ['buildtype=release', 'werror=true', 'python.bytecompile=-1'])
3 # Because Windows Python ships only with optimized libs,
4 # we must build this project the same way.
5
6 if meson.backend() != 'ninja'
7 error('MESON_SKIP_TEST: Ninja backend required')
8 endif
9
10
11 py_mod = import('python')
12 py = py_mod.find_installation()
13 py2 = py_mod.find_installation('python2', required: get_option('python2'), disabler: true)
14 py_dep = py.dependency(required: false)
15
16 if not py_dep.found()
17 error('MESON_SKIP_TEST: Python libraries not found.')
18 endif
19
20 subdir('ext')
21
22 blaster = configure_file(
23 input: 'blaster.py.in',
24 output: 'blaster.py',
25 configuration: {'tachyon_module': 'tachyon'}
26 )
27
28 test('extmod',
29 py,
30 args : blaster,
31 env : ['PYTHONPATH=' + pypathdir])
32
33 py.install_sources(blaster, pure: false)
34 py.install_sources(blaster, subdir: 'pure')
35 install_subdir('subinst', install_dir: py.get_install_dir(pure: false))
36
37 py2.install_sources(blaster, pure: false)
38 py2.install_sources(blaster, subdir: 'pure')
39 install_subdir('subinst', install_dir: py2.get_install_dir(pure: false))
40
41
42 py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false)
43 if py3_pkg_dep.found()
44 py3_dep_majver = py3_pkg_dep.version().split('.')
45 py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1]
46 message(f'got two pythons: pkg-config is @py3_dep_majver@, and module is', py.language_version())
47 if py3_dep_majver != py.language_version()
48 message('skipped python3 pkg-config test because the default python3 is different from Meson\'s')
49 else
50 python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir')
51
52 # Check we can apply a version constraint
53 dependency('python3', version: '>=@0@'.format(py_dep.version()))
54 endif
55 else
56 message('Skipped python3 pkg-config test because it was not found')
57 endif