[gimp] meson: make run_command() calls future-proof.



commit 2ac483f9e366726b54111754e1e54911a7c464c2
Author: Jehan <jehan girinstud io>
Date:   Sun Jul 31 18:18:28 2022 +0200

    meson: make run_command() calls future-proof.
    
    Some of our calls to run_command() would have failed with future
    versions of meson if we didn't set the "check" parameter. In particular,
    in various calls, we don't want to fail the whole build configuration
    when the command does (as it's an optional feature check). In such a
    case, it is important to be explicit as future will default to fail
    then.
    
    Fixes:
    
    > WARNING: You should add the boolean check kwarg to the run_command call.
    >          It currently defaults to false,
    >          but it will default to true in future releases of meson.
    >          See also: https://github.com/mesonbuild/meson/issues/9300

 app/tests/meson.build |  2 +-
 meson.build           | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/app/tests/meson.build b/app/tests/meson.build
index abf61c975a..ca9112514b 100644
--- a/app/tests/meson.build
+++ b/app/tests/meson.build
@@ -44,7 +44,7 @@ app_tests = [
   'xcf',
 ]
 
-cmd = run_command('create_test_env.sh')
+cmd = run_command('create_test_env.sh', check: false)
 if cmd.returncode() != 0
  error(cmd.stderr().strip())
 endif
diff --git a/meson.build b/meson.build
index 0c35562fe6..967804e0f4 100644
--- a/meson.build
+++ b/meson.build
@@ -962,6 +962,7 @@ if have_python
         '''version = '@0@' '''.format('3.0'),
         '''sys.exit(gi.check_version(version))''',
       ]),
+      check: false
     ).returncode() == 0
     message('Found Pygobject: @0@'.format(pygobject_found))
     python_found = python_found and pygobject_found
@@ -1396,7 +1397,7 @@ conf.set_quoted('CC',             cc.get_id())
 
 cc_version=''
 if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
-  cc_cmd = run_command(cc, '-v')
+  cc_cmd = run_command(cc, '-v', check: false)
   # Note: the call might actually fail when using ccache.
   # See: https://github.com/mesonbuild/meson/issues/6174
   if cc_cmd.returncode() == 0
@@ -1406,7 +1407,7 @@ else
   # Various compilers have various options. Try most common ones. This
   # list of options comes from autotools checks.
   foreach arg : [ '--version', '-v', '-V', '-qversion' ]
-    cc_cmd = run_command(cc, arg)
+    cc_cmd = run_command(cc, arg, check: false)
     if cc_cmd.returncode() == 0
       cc_version = cc_cmd.stdout()
     endif
@@ -1495,11 +1496,13 @@ endif
 
 # git-version.h is already present and not generated if dist tarball
 is_git_repository = run_command('python3', '-c',
-  'import sys,os; sys.exit(0 if os.path.exists(".git") else 1)'
+  'import sys,os; sys.exit(0 if os.path.exists(".git") else 1)',
+  check: false
 ).returncode() == 0
 
 has_version_h = run_command('python3', '-c',
-  'import sys,os; sys.exit(0 if os.path.exists("git-version.h") else 1)'
+  'import sys,os; sys.exit(0 if os.path.exists("git-version.h") else 1)',
+  check: false
 ).returncode() == 0
 
 generate_version_h = is_git_repository or not has_version_h


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