diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
commit | 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch) | |
tree | 4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/python/1 basic | |
parent | Initial commit. (diff) | |
download | meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip |
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/python/1 basic')
-rw-r--r-- | test cases/python/1 basic/gluon/__init__.py | 0 | ||||
-rw-r--r-- | test cases/python/1 basic/gluon/gluonator.py | 2 | ||||
-rw-r--r-- | test cases/python/1 basic/meson.build | 27 | ||||
-rwxr-xr-x | test cases/python/1 basic/prog.py | 8 | ||||
-rw-r--r-- | test cases/python/1 basic/subdir/meson.build | 4 | ||||
-rwxr-xr-x | test cases/python/1 basic/subdir/subprog.py | 11 |
6 files changed, 52 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") |