From 6ac9a8e738dae97c64308da83949931fb726bbe7 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 8 Jan 2017 23:35:59 +0200 Subject: Add .find_python() method. Supersedes #777. --- test cases/python3/1 basic/meson.build | 3 ++- test cases/python3/1 basic/subdir/meson.build | 5 ++--- test cases/python3/2 extmodule/meson.build | 4 +++- test cases/python3/3 cython/libdir/meson.build | 10 ---------- test cases/python3/3 cython/meson.build | 4 +++- 5 files changed, 10 insertions(+), 16 deletions(-) (limited to 'test cases/python3') diff --git a/test cases/python3/1 basic/meson.build b/test cases/python3/1 basic/meson.build index badd3e58c..9d5f874c6 100644 --- a/test cases/python3/1 basic/meson.build +++ b/test cases/python3/1 basic/meson.build @@ -1,6 +1,7 @@ project('python sample', 'c') -py3 = find_program('python3') +py3_mod = import('python3') +py3 = py3_mod.find_python() main = files('prog.py') diff --git a/test cases/python3/1 basic/subdir/meson.build b/test cases/python3/1 basic/subdir/meson.build index 3f275ad1b..8fe91b92e 100644 --- a/test cases/python3/1 basic/subdir/meson.build +++ b/test cases/python3/1 basic/subdir/meson.build @@ -1,5 +1,4 @@ -submain = find_program('subprog.py') - test('subdir', - submain, + py3, + args : files('subprog.py'), env : 'PYTHONPATH=' + meson.source_root()) diff --git a/test cases/python3/2 extmodule/meson.build b/test cases/python3/2 extmodule/meson.build index 582a14e8e..25e2c63b0 100644 --- a/test cases/python3/2 extmodule/meson.build +++ b/test cases/python3/2 extmodule/meson.build @@ -4,13 +4,15 @@ project('Python extension module', 'c', # we must build this project the same way. py3_mod = import('python3') +py3 = py3_mod.find_python() py3_dep = dependency('python3', required : false) if py3_dep.found() subdir('ext') test('extmod', - find_program('blaster.py'), + py3, + args : files('blaster.py'), env : ['PYTHONPATH=' + pypathdir]) else error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') diff --git a/test cases/python3/3 cython/libdir/meson.build b/test cases/python3/3 cython/libdir/meson.build index 0d015f0a1..7823a6b86 100644 --- a/test cases/python3/3 cython/libdir/meson.build +++ b/test cases/python3/3 cython/libdir/meson.build @@ -1,13 +1,3 @@ -if host_machine.system() == 'darwin' - # Default suffix is 'dylib' but Python does not use for extensions. - suffix = 'so' -elif host_machine.system() == 'windows' - # On Windows the extension is pyd for some unexplainable reason. - suffix = 'pyd' -else - suffix = [] -endif - pyx_c = custom_target('storer_pyx', output : 'storer_pyx.c', input : 'storer.pyx', diff --git a/test cases/python3/3 cython/meson.build b/test cases/python3/3 cython/meson.build index c6027ac03..753b906cf 100644 --- a/test cases/python3/3 cython/meson.build +++ b/test cases/python3/3 cython/meson.build @@ -7,10 +7,12 @@ 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', - find_program('cytest.py'), + py3, + args : files('cytest.py'), env : ['PYTHONPATH=' + pydir] ) else -- cgit v1.2.3