[mm-common] Make quiet installations possible



commit 727241758e46b14cda6940e62651674d8748dc3f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Apr 19 14:45:38 2021 +0200

    Make quiet installations possible
    
    * util/build_scripts/doc-reference.py:
    * util/build_scripts/generate-binding.py:
    * util/meson_aux/extra-install-cmd.py: Don't print names of installed
    files or other informative messages if the environment variable
    MESON_INSTALL_QUIET is set.
    It is set by "meson install --quiet" in Meson 0.54.0 and newer.

 util/build_scripts/doc-reference.py    | 9 ++++++---
 util/build_scripts/generate-binding.py | 7 +++++--
 util/meson_aux/extra-install-cmd.py    | 2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/util/build_scripts/doc-reference.py b/util/build_scripts/doc-reference.py
index 8edd6ba..c9a3a80 100755
--- a/util/build_scripts/doc-reference.py
+++ b/util/build_scripts/doc-reference.py
@@ -100,14 +100,17 @@ def install_doc():
   os.makedirs(destdir_htmlrefdir, exist_ok=True)
   os.makedirs(destdir_devhelpdir, exist_ok=True)
 
+  verbose = []
+  if not os.getenv('MESON_INSTALL_QUIET'):
+    verbose = ['--verbose']
+
   # Install html files.
   cmd = [
     'perl',
     '--',
     os.path.join(MMDOCTOOLDIR, 'doc-install.pl'),
-    '--verbose',
     '--mode=0644',
-  ] + sys.argv[6:] + [
+  ] + verbose + sys.argv[6:] + [
     '-t', destdir_htmlrefdir,
     '--glob',
     '--',
@@ -121,8 +124,8 @@ def install_doc():
     'perl',
     '--',
     os.path.join(MMDOCTOOLDIR, 'doc-install.pl'),
-    '--verbose',
     '--mode=0644',
+  ] + verbose + [
     '--book-base=' + prefix_htmlrefdir.rstrip('/'),
     '-t', destdir_devhelpdir,
     '--',
diff --git a/util/build_scripts/generate-binding.py b/util/build_scripts/generate-binding.py
index b412521..c88bc5c 100755
--- a/util/build_scripts/generate-binding.py
+++ b/util/build_scripts/generate-binding.py
@@ -96,15 +96,18 @@ def install_built_h_files():
   # Create the installation directory, if it does not exist.
   os.makedirs(os.path.join(install_dir, 'private'), exist_ok=True)
 
+  quiet = bool(os.getenv('MESON_INSTALL_QUIET'))
   for file in sys.argv[4:]:
     path_h = os.path.join(built_h_dir, file+'.h')
-    print('Installing ', path_h, ' to ', install_dir)
+    if not quiet:
+      print('Installing ', path_h, ' to ', install_dir)
     # shutil.copy2() copies timestamps and some other file metadata.
     shutil.copy2(path_h, install_dir)
 
     path_h = os.path.join(built_h_dir, 'private', file+'_p.h')
     install_priv_dir = os.path.join(install_dir, 'private')
-    print('Installing ', path_h, ' to ', install_priv_dir)
+    if not quiet:
+      print('Installing ', path_h, ' to ', install_priv_dir)
     shutil.copy2(path_h, install_priv_dir)
   return 0
 
diff --git a/util/meson_aux/extra-install-cmd.py b/util/meson_aux/extra-install-cmd.py
index 2b6d4e2..b79c2fe 100755
--- a/util/meson_aux/extra-install-cmd.py
+++ b/util/meson_aux/extra-install-cmd.py
@@ -9,7 +9,7 @@ import os
 import sys
 import subprocess
 
-if not os.getenv('DESTDIR'):
+if not (os.getenv('DESTDIR') or os.getenv('MESON_INSTALL_QUIET')):
   # Inform the installer that M4 macro files installed in a directory
   # not known to aclocal will not be picked up automatically.
   # (Starting with Python 3.7 text=True is a more understandable equivalent to


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