diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-05-03 16:25:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 16:25:14 (GMT) |
commit | 48e973a5b282b80bf5b7997b4c977ac196b86afd (patch) | |
tree | 8769a619a01918f436da8064f5c8943ccfcd51e3 | |
parent | 0aca2c9e7f11f29d21624ede1799f9745c68ef1e (diff) | |
parent | 1b80e513050e4a130b338133c50ce7ced67ec57d (diff) | |
download | SCons-48e973a5b282b80bf5b7997b4c977ac196b86afd.zip SCons-48e973a5b282b80bf5b7997b4c977ac196b86afd.tar.gz SCons-48e973a5b282b80bf5b7997b4c977ac196b86afd.tar.bz2 |
Merge branch 'master' into jbrill-msvc-vc
-rwxr-xr-x | CHANGES.txt | 6 | ||||
-rwxr-xr-x | RELEASE.txt | 5 | ||||
-rw-r--r-- | SCons/Tool/MSCommon/common.py | 36 |
3 files changed, 28 insertions, 19 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 4bf023e..e872127 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -26,7 +26,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER determination when configuring the build environment. This could lead to build failures when only an MSVC Express instance is installed and the MSVC version is not explicitly specified (issue #2668 and issue #2697). - + - Update the debug output written to stdout for MSVC initialization which is enabled by setting + SCONS_MSCOMMON_DEBUG=- to use the logging module. Also changed the debug output format + written to stdout to include more information about the source for each message of MSVC + initialization debugging output. A single space was added before the message for all + debugging output records written to stdout and to files. From William Deegan: - Fix check for unsupported Python version. It was broken. Also now the error message diff --git a/RELEASE.txt b/RELEASE.txt index 091ba96..fbefdee 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -42,6 +42,11 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY - The change to "content" and "content-timestamp" Decider names is reflected in the User Guide as well, since the hash function may be other than md5 (tidying up from earlier change) +- Update the debug output written to stdout for MSVC initialization which is enabled + by setting SCONS_MSCOMMON_DEBUG=- to use the logging module. Also changed the debug + output format written to stdout to include more information about the source for each + message of MSVC initialization debugging output. A single space was added before the + message for all debugging output records written to stdout and to files. FIXES diff --git a/SCons/Tool/MSCommon/common.py b/SCons/Tool/MSCommon/common.py index ee31b2d..83bd2fd 100644 --- a/SCons/Tool/MSCommon/common.py +++ b/SCons/Tool/MSCommon/common.py @@ -37,14 +37,7 @@ import SCons.Util # SCONS_MSCOMMON_DEBUG is internal-use so undocumented: # set to '-' to print to console, else set to filename to log to LOGFILE = os.environ.get('SCONS_MSCOMMON_DEBUG') -if LOGFILE == '-': - def debug(message, *args): - if args: - print(message % args) - else: - print(message) - -elif LOGFILE: +if LOGFILE: import logging modulelist = ( # root module and parent/root module @@ -71,17 +64,24 @@ elif LOGFILE: relfilename = relfilename.replace('\\', '/') record.relfilename = relfilename return True + # Log format looks like: + # 00109ms:MSCommon/vc.py:find_vc_pdir#447: VC found '14.3' [file] + # debug: 00109ms:MSCommon/vc.py:find_vc_pdir#447: VC found '14.3' [stdout] + log_format=( + '%(relativeCreated)05dms' + ':%(relfilename)s' + ':%(funcName)s' + '#%(lineno)s' + ': %(message)s' + ) + if LOGFILE == '-': + log_format = 'debug: ' + log_format + log_handler = logging.StreamHandler(sys.stdout) + else: + log_handler = logging.FileHandler(filename=LOGFILE) logging.basicConfig( - # This looks like: - # 00109ms:MSCommon/vc.py:find_vc_pdir#447:VC found '14.3' - format=( - '%(relativeCreated)05dms' - ':%(relfilename)s' - ':%(funcName)s' - '#%(lineno)s' - ':%(message)s' - ), - filename=LOGFILE, + format=log_format, + handlers=[log_handler], level=logging.DEBUG) logger = logging.getLogger(name=__name__) logger.addFilter(_Debug_Filter()) |