diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-24 14:47:58 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-24 14:52:47 +0300 |
commit | 393ce77450fcf7d3d55f04ce79761b10a432fa20 (patch) | |
tree | e9faa4b4fa39b3520718f99405cb754f478ad5b1 | |
parent | 660bfa6e7c8dfb7bd8bffdb68c053e1a22945f8a (diff) | |
download | meson-393ce77450fcf7d3d55f04ce79761b10a432fa20.zip meson-393ce77450fcf7d3d55f04ce79761b10a432fa20.tar.gz meson-393ce77450fcf7d3d55f04ce79761b10a432fa20.tar.bz2 |
Remove deprecated python3 module.
28 files changed, 10 insertions, 548 deletions
diff --git a/docs/markdown/Python-3-module.md b/docs/markdown/Python-3-module.md index 1631b2a..7d1a08b 100644 --- a/docs/markdown/Python-3-module.md +++ b/docs/markdown/Python-3-module.md @@ -3,55 +3,5 @@ This module provides support for dealing with Python 3. It has the following methods. -This module is deprecated and replaced by the +This module is has been deleted and replaced by the [python](Python-module.md) module. - -## find_python - -This is a cross platform way of finding the Python 3 executable, which -may have a different name on different operating systems. Returns an -[[@external_program]] -object. - -*Added 0.38.0* - -Deprecated, replaced by -[`find_installation`](Python-module.md#find_installation) function -from `python` module. - -## extension_module - -Creates a `shared_module` target that is named according to the naming -conventions of the target platform. All positional and keyword -arguments are the same as for -[[shared_module]]. - -`extension_module` does not add any dependencies to the library so user may -need to add `dependencies : dependency('python3')`, see -[Python3 dependency](Dependencies.md#python3). - -*Added 0.38.0* - -Deprecated, replaced by -[`extension_module`](Python-module.md#extension_module) method from -`python` module. - -## language_version - -Returns a string with the Python language version such as `3.5`. - -*Added 0.40.0* - -Deprecated, replaced by -[`language_version`](Python-module.md#language_version) method from -`python` module. - -## sysconfig_path - -Returns the Python sysconfig path without prefix, such as -`lib/python3.6/site-packages`. - -*Added 0.40.0* - -Deprecated, replaced by [`get_path`](Python-module.md#get_path) -method from `python` module. diff --git a/docs/markdown/snippets/pymod3.md b/docs/markdown/snippets/pymod3.md new file mode 100644 index 0000000..edb66af --- /dev/null +++ b/docs/markdown/snippets/pymod3.md @@ -0,0 +1,5 @@ +## The `python3` module has been removed + +It has been deprecated for a long time so finally removing it. The +`python` module should be used instead. It does everything the +`python3` module did and more. diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py index 1e7463c..2e328ba 100644 --- a/mesonbuild/modules/python3.py +++ b/mesonbuild/modules/python3.py @@ -1,4 +1,4 @@ -# Copyright 2016-2017 The Meson development team +# Copyright 2016-2022 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. @@ -12,72 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sysconfig from .. import mesonlib -from . import ExtensionModule -from ..interpreterbase import typed_pos_args, noPosargs, noKwargs, permittedKwargs, FeatureDeprecated, FeatureNew -from ..build import known_shmod_kwargs -from ..programs import ExternalProgram - - -class Python3Module(ExtensionModule): - @FeatureNew('python3 module', '0.38.0') - @FeatureDeprecated('python3 module', '0.48.0') - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.methods.update({ - 'extension_module': self.extension_module, - 'find_python': self.find_python, - 'language_version': self.language_version, - 'sysconfig_path': self.sysconfig_path, - }) - - @permittedKwargs(known_shmod_kwargs) - def extension_module(self, state, args, kwargs): - if 'name_prefix' in kwargs: - raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.') - if 'name_suffix' in kwargs: - raise mesonlib.MesonException('Name_suffix is set automatically, specifying it is forbidden.') - host_system = state.host_machine.system - if host_system == 'darwin': - # Default suffix is 'dylib' but Python does not use it for extensions. - suffix = 'so' - elif host_system == 'windows': - # On Windows the extension is pyd for some unexplainable reason. - suffix = 'pyd' - else: - suffix = [] - kwargs['name_prefix'] = '' - kwargs['name_suffix'] = suffix - return self.interpreter.func_shared_module(None, args, kwargs) - - @noPosargs - @noKwargs - def find_python(self, state, args, kwargs): - command = state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, 'python3') - if command is not None: - py3 = ExternalProgram.from_entry('python3', command) - else: - py3 = ExternalProgram('python3', mesonlib.python_command, silent=True) - return py3 - - @noPosargs - @noKwargs - def language_version(self, state, args, kwargs): - return sysconfig.get_python_version() - - @noKwargs - @typed_pos_args('python3.sysconfig_path', str) - def sysconfig_path(self, state, args, kwargs): - path_name = args[0] - valid_names = sysconfig.get_path_names() - if path_name not in valid_names: - raise mesonlib.MesonException(f'{path_name} is not a valid path name {valid_names}.') - - # Get a relative path without a prefix, e.g. lib/python3.6/site-packages - return sysconfig.get_path(path_name, vars={'base': '', 'platbase': '', 'installed_base': ''})[1:] - - def initialize(*args, **kwargs): - return Python3Module(*args, **kwargs) + raise mesonlib.MesonException(f'The "python3" module has been removed. Please update your code to use the "python" module instead..') diff --git a/run_project_tests.py b/run_project_tests.py index b25aca6..8b5f21d 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2012-2021 The Meson development team +# Copyright 2012-2022 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. @@ -99,7 +99,7 @@ if T.TYPE_CHECKING: ALL_TESTS = ['cmake', 'common', 'native', 'warning-meson', 'failing-meson', 'failing-build', 'failing-test', 'keyval', 'platform-osx', 'platform-windows', 'platform-linux', 'java', 'C#', 'vala', 'cython', 'rust', 'd', 'objective c', 'objective c++', - 'fortran', 'swift', 'cuda', 'python3', 'python', 'fpga', 'frameworks', 'nasm', 'wasm', 'wayland' + 'fortran', 'swift', 'cuda', 'python', 'fpga', 'frameworks', 'nasm', 'wasm', 'wayland' ] @@ -1092,7 +1092,6 @@ def detect_tests_to_run(only: T.Dict[str, T.List[str]], use_tmp: bool) -> T.List TestCategory('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')), # CUDA tests on Windows: use Ninja backend: python run_project_tests.py --only cuda --backend ninja TestCategory('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')), - TestCategory('python3', 'python3', backend is not Backend.ninja), TestCategory('python', 'python'), TestCategory('fpga', 'fpga', shutil.which('yosys') is None), TestCategory('frameworks', 'frameworks'), diff --git a/test cases/python3/1 basic/gluon/__init__.py b/test cases/python3/1 basic/gluon/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/test cases/python3/1 basic/gluon/__init__.py +++ /dev/null diff --git a/test cases/python3/1 basic/gluon/gluonator.py b/test cases/python3/1 basic/gluon/gluonator.py deleted file mode 100644 index b53d6de..0000000 --- a/test cases/python3/1 basic/gluon/gluonator.py +++ /dev/null @@ -1,2 +0,0 @@ -def gluoninate(): - return 42 diff --git a/test cases/python3/1 basic/meson.build b/test cases/python3/1 basic/meson.build deleted file mode 100644 index 48cfb6d..0000000 --- a/test cases/python3/1 basic/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100755 index 9d95aea..0000000 --- a/test cases/python3/1 basic/prog.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/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 deleted file mode 100644 index 8fe91b9..0000000 --- a/test cases/python3/1 basic/subdir/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100755 index 08652f0..0000000 --- a/test cases/python3/1 basic/subdir/subprog.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 deleted file mode 100755 index 529b028..0000000 --- a/test cases/python3/2 extmodule/blaster.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/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 deleted file mode 100644 index d5d8849..0000000 --- a/test cases/python3/2 extmodule/ext/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index b2592e4..0000000 --- a/test cases/python3/2 extmodule/ext/tachyon_module.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 deleted file mode 100644 index def21b0..0000000 --- a/test cases/python3/2 extmodule/meson.build +++ /dev/null @@ -1,37 +0,0 @@ -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 deleted file mode 100755 index 43443dc..0000000 --- a/test cases/python3/3 cython/cytest.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 deleted file mode 100644 index 7b730fc..0000000 --- a/test cases/python3/3 cython/libdir/cstorer.pxd +++ /dev/null @@ -1,9 +0,0 @@ - -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 deleted file mode 100644 index 4aaa041..0000000 --- a/test cases/python3/3 cython/libdir/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 0199bb8..0000000 --- a/test cases/python3/3 cython/libdir/storer.c +++ /dev/null @@ -1,24 +0,0 @@ -#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 deleted file mode 100644 index 4f71917..0000000 --- a/test cases/python3/3 cython/libdir/storer.h +++ /dev/null @@ -1,8 +0,0 @@ -#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 deleted file mode 100644 index ed551dc..0000000 --- a/test cases/python3/3 cython/libdir/storer.pyx +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 753b906..0000000 --- a/test cases/python3/3 cython/meson.build +++ /dev/null @@ -1,20 +0,0 @@ -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_mod = import('python3') - py3 = py3_mod.find_python() - 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 deleted file mode 100644 index d2c93ad..0000000 --- a/test cases/python3/4 custom target depends extmodule/blaster.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 deleted file mode 100644 index aeff296..0000000 --- a/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c +++ /dev/null @@ -1,8 +0,0 @@ -#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 deleted file mode 100644 index dca71d3..0000000 --- a/test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h +++ /dev/null @@ -1,6 +0,0 @@ -#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 deleted file mode 100644 index b1f8938..0000000 --- a/test cases/python3/4 custom target depends extmodule/ext/lib/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 5ccbe22..0000000 --- a/test cases/python3/4 custom target depends extmodule/ext/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index b48032b..0000000 --- a/test cases/python3/4 custom target depends extmodule/ext/tachyon_module.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - 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 deleted file mode 100644 index d76aa36..0000000 --- a/test cases/python3/4 custom target depends extmodule/meson.build +++ /dev/null @@ -1,41 +0,0 @@ -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 |