tests: python module should install files correctly

- default to python site-packages
- subdir to site-packages/subdir
- arbitrary install_dir

(cherry picked from commit 1f46b4ce64)
0.59
Eli Schwartz 3 years ago committed by Nirbheek Chauhan
parent 355c0bdb2e
commit 72fac1f25e
  1. 2
      test cases/python/2 extmodule/blaster.py.in
  2. 4
      test cases/python/2 extmodule/ext/meson.build
  3. 16
      test cases/python/2 extmodule/ext/nested/meson.build
  4. 2
      test cases/python/2 extmodule/ext/tachyon_module.c
  5. 7
      test cases/python/2 extmodule/ext/wrongdir/meson.build
  6. 10
      test cases/python/2 extmodule/meson.build
  7. 13
      test cases/python/2 extmodule/test.json

@ -1,6 +1,6 @@
#!/usr/bin/env python3
import tachyon
import @tachyon_module@ as tachyon
result = tachyon.phaserize('shoot')

@ -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()

@ -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',
)

@ -38,7 +38,7 @@ static PyMethodDef TachyonMethods[] = {
static struct PyModuleDef tachyonmodule = {
PyModuleDef_HEAD_INIT,
"tachyon",
MESON_MODULENAME,
NULL,
-1,
TachyonMethods

@ -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')
)

@ -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()

@ -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" }
]
}
Loading…
Cancel
Save