diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-11-28 17:05:08 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-12-07 12:41:43 +0000 |
commit | 9fa13b2c5f43d6fbaeb4360ac54391a91b3e9e54 (patch) | |
tree | 61887ff3f838bf890bbd6d95302e862d829da9a0 /build_scripts/utils.py | |
parent | 4d82ee992992251bcadf0097a4df60fe7c3b7ef8 (diff) |
Make quiet builds really quiet
The change does a couple of things:
- Sets the distutils / setuptools --verbose option to 0
- Sets the distutils / setuptools --quiet option to 1
- The options above end up calling distutils.log.set_verbosity(0)
- Passes the QUIET_BUILD cmake option from setup.py to every
CMake invocation, when --quiet is passed to setup.py
- Sets the CMAKE_INSTALL_MESSAGE variable to silence messages
regarding installation of files
- Sets the CMAKE_RULE_MESSAGES variable to disable progress report
in makefiles when building each source file
- Overrides the CMake message function, not to display
STATUS / info / untyped messages (still displays warnings and
errors)
- Changes the build / install elapsed time messages to always be
printed even in quiet mode
- Reverts the previously introduced set_quiet function in utils,
because log.set_verbosity() now takes care of silencing those
messages
As a result, there's a lot less clutter when doing a quiet build.
Warnings, errors and shiboken output is still displayed.
Change-Id: Ie05c593ce7dc0aa04554c2d2859ce655233ddb9f
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'build_scripts/utils.py')
-rw-r--r-- | build_scripts/utils.py | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py index 66c844d10..924b698dc 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -58,16 +58,11 @@ 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: @@ -259,8 +254,7 @@ def copyfile(src, dst, force=True, vars=None, force_copy_symlink=False, return if not os.path.islink(src) or force_copy_symlink: - if _verbose: - log.info("Copying file {} to {}.".format(src, dst)) + log.info("Copying file {} to {}.".format(src, dst)) shutil.copy2(src, dst) if make_writable_by_owner: make_file_writable_by_owner(dst) @@ -276,9 +270,8 @@ 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) - if _verbose: - log.info("Symlinking {} -> {} in {}.".format(link_name, - link_target, target_dir)) + 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, @@ -298,8 +291,7 @@ def makefile(dst, content=None, vars=None): content = content.format(**vars) dst = dst.format(**vars) - if _verbose: - log.info("Making file {}.".format(dst)) + log.info("Making file {}.".format(dst)) dstdir = os.path.dirname(dst) if not os.path.exists(dstdir): @@ -330,9 +322,8 @@ def copydir(src, dst, filter=None, ignore=None, force=True, recursive=True, "filter={}. ignore={}.".format(src, dst, filter, ignore)) return [] - if _verbose: - log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src, - dst, filter, ignore)) + log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src, + dst, filter, ignore)) names = os.listdir(src) @@ -414,10 +405,9 @@ def run_process(args, initial_env=None, redirect_stderr_to_stdout=True): Prints both stdout and stderr to the console. No output is captured. """ - 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])) + 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: @@ -503,9 +493,8 @@ 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): - if _verbose: - log.info('Regenerating {} from {}'.format(dstname, - os.path.basename(srcname))) + log.info('Regenerating {} from {}'.format(dstname, + os.path.basename(srcname))) run_process([pyside_rcc_path, pyside_rcc_options, srcname, '-o', dstname]) |