diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-08-17 16:25:22 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-08-17 22:51:41 -0400 |
commit | f413c2eaebcddeff5f5f228a4dbabb1e54d34893 (patch) | |
tree | e967f79ff50ec020ea6edfee967e240c3ffc0238 | |
parent | 90cf7d7e6ec28c3b42bc3895d211fec32fe04335 (diff) | |
download | meson-eschwartz/python-lib-install-dir.zip meson-eschwartz/python-lib-install-dir.tar.gz meson-eschwartz/python-lib-install-dir.tar.bz2 |
tests: python module should install files correctlyeschwartz/python-lib-install-dir
- default to python site-packages
- subdir to site-packages/subdir
- arbitrary install_dir
-rwxr-xr-x | test cases/python/2 extmodule/blaster.py.in (renamed from test cases/python/2 extmodule/blaster.py) | 2 | ||||
-rw-r--r-- | test cases/python/2 extmodule/ext/meson.build | 4 | ||||
-rw-r--r-- | test cases/python/2 extmodule/ext/nested/meson.build | 15 | ||||
-rw-r--r-- | test cases/python/2 extmodule/ext/tachyon_module.c | 2 | ||||
-rw-r--r-- | test cases/python/2 extmodule/ext/wrongdir/meson.build | 7 | ||||
-rw-r--r-- | test cases/python/2 extmodule/meson.build | 10 | ||||
-rw-r--r-- | test cases/python/2 extmodule/test.json | 13 |
7 files changed, 50 insertions, 3 deletions
diff --git a/test cases/python/2 extmodule/blaster.py b/test cases/python/2 extmodule/blaster.py.in index aaac984..b690b40 100755 --- a/test cases/python/2 extmodule/blaster.py +++ b/test cases/python/2 extmodule/blaster.py.in @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import tachyon +import @tachyon_module@ as tachyon result = tachyon.phaserize('shoot') diff --git a/test cases/python/2 extmodule/ext/meson.build b/test cases/python/2 extmodule/ext/meson.build index b13bb32..799e9b0 100644 --- a/test cases/python/2 extmodule/ext/meson.build +++ b/test cases/python/2 extmodule/ext/meson.build @@ -1,6 +1,10 @@ pylib = py.extension_module('tachyon', 'tachyon_module.c', dependencies : py_dep, + 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..044ddf4 --- /dev/null +++ b/test cases/python/2 extmodule/ext/nested/meson.build @@ -0,0 +1,15 @@ +py.extension_module('tachyon', + '../tachyon_module.c', + dependencies : py_dep, + 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'} + ), + subdir: 'nested', +) diff --git a/test cases/python/2 extmodule/ext/tachyon_module.c b/test cases/python/2 extmodule/ext/tachyon_module.c index b2592e4..a5d7cdc 100644 --- a/test cases/python/2 extmodule/ext/tachyon_module.c +++ b/test cases/python/2 extmodule/ext/tachyon_module.c @@ -38,7 +38,7 @@ static PyMethodDef TachyonMethods[] = { static struct PyModuleDef tachyonmodule = { PyModuleDef_HEAD_INIT, - "tachyon", + MESON_MODULENAME, NULL, -1, TachyonMethods 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..1355d4f --- /dev/null +++ b/test cases/python/2 extmodule/ext/wrongdir/meson.build @@ -0,0 +1,7 @@ +py.extension_module('tachyon', + '../tachyon_module.c', + dependencies : py_dep, + 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 index 18d70c8..7362de3 100644 --- a/test cases/python/2 extmodule/meson.build +++ b/test cases/python/2 extmodule/meson.build @@ -18,11 +18,19 @@ endif subdir('ext') +blaster = configure_file( + input: 'blaster.py.in', + output: 'blaster.py', + configuration: {'tachyon_module': 'tachyon'} +) + test('extmod', py, - args : files('blaster.py'), + args : blaster, env : ['PYTHONPATH=' + pypathdir]) +py.install_sources(blaster) +py.install_sources(blaster, pure: true, subdir: 'pure') py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false) if py3_pkg_dep.found() 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" } + ] +} |