aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-11-21 14:47:38 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-11-21 21:07:43 +0000
commitf30dfc1e68ca48c332ca11e6c6c2d4d167fb978e (patch)
tree1c22e246664c712fc4fbaaa8cc8a273aa7c662a7
parentf997b9aff5e0b4dcc67438bc6727c202d680b6eb (diff)
Build scripts: Implement --quiet
Add a _verbose setting to the utils module and set it depending on option --quiet. Depending on this, suppress the messages about copying files, shortening the build log by over 1000 lines. Change-Id: I3f9abce3b145d43c4fe615f624ca4e2769a269f8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--build_scripts/main.py14
-rw-r--r--build_scripts/options.py1
-rw-r--r--build_scripts/utils.py33
3 files changed, 32 insertions, 16 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index fdc5f4a08..b57e4978b 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -43,7 +43,7 @@ from distutils.version import LooseVersion
import os
import time
from .config import config
-from .utils import memoize, get_python_dict
+from .utils import memoize, get_python_dict, set_quiet
from .options import *
setup_script_dir = os.getcwd()
@@ -911,8 +911,11 @@ class PysideBuild(_build):
module_src_dir = os.path.join(self.sources_dir, extension)
# Build module
- cmake_cmd = [
- OPTION_CMAKE,
+ cmake_cmd = [OPTION_CMAKE]
+ if OPTION_QUIET:
+ set_quiet(True)
+ cmake_cmd.append('--quiet')
+ cmake_cmd += [
"-G", self.make_generator,
"-DBUILD_TESTS={}".format(self.build_tests),
"-DQt5Help_DIR={}".format(self.qtinfo.docs_dir),
@@ -1308,8 +1311,9 @@ class PysideBuild(_build):
if not os.path.exists(srcpath):
continue
rpath_cmd(srcpath)
- print("Patched rpath to '$ORIGIN/' (Linux) or "
- "updated rpath (OS/X) in {}.".format(srcpath))
+ if not OPTION_QUIET:
+ print("Patched rpath to '$ORIGIN/' (Linux) or "
+ "updated rpath (OS/X) in {}.".format(srcpath))
cmd_class_dict = {
diff --git a/build_scripts/options.py b/build_scripts/options.py
index 2d47bcca5..3a5caf392 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -171,6 +171,7 @@ OPTION_MODULE_SUBSET = option_value("module-subset")
OPTION_RPATH_VALUES = option_value("rpath")
OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix")
OPTION_QT_SRC = option_value("qt-src-dir")
+OPTION_QUIET = has_option('quiet')
OPTION_VERBOSE_BUILD = has_option("verbose-build")
OPTION_SANITIZE_ADDRESS = has_option("sanitize-address")
OPTION_SNAPSHOT_BUILD = has_option("snapshot-build")
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index 5c5f4927d..66c844d10 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -58,11 +58,16 @@ import distutils.log as log
from distutils.errors import DistutilsOptionError
from distutils.errors import DistutilsSetupError
+_verbose = True
+
try:
WindowsError
except NameError:
WindowsError = None
+def set_quiet(quiet):
+ global _verbose
+ _verbose = not quiet
def filter_match(name, patterns):
for pattern in patterns:
@@ -254,7 +259,8 @@ def copyfile(src, dst, force=True, vars=None, force_copy_symlink=False,
return
if not os.path.islink(src) or force_copy_symlink:
- log.info("Copying file {} to {}.".format(src, dst))
+ if _verbose:
+ log.info("Copying file {} to {}.".format(src, dst))
shutil.copy2(src, dst)
if make_writable_by_owner:
make_file_writable_by_owner(dst)
@@ -270,8 +276,9 @@ def copyfile(src, dst, force=True, vars=None, force_copy_symlink=False,
os.chdir(target_dir)
if os.path.exists(link_name):
os.remove(link_name)
- log.info("Symlinking {} -> {} in {}.".format(link_name,
- link_target, target_dir))
+ if _verbose:
+ log.info("Symlinking {} -> {} in {}.".format(link_name,
+ link_target, target_dir))
os.symlink(link_target, link_name)
except OSError:
log.error("{} -> {}: Error creating symlink".format(link_name,
@@ -291,7 +298,8 @@ def makefile(dst, content=None, vars=None):
content = content.format(**vars)
dst = dst.format(**vars)
- log.info("Making file {}.".format(dst))
+ if _verbose:
+ log.info("Making file {}.".format(dst))
dstdir = os.path.dirname(dst)
if not os.path.exists(dstdir):
@@ -322,8 +330,9 @@ def copydir(src, dst, filter=None, ignore=None, force=True, recursive=True,
"filter={}. ignore={}.".format(src, dst, filter, ignore))
return []
- log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src, dst,
- filter, ignore))
+ if _verbose:
+ log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src,
+ dst, filter, ignore))
names = os.listdir(src)
@@ -405,9 +414,10 @@ def run_process(args, initial_env=None, redirect_stderr_to_stdout=True):
Prints both stdout and stderr to the console.
No output is captured.
"""
- log.info("Running process in directory {0}: command {1}".format(
- os.getcwd(),
- " ".join([(" " in x and '"{0}"'.format(x) or x) for x in args]))
+ if _verbose:
+ log.info("Running process in directory {0}: command {1}".format(
+ os.getcwd(),
+ " ".join([(" " in x and '"{0}"'.format(x) or x) for x in args]))
)
if initial_env is None:
@@ -493,8 +503,9 @@ def regenerate_qt_resources(src, pyside_rcc_path, pyside_rcc_options):
srcname_split = srcname.rsplit('.qrc', 1)
dstname = '_rc.py'.join(srcname_split)
if os.path.exists(dstname):
- log.info('Regenerating {} from {}'.format(dstname,
- os.path.basename(srcname)))
+ if _verbose:
+ log.info('Regenerating {} from {}'.format(dstname,
+ os.path.basename(srcname)))
run_process([pyside_rcc_path,
pyside_rcc_options,
srcname, '-o', dstname])