summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-08-17 16:25:22 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2021-09-25 12:12:30 +0530
commit72fac1f25e19ea82e2d965a37e9d66b5cc48e6c4 (patch)
tree4195bc48f7196d748e60bccaa6e5908c0723811f
parent355c0bdb2ec8538aad95132cbdc8f948f664d2a8 (diff)
downloadmeson-72fac1f25e19ea82e2d965a37e9d66b5cc48e6c4.tar.gz
tests: python module should install files correctly
- default to python site-packages - subdir to site-packages/subdir - arbitrary install_dir (cherry picked from commit 1f46b4ce64864c6805b4c64b449a1d4818895435)
-rwxr-xr-xtest 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.build4
-rw-r--r--test cases/python/2 extmodule/ext/nested/meson.build16
-rw-r--r--test cases/python/2 extmodule/ext/tachyon_module.c2
-rw-r--r--test cases/python/2 extmodule/ext/wrongdir/meson.build7
-rw-r--r--test cases/python/2 extmodule/meson.build10
-rw-r--r--test cases/python/2 extmodule/test.json13
7 files changed, 51 insertions, 3 deletions
diff --git a/test cases/python/2 extmodule/blaster.py b/test cases/python/2 extmodule/blaster.py.in
index aaac9849d..b690b4092 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 b13bb326f..799e9b08a 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 000000000..38d3d3e28
--- /dev/null
+++ b/test cases/python/2 extmodule/ext/nested/meson.build
@@ -0,0 +1,16 @@
+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'}
+ ),
+ 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
index b2592e482..a5d7cdc98 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 000000000..1355d4fd7
--- /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 18d70c895..c3f4eec6a 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, pure: false)
+py.install_sources(blaster, 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 000000000..6bd119592
--- /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" }
+ ]
+}