diff options
Diffstat (limited to '')
70 files changed, 1094 insertions, 0 deletions
diff --git a/test cases/python/1 basic/gluon/__init__.py b/test cases/python/1 basic/gluon/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/1 basic/gluon/__init__.py diff --git a/test cases/python/1 basic/gluon/gluonator.py b/test cases/python/1 basic/gluon/gluonator.py new file mode 100644 index 0000000..b53d6de --- /dev/null +++ b/test cases/python/1 basic/gluon/gluonator.py @@ -0,0 +1,2 @@ +def gluoninate(): + return 42 diff --git a/test cases/python/1 basic/meson.build b/test cases/python/1 basic/meson.build new file mode 100644 index 0000000..2e543dd --- /dev/null +++ b/test cases/python/1 basic/meson.build @@ -0,0 +1,27 @@ +project('python sample') + +py_mod = import('python') +py = py_mod.find_installation('python3') + +py_version = py.language_version() +if py_version.version_compare('< 3.2') + error('MESON_SKIP_TEST python 3 required for tests') +endif + +py_purelib = py.get_path('purelib') +if not (py_purelib.endswith('site-packages') or py_purelib.endswith('dist-packages')) + error('Python3 purelib path seems invalid? ' + py_purelib) +endif +message('Python purelib path:', py_purelib) + +# could be 'lib64' or 'Lib' on some systems +py_platlib = py.get_path('platlib') +if not (py_platlib.endswith('site-packages') or py_platlib.endswith('dist-packages')) + error('Python3 platlib path seems invalid? ' + py_platlib) +endif + +main = files('prog.py') + +test('toplevel', py, args : main) + +subdir('subdir') diff --git a/test cases/python/1 basic/prog.py b/test cases/python/1 basic/prog.py new file mode 100755 index 0000000..720fdb1 --- /dev/null +++ b/test cases/python/1 basic/prog.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +from gluon import gluonator + +print('Running mainprog from root dir.') + +if gluonator.gluoninate() != 42: + raise ValueError("!= 42") diff --git a/test cases/python/1 basic/subdir/meson.build b/test cases/python/1 basic/subdir/meson.build new file mode 100644 index 0000000..66957c1 --- /dev/null +++ b/test cases/python/1 basic/subdir/meson.build @@ -0,0 +1,4 @@ +test('subdir', + py, + args : files('subprog.py'), + env : 'PYTHONPATH=' + meson.source_root()) diff --git a/test cases/python/1 basic/subdir/subprog.py b/test cases/python/1 basic/subdir/subprog.py new file mode 100755 index 0000000..54178e5 --- /dev/null +++ b/test cases/python/1 basic/subdir/subprog.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +# In order to run this program, PYTHONPATH must be set to +# point to source root. + +from gluon import gluonator + +print('Running mainprog from subdir.') + +if gluonator.gluoninate() != 42: + raise ValueError("!= 42") diff --git a/test cases/python/2 extmodule/blaster.py.in b/test cases/python/2 extmodule/blaster.py.in new file mode 100755 index 0000000..b690b40 --- /dev/null +++ b/test cases/python/2 extmodule/blaster.py.in @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import @tachyon_module@ as tachyon + +result = tachyon.phaserize('shoot') + +if not isinstance(result, int): + raise SystemExit('Returned result not an integer.') + +if result != 1: + raise SystemExit(f'Returned result {result} is not 1.') diff --git a/test cases/python/2 extmodule/ext/meson.build b/test cases/python/2 extmodule/ext/meson.build new file mode 100644 index 0000000..14fa94a --- /dev/null +++ b/test cases/python/2 extmodule/ext/meson.build @@ -0,0 +1,9 @@ +pylib = py.extension_module('tachyon', + 'tachyon_module.c', + c_args: '-DMESON_MODULENAME="tachyon"', + install: true, +) + +subdir('nested') +subdir('wrongdir') +pypathdir = meson.current_build_dir() diff --git a/test cases/python/2 extmodule/ext/nested/meson.build b/test cases/python/2 extmodule/ext/nested/meson.build new file mode 100644 index 0000000..34c1192 --- /dev/null +++ b/test cases/python/2 extmodule/ext/nested/meson.build @@ -0,0 +1,15 @@ +py.extension_module('tachyon', + '../tachyon_module.c', + c_args: '-DMESON_MODULENAME="nested.tachyon"', + install: true, + subdir: 'nested' +) +py.install_sources( + configure_file( + input: '../../blaster.py.in', + output: 'blaster.py', + configuration: {'tachyon_module': 'nested.tachyon'} + ), + pure: false, + subdir: 'nested', +) diff --git a/test cases/python/2 extmodule/ext/tachyon_module.c b/test cases/python/2 extmodule/ext/tachyon_module.c new file mode 100644 index 0000000..a5d7cdc --- /dev/null +++ b/test cases/python/2 extmodule/ext/tachyon_module.c @@ -0,0 +1,49 @@ +/* + Copyright 2016 The Meson development team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* A very simple Python extension module. */ + +#include <Python.h> +#include <string.h> + +static PyObject* phaserize(PyObject *self, PyObject *args) { + const char *message; + int result; + + if(!PyArg_ParseTuple(args, "s", &message)) + return NULL; + + result = strcmp(message, "shoot") ? 0 : 1; + return PyLong_FromLong(result); +} + +static PyMethodDef TachyonMethods[] = { + {"phaserize", phaserize, METH_VARARGS, + "Shoot tachyon cannons."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef tachyonmodule = { + PyModuleDef_HEAD_INIT, + MESON_MODULENAME, + NULL, + -1, + TachyonMethods +}; + +PyMODINIT_FUNC PyInit_tachyon(void) { + return PyModule_Create(&tachyonmodule); +} diff --git a/test cases/python/2 extmodule/ext/wrongdir/meson.build b/test cases/python/2 extmodule/ext/wrongdir/meson.build new file mode 100644 index 0000000..5074701 --- /dev/null +++ b/test cases/python/2 extmodule/ext/wrongdir/meson.build @@ -0,0 +1,6 @@ +py.extension_module('tachyon', + '../tachyon_module.c', + c_args: '-DMESON_MODULENAME="tachyon"', + install: true, + install_dir: get_option('libdir') +) diff --git a/test cases/python/2 extmodule/meson.build b/test cases/python/2 extmodule/meson.build new file mode 100644 index 0000000..239492c --- /dev/null +++ b/test cases/python/2 extmodule/meson.build @@ -0,0 +1,50 @@ +project('Python extension module', 'c', + default_options : ['buildtype=release']) +# Because Windows Python ships only with optimized libs, +# we must build this project the same way. + +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif + + +py_mod = import('python') +py = py_mod.find_installation() +py_dep = py.dependency(required: false) + +if not py_dep.found() + error('MESON_SKIP_TEST: Python libraries not found.') +endif + +subdir('ext') + +blaster = configure_file( + input: 'blaster.py.in', + output: 'blaster.py', + configuration: {'tachyon_module': 'tachyon'} +) + +test('extmod', + py, + args : blaster, + env : ['PYTHONPATH=' + pypathdir]) + +py.install_sources(blaster, pure: false) +py.install_sources(blaster, subdir: 'pure') + +py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false) +if py3_pkg_dep.found() + py3_dep_majver = py3_pkg_dep.version().split('.') + py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1] + message(f'got two pythons: pkg-config is @py3_dep_majver@, and module is', py.language_version()) + if py3_dep_majver != py.language_version() + message('skipped python3 pkg-config test because the default python3 is different from Meson\'s') + else + python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir') + + # Check we can apply a version constraint + dependency('python3', version: '>=@0@'.format(py_dep.version())) + endif +else + message('Skipped python3 pkg-config test because it was not found') +endif diff --git a/test cases/python/2 extmodule/test.json b/test cases/python/2 extmodule/test.json new file mode 100644 index 0000000..6bd1195 --- /dev/null +++ b/test cases/python/2 extmodule/test.json @@ -0,0 +1,13 @@ +{ + "installed": [ + { "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/blaster.py" }, + { "type": "python_lib", "file": "usr/@PYTHON_PLATLIB@/tachyon" }, + { "type": "py_implib", "file": "usr/@PYTHON_PLATLIB@/tachyon" }, + { "type": "python_file", "file": "usr/@PYTHON_PURELIB@/pure/blaster.py" }, + { "type": "python_file", "file": "usr/@PYTHON_PLATLIB@/nested/blaster.py" }, + { "type": "python_lib", "file": "usr/@PYTHON_PLATLIB@/nested/tachyon" }, + { "type": "py_implib", "file": "usr/@PYTHON_PLATLIB@/nested/tachyon" }, + { "type": "python_lib", "file": "usr/lib/tachyon" }, + { "type": "py_implib", "file": "usr/lib/tachyon" } + ] +} diff --git a/test cases/python/3 cython/cytest.py b/test cases/python/3 cython/cytest.py new file mode 100755 index 0000000..c08ffee --- /dev/null +++ b/test cases/python/3 cython/cytest.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +from storer import Storer + +s = Storer() + +if s.get_value() != 0: + raise SystemExit('Initial value incorrect.') + +s.set_value(42) + +if s.get_value() != 42: + raise SystemExit('Setting value failed.') + +try: + s.set_value('not a number') + raise SystemExit('Using wrong argument type did not fail.') +except TypeError: + pass diff --git a/test cases/python/3 cython/libdir/cstorer.pxd b/test cases/python/3 cython/libdir/cstorer.pxd new file mode 100644 index 0000000..7b730fc --- /dev/null +++ b/test cases/python/3 cython/libdir/cstorer.pxd @@ -0,0 +1,9 @@ + +cdef extern from "storer.h": + ctypedef struct Storer: + pass + + Storer* storer_new(); + void storer_destroy(Storer *s); + int storer_get_value(Storer *s); + void storer_set_value(Storer *s, int v); diff --git a/test cases/python/3 cython/libdir/meson.build b/test cases/python/3 cython/libdir/meson.build new file mode 100644 index 0000000..2b6ebc7 --- /dev/null +++ b/test cases/python/3 cython/libdir/meson.build @@ -0,0 +1,11 @@ +pyx_c = custom_target('storer_pyx', + output : 'storer_pyx.c', + input : 'storer.pyx', + command : [cython, '@INPUT@', '-o', '@OUTPUT@'], +) + +slib = py3.extension_module('storer', + 'storer.c', pyx_c, + dependencies : py3_dep) + +pydir = meson.current_build_dir() diff --git a/test cases/python/3 cython/libdir/storer.c b/test cases/python/3 cython/libdir/storer.c new file mode 100644 index 0000000..0199bb8 --- /dev/null +++ b/test cases/python/3 cython/libdir/storer.c @@ -0,0 +1,24 @@ +#include"storer.h" +#include<stdlib.h> + +struct _Storer { + int value; +}; + +Storer* storer_new() { + Storer *s = malloc(sizeof(struct _Storer)); + s->value = 0; + return s; +} + +void storer_destroy(Storer *s) { + free(s); +} + +int storer_get_value(Storer *s) { + return s->value; +} + +void storer_set_value(Storer *s, int v) { + s->value = v; +} diff --git a/test cases/python/3 cython/libdir/storer.h b/test cases/python/3 cython/libdir/storer.h new file mode 100644 index 0000000..4f71917 --- /dev/null +++ b/test cases/python/3 cython/libdir/storer.h @@ -0,0 +1,8 @@ +#pragma once + +typedef struct _Storer Storer; + +Storer* storer_new(); +void storer_destroy(Storer *s); +int storer_get_value(Storer *s); +void storer_set_value(Storer *s, int v); diff --git a/test cases/python/3 cython/libdir/storer.pyx b/test cases/python/3 cython/libdir/storer.pyx new file mode 100644 index 0000000..ed551dc --- /dev/null +++ b/test cases/python/3 cython/libdir/storer.pyx @@ -0,0 +1,16 @@ +cimport cstorer + +cdef class Storer: + cdef cstorer.Storer* _c_storer + + def __cinit__(self): + self._c_storer = cstorer.storer_new() + + def __dealloc__(self): + cstorer.storer_destroy(self._c_storer) + + cpdef int get_value(self): + return cstorer.storer_get_value(self._c_storer) + + cpdef set_value(self, int value): + cstorer.storer_set_value(self._c_storer, value) diff --git a/test cases/python/3 cython/meson.build b/test cases/python/3 cython/meson.build new file mode 100644 index 0000000..5fc07a8 --- /dev/null +++ b/test cases/python/3 cython/meson.build @@ -0,0 +1,26 @@ +project('cython', 'c', + default_options : ['warning_level=3']) + +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif + +cython = find_program('cython', required : false) +if not cython.found() + error('MESON_SKIP_TEST: Cython3 not found.') +endif + +py_mod = import('python') +py3 = py_mod.find_installation() +py3_dep = py3.dependency(required: false) +if not py3_dep.found() + error('MESON_SKIP_TEST: Python library not found.') +endif + +subdir('libdir') + +test('cython tester', + py3, + args : files('cytest.py'), + env : ['PYTHONPATH=' + pydir] +) diff --git a/test cases/python/4 custom target depends extmodule/blaster.py b/test cases/python/4 custom target depends extmodule/blaster.py new file mode 100644 index 0000000..61b11f9 --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/blaster.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os +import sys +import argparse + +from pathlib import Path + +filedir = Path(os.path.dirname(__file__)).resolve() +if list(filedir.glob('ext/*tachyon*')): + sys.path.insert(0, (filedir / 'ext').as_posix()) + +import tachyon + +parser = argparse.ArgumentParser() +parser.add_argument('-o', dest='output', default=None) + +options = parser.parse_args(sys.argv[1:]) + +result = tachyon.phaserize('shoot') + +if options.output: + with open(options.output, 'w') as f: + f.write('success') + +if not isinstance(result, int): + raise SystemExit('Returned result not an integer.') + +if result != 1: + raise SystemExit(f'Returned result {result} is not 1.') diff --git a/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c b/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c new file mode 100644 index 0000000..aeff296 --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c @@ -0,0 +1,8 @@ +#ifdef _MSC_VER +__declspec(dllexport) +#endif +const char* +tachyon_phaser_command (void) +{ + return "shoot"; +} diff --git a/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h b/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h new file mode 100644 index 0000000..dca71d3 --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h @@ -0,0 +1,6 @@ +#pragma once + +#ifdef _MSC_VER +__declspec(dllimport) +#endif +const char* tachyon_phaser_command (void); diff --git a/test cases/python/4 custom target depends extmodule/ext/lib/meson.build b/test cases/python/4 custom target depends extmodule/ext/lib/meson.build new file mode 100644 index 0000000..b1f8938 --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/ext/lib/meson.build @@ -0,0 +1,4 @@ +libtachyon = shared_library('tachyonlib', 'meson-tachyonlib.c') + +libtachyon_dep = declare_dependency(link_with : libtachyon, + include_directories : include_directories('.')) diff --git a/test cases/python/4 custom target depends extmodule/ext/meson.build b/test cases/python/4 custom target depends extmodule/ext/meson.build new file mode 100644 index 0000000..1bb275d --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/ext/meson.build @@ -0,0 +1,6 @@ +subdir('lib') + +pylib = py3.extension_module('tachyon', + 'tachyon_module.c', + dependencies : [libtachyon_dep, py3_dep], +) diff --git a/test cases/python/4 custom target depends extmodule/ext/tachyon_module.c b/test cases/python/4 custom target depends extmodule/ext/tachyon_module.c new file mode 100644 index 0000000..b48032b --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/ext/tachyon_module.c @@ -0,0 +1,51 @@ +/* + Copyright 2016 The Meson development team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* A very simple Python extension module. */ + +#include <Python.h> +#include <string.h> + +#include "meson-tachyonlib.h" + +static PyObject* phaserize(PyObject *self, PyObject *args) { + const char *message; + int result; + + if(!PyArg_ParseTuple(args, "s", &message)) + return NULL; + + result = strcmp(message, tachyon_phaser_command()) ? 0 : 1; + return PyLong_FromLong(result); +} + +static PyMethodDef TachyonMethods[] = { + {"phaserize", phaserize, METH_VARARGS, + "Shoot tachyon cannons."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef tachyonmodule = { + PyModuleDef_HEAD_INIT, + "tachyon", + NULL, + -1, + TachyonMethods +}; + +PyMODINIT_FUNC PyInit_tachyon(void) { + return PyModule_Create(&tachyonmodule); +} diff --git a/test cases/python/4 custom target depends extmodule/meson.build b/test cases/python/4 custom target depends extmodule/meson.build new file mode 100644 index 0000000..d8a62ed --- /dev/null +++ b/test cases/python/4 custom target depends extmodule/meson.build @@ -0,0 +1,45 @@ +project('Python extension module', 'c', + default_options : ['buildtype=release']) +# Because Windows Python ships only with optimized libs, +# we must build this project the same way. + +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif + +py_mod = import('python') +py3 = py_mod.find_installation() +py3_dep = py3.dependency(required : false) +cc = meson.get_compiler('c') + +if not py3_dep.found() + error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') +endif + +# Copy to the builddir so that blaster.py can find the built tachyon module +# FIXME: We should automatically detect this case and append the correct paths +# to PYTHONLIBDIR +blaster_py = configure_file(input : 'blaster.py', + output : 'blaster.py', + copy : true) + +check_exists = ''' +import os, sys +with open(sys.argv[1], 'rb') as f: + assert(f.read() == b'success') +''' + +message('Detected Python version: ' + py3_dep.version()) +if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') + error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') +endif +subdir('ext') + +out_txt = custom_target('tachyon flux', + input : blaster_py, + output : 'out.txt', + command : [py3, '@INPUT@', '-o', '@OUTPUT@'], + depends : pylib, + build_by_default: true) + +test('flux', py3, args : ['-c', check_exists, out_txt]) diff --git a/test cases/python/5 modules kwarg/meson.build b/test cases/python/5 modules kwarg/meson.build new file mode 100644 index 0000000..9751ada --- /dev/null +++ b/test cases/python/5 modules kwarg/meson.build @@ -0,0 +1,7 @@ +project('python kwarg') + +py = import('python') +prog_python = py.find_installation('python3', modules : ['distutils']) +assert(prog_python.found() == true, 'python not found when should be') +prog_python = py.find_installation('python3', modules : ['thisbetternotexistmod'], required : false) +assert(prog_python.found() == false, 'python not found but reported as found') diff --git a/test cases/python/6 failing subproject/meson.build b/test cases/python/6 failing subproject/meson.build new file mode 100644 index 0000000..cc33a1c --- /dev/null +++ b/test cases/python/6 failing subproject/meson.build @@ -0,0 +1,5 @@ +project('foo', 'cpp') + +# Regression test for https://github.com/mesonbuild/meson/issues/9038 +dependency('bar', required: false, allow_fallback: true) +python = import('python').find_installation('python3').dependency() diff --git a/test cases/python/6 failing subproject/subprojects/bar/meson.build b/test cases/python/6 failing subproject/subprojects/bar/meson.build new file mode 100644 index 0000000..21431ca --- /dev/null +++ b/test cases/python/6 failing subproject/subprojects/bar/meson.build @@ -0,0 +1,4 @@ +project('bar', 'cpp') + +python = import('python').find_installation('python3') +dependency('nonexistant-dependency') diff --git a/test cases/python/7 install path/meson.build b/test cases/python/7 install path/meson.build new file mode 100644 index 0000000..1075c1b --- /dev/null +++ b/test cases/python/7 install path/meson.build @@ -0,0 +1,20 @@ +project('install path', + default_options: [ + 'python.purelibdir=/pure', + 'python.platlibdir=/plat' + ] +) + +py = import('python').find_installation() +py.install_sources('test.py') +py.install_sources('test.py', pure: false) +install_data('test.py', install_dir: py.get_install_dir() / 'data') +install_data('test.py', install_dir: py.get_install_dir(pure: false) / 'data') + +py_plat = import('python').find_installation(pure: false) +py_plat.install_sources('test.py', subdir: 'kw') +py_plat.install_sources('test.py', pure: true, subdir: 'kwrevert') +install_data('test.py', install_dir: py_plat.get_install_dir() / 'kw/data') +install_data('test.py', install_dir: py_plat.get_install_dir(pure: true) / 'kwrevert/data') + +subdir('structured') diff --git a/test cases/python/7 install path/structured/alpha/one.py b/test cases/python/7 install path/structured/alpha/one.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/alpha/one.py diff --git a/test cases/python/7 install path/structured/alpha/three.py b/test cases/python/7 install path/structured/alpha/three.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/alpha/three.py diff --git a/test cases/python/7 install path/structured/alpha/two.py b/test cases/python/7 install path/structured/alpha/two.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/alpha/two.py diff --git a/test cases/python/7 install path/structured/beta/one.py b/test cases/python/7 install path/structured/beta/one.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/beta/one.py diff --git a/test cases/python/7 install path/structured/meson.build b/test cases/python/7 install path/structured/meson.build new file mode 100644 index 0000000..6c85587 --- /dev/null +++ b/test cases/python/7 install path/structured/meson.build @@ -0,0 +1,9 @@ +py.install_sources( + 'one.py', + 'two.py', + 'alpha/one.py', + 'alpha/two.py', + 'alpha/three.py', + 'beta/one.py', + preserve_path: true, +) diff --git a/test cases/python/7 install path/structured/one.py b/test cases/python/7 install path/structured/one.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/one.py diff --git a/test cases/python/7 install path/structured/two.py b/test cases/python/7 install path/structured/two.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/structured/two.py diff --git a/test cases/python/7 install path/test.json b/test cases/python/7 install path/test.json new file mode 100644 index 0000000..cf8e7a9 --- /dev/null +++ b/test cases/python/7 install path/test.json @@ -0,0 +1,18 @@ +{ + "installed": [ + {"type": "file", "file": "pure/one.py"}, + {"type": "file", "file": "pure/two.py"}, + {"type": "file", "file": "pure/alpha/one.py"}, + {"type": "file", "file": "pure/alpha/two.py"}, + {"type": "file", "file": "pure/alpha/three.py"}, + {"type": "file", "file": "pure/beta/one.py"}, + {"type": "file", "file": "plat/kw/test.py"}, + {"type": "file", "file": "pure/kwrevert/test.py"}, + {"type": "file", "file": "plat/test.py"}, + {"type": "file", "file": "pure/test.py"}, + {"type": "file", "file": "plat/data/test.py"}, + {"type": "file", "file": "pure/data/test.py"}, + {"type": "file", "file": "plat/kw/data/test.py"}, + {"type": "file", "file": "pure/kwrevert/data/test.py"} + ] +} diff --git a/test cases/python/7 install path/test.py b/test cases/python/7 install path/test.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python/7 install path/test.py diff --git a/test cases/python/8 different python versions/blaster.py b/test cases/python/8 different python versions/blaster.py new file mode 100755 index 0000000..163b6d4 --- /dev/null +++ b/test cases/python/8 different python versions/blaster.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import sys +import tachyon + +result = tachyon.phaserize('shoot') + +if not isinstance(result, int): + print('Returned result not an integer.') + sys.exit(1) + +if result != 1: + print('Returned result {} is not 1.'.format(result)) + sys.exit(1) diff --git a/test cases/python/8 different python versions/ext/meson.build b/test cases/python/8 different python versions/ext/meson.build new file mode 100644 index 0000000..b13bb32 --- /dev/null +++ b/test cases/python/8 different python versions/ext/meson.build @@ -0,0 +1,6 @@ +pylib = py.extension_module('tachyon', + 'tachyon_module.c', + dependencies : py_dep, +) + +pypathdir = meson.current_build_dir() diff --git a/test cases/python/8 different python versions/ext/tachyon_module.c b/test cases/python/8 different python versions/ext/tachyon_module.c new file mode 100644 index 0000000..68eda53 --- /dev/null +++ b/test cases/python/8 different python versions/ext/tachyon_module.c @@ -0,0 +1,59 @@ +/* + Copyright 2018 The Meson development team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* A very simple Python extension module. */ + +#include <Python.h> +#include <string.h> + +static PyObject* phaserize(PyObject *self, PyObject *args) { + const char *message; + int result; + + if(!PyArg_ParseTuple(args, "s", &message)) + return NULL; + + result = strcmp(message, "shoot") ? 0 : 1; +#if PY_VERSION_HEX < 0x03000000 + return PyInt_FromLong(result); +#else + return PyLong_FromLong(result); +#endif +} + +static PyMethodDef TachyonMethods[] = { + {"phaserize", phaserize, METH_VARARGS, + "Shoot tachyon cannons."}, + {NULL, NULL, 0, NULL} +}; + +#if PY_VERSION_HEX < 0x03000000 +PyMODINIT_FUNC inittachyon(void) { + Py_InitModule("tachyon", TachyonMethods); +} +#else +static struct PyModuleDef tachyonmodule = { + PyModuleDef_HEAD_INIT, + "tachyon", + NULL, + -1, + TachyonMethods +}; + +PyMODINIT_FUNC PyInit_tachyon(void) { + return PyModule_Create(&tachyonmodule); +} +#endif diff --git a/test cases/python/8 different python versions/meson.build b/test cases/python/8 different python versions/meson.build new file mode 100644 index 0000000..2655b06 --- /dev/null +++ b/test cases/python/8 different python versions/meson.build @@ -0,0 +1,34 @@ +project('Python extension module', 'c', + default_options : ['buildtype=release']) + +py_mod = import('python') + +py = py_mod.find_installation(get_option('python'), required : false) + +# CI images don't have 32-bit python2 for 32-bit windows, +# so this actually gets detected then fails +require = not ( + get_option('python') == 'python2' and + host_machine.system() == 'windows' and + host_machine.cpu() == 'x86' +) + +if py.found() + py_dep = py.dependency(required: require) + + if py_dep.found() + subdir('ext') + + test('extmod', + py, + args : files('blaster.py'), + env : ['PYTHONPATH=' + pypathdir]) + else + error('MESON_SKIP_TEST: Python libraries not found, skipping test.') + endif +else + error('MESON_SKIP_TEST: Python not found, skipping test.') +endif + +py = py_mod.find_installation(get_option('python'), required : get_option('disabled_opt')) +assert(not py.found(), 'find_installation not working with disabled feature') diff --git a/test cases/python/8 different python versions/meson_options.txt b/test cases/python/8 different python versions/meson_options.txt new file mode 100644 index 0000000..c85110d --- /dev/null +++ b/test cases/python/8 different python versions/meson_options.txt @@ -0,0 +1,4 @@ +option('python', type: 'string', + description: 'Name of or path to the python executable' +) +option('disabled_opt', type: 'feature', value: 'disabled') diff --git a/test cases/python/8 different python versions/test.json b/test cases/python/8 different python versions/test.json new file mode 100644 index 0000000..fe75a1c --- /dev/null +++ b/test cases/python/8 different python versions/test.json @@ -0,0 +1,13 @@ +{ + "matrix": { + "options": { + "python": [ + { "val": null }, + { "val": "python2" }, + { "val": "python3" }, + { "val": "pypy" }, + { "val": "pypy3" } + ] + } + } +} diff --git a/test cases/python3/1 basic/gluon/__init__.py b/test cases/python3/1 basic/gluon/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/python3/1 basic/gluon/__init__.py diff --git a/test cases/python3/1 basic/gluon/gluonator.py b/test cases/python3/1 basic/gluon/gluonator.py new file mode 100644 index 0000000..b53d6de --- /dev/null +++ b/test cases/python3/1 basic/gluon/gluonator.py @@ -0,0 +1,2 @@ +def gluoninate(): + return 42 diff --git a/test cases/python3/1 basic/meson.build b/test cases/python3/1 basic/meson.build new file mode 100644 index 0000000..48cfb6d --- /dev/null +++ b/test cases/python3/1 basic/meson.build @@ -0,0 +1,34 @@ +project('python sample', 'c') + +py3_mod = import('python3') +py3 = py3_mod.find_python() + +py3_version = py3_mod.language_version() +if py3_version.version_compare('< 3.2') + error('Invalid python version!?') +endif + +py3_purelib = py3_mod.sysconfig_path('purelib') +message('Python purelib:', py3_purelib) +if not (py3_purelib.endswith('site-packages') or py3_purelib.endswith('dist-packages')) + error('Python3 purelib path seems invalid?') +endif + +# could be 'lib64' or 'Lib' on some systems +py3_platlib = py3_mod.sysconfig_path('platlib') +message('Python platlib:', py3_platlib) +if not (py3_platlib.endswith('site-packages') or py3_platlib.endswith('dist-packages')) + error('Python3 platlib path seems invalid?') +endif + +# could be 'Include' on Windows +py3_include = py3_mod.sysconfig_path('include') +if not py3_include.to_lower().startswith('include') + error('Python3 include path seems invalid?') +endif + +main = files('prog.py') + +test('toplevel', py3, args : main) + +subdir('subdir') diff --git a/test cases/python3/1 basic/prog.py b/test cases/python3/1 basic/prog.py new file mode 100755 index 0000000..9d95aea --- /dev/null +++ b/test cases/python3/1 basic/prog.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +from gluon import gluonator +import sys + +print('Running mainprog from root dir.') + +if gluonator.gluoninate() != 42: + sys.exit(1) diff --git a/test cases/python3/1 basic/subdir/meson.build b/test cases/python3/1 basic/subdir/meson.build new file mode 100644 index 0000000..8fe91b9 --- /dev/null +++ b/test cases/python3/1 basic/subdir/meson.build @@ -0,0 +1,4 @@ +test('subdir', + py3, + args : files('subprog.py'), + env : 'PYTHONPATH=' + meson.source_root()) diff --git a/test cases/python3/1 basic/subdir/subprog.py b/test cases/python3/1 basic/subdir/subprog.py new file mode 100755 index 0000000..08652f0 --- /dev/null +++ b/test cases/python3/1 basic/subdir/subprog.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +# In order to run this program, PYTHONPATH must be set to +# point to source root. + +from gluon import gluonator +import sys + +print('Running mainprog from subdir.') + +if gluonator.gluoninate() != 42: + sys.exit(1) diff --git a/test cases/python3/2 extmodule/blaster.py b/test cases/python3/2 extmodule/blaster.py new file mode 100755 index 0000000..529b028 --- /dev/null +++ b/test cases/python3/2 extmodule/blaster.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import tachyon +import sys + +result = tachyon.phaserize('shoot') + +if not isinstance(result, int): + print('Returned result not an integer.') + sys.exit(1) + +if result != 1: + print(f'Returned result {result} is not 1.') + sys.exit(1) diff --git a/test cases/python3/2 extmodule/ext/meson.build b/test cases/python3/2 extmodule/ext/meson.build new file mode 100644 index 0000000..d5d8849 --- /dev/null +++ b/test cases/python3/2 extmodule/ext/meson.build @@ -0,0 +1,6 @@ +pylib = py3_mod.extension_module('tachyon', + 'tachyon_module.c', + dependencies : py3_dep, +) + +pypathdir = meson.current_build_dir() diff --git a/test cases/python3/2 extmodule/ext/tachyon_module.c b/test cases/python3/2 extmodule/ext/tachyon_module.c new file mode 100644 index 0000000..b2592e4 --- /dev/null +++ b/test cases/python3/2 extmodule/ext/tachyon_module.c @@ -0,0 +1,49 @@ +/* + Copyright 2016 The Meson development team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* A very simple Python extension module. */ + +#include <Python.h> +#include <string.h> + +static PyObject* phaserize(PyObject *self, PyObject *args) { + const char *message; + int result; + + if(!PyArg_ParseTuple(args, "s", &message)) + return NULL; + + result = strcmp(message, "shoot") ? 0 : 1; + return PyLong_FromLong(result); +} + +static PyMethodDef TachyonMethods[] = { + {"phaserize", phaserize, METH_VARARGS, + "Shoot tachyon cannons."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef tachyonmodule = { + PyModuleDef_HEAD_INIT, + "tachyon", + NULL, + -1, + TachyonMethods +}; + +PyMODINIT_FUNC PyInit_tachyon(void) { + return PyModule_Create(&tachyonmodule); +} diff --git a/test cases/python3/2 extmodule/meson.build b/test cases/python3/2 extmodule/meson.build new file mode 100644 index 0000000..def21b0 --- /dev/null +++ b/test cases/python3/2 extmodule/meson.build @@ -0,0 +1,37 @@ +project('Python extension module', 'c', + default_options : ['buildtype=release']) +# Because Windows Python ships only with optimized libs, +# we must build this project the same way. + +py3_mod = import('python3') +py3 = py3_mod.find_python() +py3_dep = dependency('python3', required : false) +cc = meson.get_compiler('c') + +if py3_dep.found() + message('Detected Python version: ' + py3_dep.version()) + # Building extensions for Python 3 using Visual Studio 2015 + # no longer works (or, rather, they build but don't run). + # Disable the tests in this case. + if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') + error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') + endif + + subdir('ext') + + test('extmod', + py3, + args : files('blaster.py'), + env : ['PYTHONPATH=' + pypathdir]) + + # Check we can apply a version constraint + dependency('python3', version: '>=@0@'.format(py3_dep.version())) + +else + error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') +endif + +py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false) +if py3_pkg_dep.found() + python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir') +endif diff --git a/test cases/python3/3 cython/cytest.py b/test cases/python3/3 cython/cytest.py new file mode 100755 index 0000000..43443dc --- /dev/null +++ b/test cases/python3/3 cython/cytest.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +from storer import Storer +import sys + +s = Storer() + +if s.get_value() != 0: + print('Initial value incorrect.') + sys.exit(1) + +s.set_value(42) + +if s.get_value() != 42: + print('Setting value failed.') + sys.exit(1) + +try: + s.set_value('not a number') + print('Using wrong argument type did not fail.') + sys.exit(1) +except TypeError: + pass diff --git a/test cases/python3/3 cython/libdir/cstorer.pxd b/test cases/python3/3 cython/libdir/cstorer.pxd new file mode 100644 index 0000000..7b730fc --- /dev/null +++ b/test cases/python3/3 cython/libdir/cstorer.pxd @@ -0,0 +1,9 @@ + +cdef extern from "storer.h": + ctypedef struct Storer: + pass + + Storer* storer_new(); + void storer_destroy(Storer *s); + int storer_get_value(Storer *s); + void storer_set_value(Storer *s, int v); diff --git a/test cases/python3/3 cython/libdir/meson.build b/test cases/python3/3 cython/libdir/meson.build new file mode 100644 index 0000000..4aaa041 --- /dev/null +++ b/test cases/python3/3 cython/libdir/meson.build @@ -0,0 +1,12 @@ +pyx_c = custom_target('storer_pyx', + output : 'storer_pyx.c', + input : 'storer.pyx', + depend_files : 'cstorer.pxd', + command : [cython, '@INPUT@', '-o', '@OUTPUT@'], +) + +slib = py3_mod.extension_module('storer', + 'storer.c', pyx_c, + dependencies : py3_dep) + +pydir = meson.current_build_dir() diff --git a/test cases/python3/3 cython/libdir/storer.c b/test cases/python3/3 cython/libdir/storer.c new file mode 100644 index 0000000..0199bb8 --- /dev/null +++ b/test cases/python3/3 cython/libdir/storer.c @@ -0,0 +1,24 @@ +#include"storer.h" +#include<stdlib.h> + +struct _Storer { + int value; +}; + +Storer* storer_new() { + Storer *s = malloc(sizeof(struct _Storer)); + s->value = 0; + return s; +} + +void storer_destroy(Storer *s) { + free(s); +} + +int storer_get_value(Storer *s) { + return s->value; +} + +void storer_set_value(Storer *s, int v) { + s->value = v; +} diff --git a/test cases/python3/3 cython/libdir/storer.h b/test cases/python3/3 cython/libdir/storer.h new file mode 100644 index 0000000..4f71917 --- /dev/null +++ b/test cases/python3/3 cython/libdir/storer.h @@ -0,0 +1,8 @@ +#pragma once + +typedef struct _Storer Storer; + +Storer* storer_new(); +void storer_destroy(Storer *s); +int storer_get_value(Storer *s); +void storer_set_value(Storer *s, int v); diff --git a/test cases/python3/3 cython/libdir/storer.pyx b/test cases/python3/3 cython/libdir/storer.pyx new file mode 100644 index 0000000..ed551dc --- /dev/null +++ b/test cases/python3/3 cython/libdir/storer.pyx @@ -0,0 +1,16 @@ +cimport cstorer + +cdef class Storer: + cdef cstorer.Storer* _c_storer + + def __cinit__(self): + self._c_storer = cstorer.storer_new() + + def __dealloc__(self): + cstorer.storer_destroy(self._c_storer) + + cpdef int get_value(self): + return cstorer.storer_get_value(self._c_storer) + + cpdef set_value(self, int value): + cstorer.storer_set_value(self._c_storer, value) diff --git a/test cases/python3/3 cython/meson.build b/test cases/python3/3 cython/meson.build new file mode 100644 index 0000000..d41fc93 --- /dev/null +++ b/test cases/python3/3 cython/meson.build @@ -0,0 +1,26 @@ +project('cython', 'c', + default_options : ['warning_level=3']) + +cython = find_program('cython3', required : false) +py3_dep = dependency('python3', required : false) + +if cython.found() and py3_dep.found() + py3_dep = dependency('python3') + py3_dep_majver = py3_dep.version().split('.') + py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1] + py3_mod = import('python3') + py3 = py3_mod.find_python() + if py3_dep_majver != py3_mod.language_version() + v = py3_mod.language_version() + error('MESON_SKIP_TEST: deprecated python3 module is non-functional when default python3 is different from Meson\'s', v) + endif + subdir('libdir') + + test('cython tester', + py3, + args : files('cytest.py'), + env : ['PYTHONPATH=' + pydir] + ) +else + error('MESON_SKIP_TEST: Cython3 or Python3 libraries not found, skipping test.') +endif diff --git a/test cases/python3/4 custom target depends extmodule/blaster.py b/test cases/python3/4 custom target depends extmodule/blaster.py new file mode 100644 index 0000000..d2c93ad --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/blaster.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import os +import sys +import argparse + +from pathlib import Path + +filedir = Path(os.path.dirname(__file__)).resolve() +if list(filedir.glob('ext/*tachyon.*')): + sys.path.insert(0, (filedir / 'ext').as_posix()) + +import tachyon + +parser = argparse.ArgumentParser() +parser.add_argument('-o', dest='output', default=None) + +options = parser.parse_args(sys.argv[1:]) + +result = tachyon.phaserize('shoot') + +if options.output: + with open(options.output, 'w') as f: + f.write('success') + +if not isinstance(result, int): + print('Returned result not an integer.') + sys.exit(1) + +if result != 1: + print(f'Returned result {result} is not 1.') + sys.exit(1) diff --git a/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c b/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c new file mode 100644 index 0000000..aeff296 --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c @@ -0,0 +1,8 @@ +#ifdef _MSC_VER +__declspec(dllexport) +#endif +const char* +tachyon_phaser_command (void) +{ + return "shoot"; +} diff --git a/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h b/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h new file mode 100644 index 0000000..dca71d3 --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h @@ -0,0 +1,6 @@ +#pragma once + +#ifdef _MSC_VER +__declspec(dllimport) +#endif +const char* tachyon_phaser_command (void); diff --git a/test cases/python3/4 custom target depends extmodule/ext/lib/meson.build b/test cases/python3/4 custom target depends extmodule/ext/lib/meson.build new file mode 100644 index 0000000..b1f8938 --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/ext/lib/meson.build @@ -0,0 +1,4 @@ +libtachyon = shared_library('tachyonlib', 'meson-tachyonlib.c') + +libtachyon_dep = declare_dependency(link_with : libtachyon, + include_directories : include_directories('.')) diff --git a/test cases/python3/4 custom target depends extmodule/ext/meson.build b/test cases/python3/4 custom target depends extmodule/ext/meson.build new file mode 100644 index 0000000..5ccbe22 --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/ext/meson.build @@ -0,0 +1,6 @@ +subdir('lib') + +pylib = py3_mod.extension_module('tachyon', + 'tachyon_module.c', + dependencies : [libtachyon_dep, py3_dep], +) diff --git a/test cases/python3/4 custom target depends extmodule/ext/tachyon_module.c b/test cases/python3/4 custom target depends extmodule/ext/tachyon_module.c new file mode 100644 index 0000000..b48032b --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/ext/tachyon_module.c @@ -0,0 +1,51 @@ +/* + Copyright 2016 The Meson development team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* A very simple Python extension module. */ + +#include <Python.h> +#include <string.h> + +#include "meson-tachyonlib.h" + +static PyObject* phaserize(PyObject *self, PyObject *args) { + const char *message; + int result; + + if(!PyArg_ParseTuple(args, "s", &message)) + return NULL; + + result = strcmp(message, tachyon_phaser_command()) ? 0 : 1; + return PyLong_FromLong(result); +} + +static PyMethodDef TachyonMethods[] = { + {"phaserize", phaserize, METH_VARARGS, + "Shoot tachyon cannons."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef tachyonmodule = { + PyModuleDef_HEAD_INIT, + "tachyon", + NULL, + -1, + TachyonMethods +}; + +PyMODINIT_FUNC PyInit_tachyon(void) { + return PyModule_Create(&tachyonmodule); +} diff --git a/test cases/python3/4 custom target depends extmodule/meson.build b/test cases/python3/4 custom target depends extmodule/meson.build new file mode 100644 index 0000000..d76aa36 --- /dev/null +++ b/test cases/python3/4 custom target depends extmodule/meson.build @@ -0,0 +1,41 @@ +project('Python extension module', 'c', + default_options : ['buildtype=release']) +# Because Windows Python ships only with optimized libs, +# we must build this project the same way. + +py3_mod = import('python3') +py3 = py3_mod.find_python() +py3_dep = dependency('python3', required : false) +cc = meson.get_compiler('c') + +# Copy to the builddir so that blaster.py can find the built tachyon module +# FIXME: We should automatically detect this case and append the correct paths +# to PYTHONLIBDIR +blaster_py = configure_file(input : 'blaster.py', + output : 'blaster.py', + configuration : configuration_data()) + +check_exists = ''' +import os, sys +with open(sys.argv[1], 'rb') as f: + assert(f.read() == b'success') +''' +if py3_dep.found() + message('Detected Python version: ' + py3_dep.version()) + if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') + error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') + endif + + subdir('ext') + + out_txt = custom_target('tachyon flux', + input : blaster_py, + output : 'out.txt', + command : [py3, '@INPUT@', '-o', '@OUTPUT@'], + depends : pylib, + build_by_default: true) + + test('flux', py3, args : ['-c', check_exists, out_txt]) +else + error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') +endif |