From 50ddff517f22b34b8d2054c4bcbb616a9efb0eb6 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 11 Mar 2022 08:47:31 -0700 Subject: MSVS_CACHE: Reword the CHANGES and RELEASE entries Sharpened up the descriptions of the change in PR 4111. Changed the opening of the cache file to use pathlib functions. Signed-off-by: Mats Wichmann --- CHANGES.txt | 13 ++++++++----- RELEASE.txt | 20 ++++++++++++-------- SCons/Tool/MSCommon/common.py | 9 ++++++--- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index e7be169..41b02d9 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -57,11 +57,14 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fixed crash in C scanner's dictify_CPPDEFINES() function which happens if AppendUnique is called on CPPPATH. (Issue #4108). - The MSVC script_env_cache now contains a sanity check: if the retrieved - tools path does not exist, it is invalidated so it will be recomputed. - The dictionary key, which is the name of a batch file, is also computed - a bit differently: the dashes are left off if there are no arguments. - The cachefile is changed to have a .json suffix, for better recognition - on Windows where there might, for example, be an editor association. + tools path does not exist, the entry is invalidated so it will + be recomputed, in an attempt to avoid scons failing when certain + compiler version bumps have taken place. The dictionary key (uses + the name of a batch file and any arguments which may have been + passes), is now computed a bit differently: the dashes are left + off if there are no arguments. The default cachefile is changed + to have a .json suffix, for better recognition on Windows since + the contents are json. From Zhichang Yu: - Added MSVC_USE_SCRIPT_ARGS variable to pass arguments to MSVC_USE_SCRIPT. diff --git a/RELEASE.txt b/RELEASE.txt index 80b8bf1..c021a40 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -26,19 +26,23 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY --------------------------------------- - On Windows, %AllUsersProfile%\scons\site_scons is now the default "system" - location for a site_scons. %AllUsersProfile%\Application Data\scons\site_scons - will continue to work. There does not seem to be any convention to use - an "Application Data" subdirectory here. + location for a site_scons directory. + %AllUsersProfile%\Application Data\scons\site_scons will continue to work. + There does not seem to be any existing convention to use an + "Application Data" subdirectory here. - Action._subproc() can now be used as a python context manager to ensure that the POpen object is properly closed. -- SCons help (-H) no longer prints the "ignored for compatibility" options, - which are still listed in the manpage. +- SCons help (-H) no longer prints the "ignored for compatibility" options + to save some space (these are still listed in the manpage). - 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) -- The SCONS_CACHE_MSVC_CONFIG behavior changes slightly: will now do a - sanity check to hopefully regenerate if the compiler version has changed, - rather than fail; the default filename now has a .json suffix. +- If SCONS_CACHE_MSVC_CONFIG is used, it will now attempt a sanity check for + the cached compiler information, and regenerate the information + if needed, rather than just failing after certain compiler version + changes have happened. The cache file can still be manually removed + if there are issues to force a regen. The default cache filename now + has a .json suffix - the contents have always been json. FIXES diff --git a/SCons/Tool/MSCommon/common.py b/SCons/Tool/MSCommon/common.py index fee460a..16ed42c 100644 --- a/SCons/Tool/MSCommon/common.py +++ b/SCons/Tool/MSCommon/common.py @@ -31,6 +31,7 @@ import os import re import subprocess import sys +from pathlib import Path import SCons.Util @@ -102,7 +103,8 @@ def read_script_env_cache(): envcache = {} if CONFIG_CACHE: try: - with open(CONFIG_CACHE, 'r') as f: + p = Path(CONFIG_CACHE) + with p.open('r') as f: envcache = json.load(f) except FileNotFoundError: # don't fail if no cache file, just proceed without it @@ -114,11 +116,12 @@ def write_script_env_cache(cache): """ write out cache of msvc env vars if requested """ if CONFIG_CACHE: try: - with open(CONFIG_CACHE, 'w') as f: + p = Path(CONFIG_CACHE) + with p.open('w') as f: json.dump(cache, f, indent=2) except TypeError: # data can't serialize to json, don't leave partial file - os.remove(CONFIG_CACHE) + p.unlink(missing_ok=True) except IOError: # can't write the file, just skip pass -- cgit v0.12