[mm-common] Update README



commit 1e3cf2699512acfbdea347164200ebd81062d58e
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Feb 11 15:08:37 2022 +0100

    Update README

 README | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/README b/README
index 326a314..6b1ce92 100644
--- a/README
+++ b/README
@@ -80,30 +80,33 @@ The mm-common-get shell script is installed in ${bindir} and must be
 invoked with run_command() early in a meson.build file. The meson.build file
 should contain code similar to
 
-  python = import('python').find_installation('python3')
+  python3 = import('python').find_installation()
   cmd_py = '''
   import os
   import sys
-  sys.exit(0 if os.path.isdir("@0@") else 1)
+  sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
   '''.format(project_source_root / '.git')
-  is_git_build = run_command(python, '-c', cmd_py).returncode() == 0
+  is_git_build = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
   maintainer_mode_opt = get_option('maintainer-mode')
   maintainer_mode = maintainer_mode_opt == 'true' or \
                    (maintainer_mode_opt == 'if-git-build' and is_git_build)
-  mm_common_get = find_program('mm-common-get', required: maintainer_mode)
-
-  if maintainer_mode and mm_common_get.found()
+  mm_common_get = find_program('mm-common-get', required: false)
+  if maintainer_mode and not mm_common_get.found()
+    message('Maintainer mode requires the \'mm-common-get\' command. If it is not found,\n' +
+            'install the \'mm-common\' package, version 1.0.0 or higher.')
+    # If meson --wrap-mode != forcefallback, Meson falls back to the mm-common
+    # subproject only if mm-common-get is required.
+    mm_common_get = find_program('mm-common-get', required: true)
+  endif
+  if maintainer_mode
     # Copy files to untracked/build_scripts and untracked/docs.
     run_command(mm_common_get, '--force',
       project_source_root / 'untracked' / 'build_scripts',
-      project_source_root / 'untracked' / 'docs')
+      project_source_root / 'untracked' / 'docs',
+      check: true,
+    )
   endif
 
-In a Unix-like system the first few lines can be replaced with
-
-  is_git_build = run_command('test', '-d', project_source_root/'.git').returncode() == 0
-
-
 Autoconf M4 macros (Autotools)
 ------------------------------
 


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