Debian Codegraph @

test cases/python/4 custom target depends 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 if meson.backend() != 'ninja'
7 error('MESON_SKIP_TEST: Ninja backend required')
8 endif
9
10 py_mod = import('python')
11 py3 = py_mod.find_installation()
12 py3_dep = py3.dependency(required : false)
13 cc = meson.get_compiler('c')
14
15 if not py3_dep.found()
16 error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.')
17 endif
18
19 # Copy to the builddir so that blaster.py can find the built tachyon module
20 # FIXME: We should automatically detect this case and append the correct paths
21 # to PYTHONLIBDIR
22 blaster_py = configure_file(input : 'blaster.py',
23 output : 'blaster.py',
24 copy : true)
25
26 check_exists = '''
27 import os, sys
28 with open(sys.argv[1], 'rb') as f:
29 assert(f.read() == b'success')
30 '''
31
32 message('Detected Python version: ' + py3_dep.version())
33 if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1')
34 error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.')
35 endif
36 subdir('ext')
37
38 out_txt = custom_target('tachyon flux',
39 input : blaster_py,
40 output : 'out.txt',
41 command : [py3, '@INPUT@', '-o', '@OUTPUT@'],
42 depends : pylib,
43 build_by_default: true)
44
45 test('flux', py3, args : ['-c', check_exists, out_txt])