[gegl/wip/rishi/fix-python-invocation: 2/2] build: Fix the build when '/usr/bin/env python' doesn't work



commit e1aa95ac1a0e4991b64dd9250f899523a606ef19
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Aug 19 20:25:30 2019 +0200

    build: Fix the build when '/usr/bin/env python' doesn't work
    
    Invoking the Python interpreter as '/usr/bin/env python' may or may
    not work. eg., there's no 'python' in the GNOME master SDK anymore. To
    make it more robust, rely on Meson to find the Python installation,
    and use that to invoke the Python scripts.
    
    Additionally, use 'files', not 'find_program' to refer to the Python
    files.
    
    This reverts commit ad7021110c9c6717fa0d783355e4924cc354a0ee and
    restores commit ccd6279f4a4a742e72c55931c831fd5da3592fc4
    
    https://gitlab.gnome.org/GNOME/gegl/merge_requests/46

 opencl/meson.build             | 4 ++--
 tests/compositions/meson.build | 8 +++++---
 tests/python/meson.build       | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/opencl/meson.build b/opencl/meson.build
index 6c5bee0a2..78a43e30d 100644
--- a/opencl/meson.build
+++ b/opencl/meson.build
@@ -49,13 +49,13 @@ opencl_sources = [
   'weighted-blend.cl',
 ]
 
-cltostring = find_program('cltostring.py')
+cltostring = files('cltostring.py')
 
 opencl_headers = files()
 foreach source : opencl_sources
   opencl_headers += custom_target(source + '.h',
     input : source,
     output: source +'.h',
-    command: [ cltostring, '@INPUT@', '@OUTPUT@' ],
+    command: [ python, cltostring, '@INPUT@', '@OUTPUT@' ],
   )
 endforeach
diff --git a/tests/compositions/meson.build b/tests/compositions/meson.build
index 268eda4ec..8699e7cf0 100644
--- a/tests/compositions/meson.build
+++ b/tests/compositions/meson.build
@@ -69,12 +69,13 @@ if libumfpack.found()
  # compositions_tests += 'matting-levin.xml'
 endif
 
-run_compositions = find_program('run-compositions.py')
+run_compositions = files('run-compositions.py')
 
 if false
 test('compositions_with_opencl',
-  run_compositions,
+  python,
   args: [
+    run_compositions,
     '--build-dir='+ meson.build_root(),
     '--src-dir='  + meson.source_root(),
     '--xml-dir='  + meson.current_source_dir(),
@@ -87,8 +88,9 @@ test('compositions_with_opencl',
 endif
 
 test('compositions_without_opencl',
-  run_compositions,
+  python,
   args: [
+    run_compositions,
     '--build-dir='+ meson.build_root(),
     '--src-dir='  + meson.source_root(),
     '--xml-dir='  + meson.current_source_dir(),
diff --git a/tests/python/meson.build b/tests/python/meson.build
index f0f9c5868..c6782e6cf 100644
--- a/tests/python/meson.build
+++ b/tests/python/meson.build
@@ -11,7 +11,8 @@ if python.found() and pygobject_found
   foreach testname : testnames
     testfile = 'test-' + testname + '.py'
     test(testname,
-      find_program(testfile),
+      python,
+      args: files(testfile),
       env: [
         'LD_LIBRARY_PATH=' + meson.build_root() / 'gegl' + ':$LD_LIBRARY_PATH',
         'GI_TYPELIB_PATH=' + meson.build_root() / 'gegl' + ':$GI_TYPELIB_PATH',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]