[pangomm/pangomm-2-46] meson.build: Specify 'check' option in run_command()



commit 9c1bad7a906807abf702a339e4bac0d534404638
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Feb 15 13:21:53 2022 +0100

    meson.build: Specify 'check' option in run_command()
    
    The default value will be changed in future Meson releases.
    
    Don't use deprecated python3.path().
    Let import('python').find_installation() always find the python
    installation used to run Meson.

 docs/reference/meson.build |  4 ++--
 meson.build                | 20 +++++++++++---------
 pango/pangomm/meson.build  |  5 +++--
 3 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 13dabf0..059c939 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -142,7 +142,7 @@ devhelp_file = custom_target('devhelp',
 
 # Install Devhelp file and html files.
 meson.add_install_script(
-  python3.path(), doc_reference_py, 'install_doc',
+  python3, doc_reference_py, 'install_doc',
   doctool_dir,
   devhelp_file.full_path(),
   install_devhelpdir,
@@ -165,7 +165,7 @@ install_data(image_files, install_dir: install_image_docdir)
 if can_add_dist_script
   # Distribute built files and files copied by mm-common-get.
   meson.add_dist_script(
-    python3.path(), doc_reference_py, 'dist_doc',
+    python3, doc_reference_py, 'dist_doc',
     doctool_dir,
     doctool_dist_dir,
     meson.current_build_dir(),
diff --git a/meson.build b/meson.build
index cb60157..2f384a4 100644
--- a/meson.build
+++ b/meson.build
@@ -6,8 +6,8 @@ project('pangomm', 'cpp',
   default_options: [
     'cpp_std=c++11'
   ],
-  meson_version: '>= 0.54.0', # required for meson.override_dependency()
-                              # and dep.get_variable(internal:)
+  meson_version: '>= 0.55.0', # required for meson.add_dist_script(python3, ...)
+                              # and meson.add_install_script(python3, ...)
 )
 
 pangomm_api_version = '1.4'
@@ -44,7 +44,7 @@ project_build_root = meson.current_build_dir()
 
 cpp_compiler = meson.get_compiler('cpp')
 is_msvc = cpp_compiler.get_id() == 'msvc'
-python3 = import('python').find_installation('python3')
+python3 = import('python').find_installation()
 
 python_version = python3.language_version()
 python_version_req = '>= 3.5'
@@ -59,7 +59,7 @@ import os
 import sys
 sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
 '''.format(project_source_root / '.git')
-is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
+is_git_build = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
 
 # Are we testing a dist tarball while it's being built?
 # There ought to be a better way. https://github.com/mesonbuild/meson/issues/6866
@@ -155,14 +155,16 @@ check_dllexport_usage_py = script_dir / 'check-dllexport-usage.py'
 if maintainer_mode
   # Copy files to untracked/build_scripts and untracked/docs.
   run_command(mm_common_get, '--force', script_dir,
-    project_source_root / 'untracked' / 'docs')
+    project_source_root / 'untracked' / 'docs',
+    check: true,
+  )
 else
   cmd_py = '''
 import os
 import sys
 sys.exit(os.path.isfile("@0@"))
 '''.format(generate_binding_py)
-  file_exists = run_command(python3, '-c', cmd_py).returncode() != 0
+  file_exists = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
   if not file_exists
     error('Missing files in untracked/. You must enable maintainer-mode.')
   endif
@@ -198,7 +200,7 @@ if is_msvc
 
   # Enable __declspec(dllexport) if the pangomm headers generated from the .hg files
   # were generated using a recent enough gmmproc
-  build_shared_libs_directly = run_command(check_gmmproc_ver_cmd).returncode() == 0
+  build_shared_libs_directly = run_command(check_gmmproc_ver_cmd, check: false).returncode() == 0
   message('Using __declspec(dllexport) to build pangomm: @0@'.format(build_shared_libs_directly ? 'YES' : 
'NO'))
 
   # Put in the toolset version if the build is done with Visual Studio
@@ -270,13 +272,13 @@ subdir('docs/reference')
 if can_add_dist_script
   # Add a ChangeLog file to the distribution directory.
   meson.add_dist_script(
-    python3.path(), dist_changelog_py,
+    python3, dist_changelog_py,
     project_source_root,
   )
   # Add build scripts to the distribution directory, and delete .gitignore
   # files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
   meson.add_dist_script(
-    python3.path(), dist_build_scripts_py,
+    python3, dist_build_scripts_py,
     project_source_root,
     'untracked' / 'build_scripts',
   )
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index cc3741d..6755f50 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -175,6 +175,7 @@ else # not maintainer_mode
     meson.current_build_dir(),
     src_untracked_pangomm,
     hg_ccg_basenames,
+    check: true,
   )
 
   built_cc_files = [ rel_untracked_pangomm / 'wrap_init.cc' ]
@@ -254,7 +255,7 @@ endif
 
 # Install built .h and _p.h files.
 meson.add_install_script(
-  python3.path(), generate_binding_py, 'install_built_h_files',
+  python3, generate_binding_py, 'install_built_h_files',
   built_h_cc_dir,
   install_includedir / pangomm_pcname / 'pangomm', # subdir below {prefix}
   hg_ccg_basenames
@@ -263,7 +264,7 @@ meson.add_install_script(
 if can_add_dist_script
   # Distribute built files.
   meson.add_dist_script(
-    python3.path(), generate_binding_py, 'dist_built_files',
+    python3, generate_binding_py, 'dist_built_files',
     built_h_cc_dir,
     untracked_pangomm,
     hg_ccg_basenames,


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