From 04b49967dbcd9930087471a1771939b93bfb4e38 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 29 Oct 2018 16:13:32 -0600 Subject: For PR#3222: improve ms build finding Broaden the search to also include Build Tools (the compiler without the whole Visual Studio works). Also in the initial search to see if a suite is valid or not, don't just look for a couple of locations within a given path, do a search. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 3 +++ src/engine/SCons/Tool/MSCommon/vc.py | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 97c3455..a85f37c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -176,6 +176,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Update (pep8) configure-cache script, add a --show option. - Fix for a couple of "what if tool not found" exceptions in framework. - Add Textfile/Substfile to default environment. (issue #3147) + - Improve finding of Microsoft compiler: add a 'products' wildcard + in case Build Tools only is installed; search for cl.exe in located + path instead of just looking for a couple of built-in locations. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 32ee96f..c4b9773 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -241,7 +241,7 @@ def find_vc_pdir_vswhere(msvc_version): 'Installer', 'vswhere.exe' ) - vswhere_cmd = [vswhere_path, '-version', msvc_version, '-property', 'installationPath'] + vswhere_cmd = [vswhere_path, '-products', '*', '-version', msvc_version, '-property', 'installationPath'] if os.path.exists(vswhere_path): sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -355,15 +355,30 @@ def cached_get_installed_vcs(): def get_installed_vcs(): installed_versions = [] + + def clfind(name, path): + '''Search for a filename in a given path. + + Look for a filename (normally cl.exe) underneath a path. No need + to return the path found, someplace else will dig deeper, this is + just used to confirm a given suite contains that file. Note it + does not promise the cl.exe is the combination of host/target we + actually need, that is also done elsewhere. + ''' + for root, _, files in os.walk(path): + if name in files: + debug('get_installed_vcs cl.exe found %s' % os.path.join(root, name)) + return True + return False + for ver in _VCVER: debug('trying to find VC %s' % ver) try: VC_DIR = find_vc_pdir(ver) if VC_DIR: debug('found VC %s' % ver) - # check to see if the x86 or 64 bit compiler is in the bin dir - if (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) - or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe'))): + # now make sure there's a cl.exe in that path + if clfind('cl.exe', VC_DIR): installed_versions.append(ver) else: debug('find_vc_pdir no cl.exe found %s' % ver) -- cgit v0.12 From be0effcc25ebfbb90f6c6e3a40fc4ffebbc0b9aa Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 30 Oct 2018 09:21:16 -0600 Subject: Documentation cleanup for vswhere-related fix Polish up a few docstrings and be more descriptive about the search for cl.exe. Also add requested version qualifiers to entry in CHANGES.txt. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 6 ++- src/engine/SCons/Tool/MSCommon/vc.py | 81 +++++++++++++++++++++++------------- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a85f37c..6d6e24d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -177,8 +177,10 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Fix for a couple of "what if tool not found" exceptions in framework. - Add Textfile/Substfile to default environment. (issue #3147) - Improve finding of Microsoft compiler: add a 'products' wildcard - in case Build Tools only is installed; search for cl.exe in located - path instead of just looking for a couple of built-in locations. + in case 2017 Build Tools only is installed as it is considered a separate + product from the default Visual Studio; search for cl.exe in located + path instead of just looking for a couple of built-in locations as + 2017 products are putting cl.exe deeper down the heirarchy. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c4b9773..437633a 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -202,21 +202,21 @@ def msvc_version_to_maj_min(msvc_version): raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) def is_host_target_supported(host_target, msvc_version): - """Return True if the given (host, target) tuple is supported given the - msvc version. - - Parameters - ---------- - host_target: tuple - tuple of (canonalized) host-target, e.g. ("x86", "amd64") for cross - compilation from 32 bits windows to 64 bits. - msvc_version: str - msvc version (major.minor, e.g. 10.0) - - Note - ---- - This only check whether a given version *may* support the given (host, - target), not that the toolchain is actually present on the machine. + """Check if the given (host, target) tuple is supported for given version. + + Args: + host_target: tuple + tuple of (canonalized) host-targets, e.g. ("x86", "amd64") + for cross compilation from 32 bit Windows to 64 bits. + msvc_version: str + msvc version (major.minor, e.g. 10.0) + + Returns: + bool: + + Note: + This only checks whether a given version *may* support the given (host, + target), not that the toolchain is actually present on the machine. """ # We assume that any Visual Studio version supports x86 as a target if host_target[1] != "x86": @@ -229,10 +229,11 @@ def is_host_target_supported(host_target, msvc_version): def find_vc_pdir_vswhere(msvc_version): """ - Find the MSVC product directory using vswhere.exe . + Find the MSVC product directory using vswhere.exe. + Run it asking for specified version and get MSVS install location :param msvc_version: - :return: MSVC install dir + :return: MSVC install dir or None """ vswhere_path = os.path.join( 'C:\\', @@ -256,13 +257,25 @@ def find_vc_pdir_vswhere(msvc_version): def find_vc_pdir(msvc_version): - """Try to find the product directory for the given - version. + """Try to find the product directory for the given version. + + Tries to look up the path using a registry key from the table + _VCVER_TO_PRODUCT_DIR; if there is no key, calls find_vc_pdir_wshere + for help instead. + + Args: + msvc_version: str + msvc version (major.minor, e.g. 10.0) + + Returns: + str: Path found in registry, or None - Note - ---- - If for some reason the requested version could not be found, an - exception which inherits from VisualCException will be raised.""" + Raises: + UnsupportedVersion: if the version is not known by this file. + MissingConfiguration: found version but the directory is missing. + + Both exceptions inherit from VisualCException. + """ root = 'Software\\' try: hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] @@ -354,16 +367,24 @@ def cached_get_installed_vcs(): return __INSTALLED_VCS_RUN def get_installed_vcs(): + '''Query which versions of compiler suites are installed. + + Returns: + list: version strings from _VCVER that appear to be installed. + ''' installed_versions = [] def clfind(name, path): '''Search for a filename in a given path. - Look for a filename (normally cl.exe) underneath a path. No need + Look for 'name' (normally cl.exe) recursively in 'path'. No need to return the path found, someplace else will dig deeper, this is - just used to confirm a given suite contains that file. Note it - does not promise the cl.exe is the combination of host/target we - actually need, that is also done elsewhere. + just used to confirm a given suite from _VCVER contains that file. + Note it does not promise the cl.exe is the combination of + host/target we actually need, that is also done elsewhere. + + Returns: + bool: ''' for root, _, files in os.walk(path): if name in files: @@ -496,7 +517,7 @@ def msvc_find_valid_batch_script(env,version): (host_target, version) SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target] - + # Get just version numbers maj, min = msvc_version_to_maj_min(version) # VS2015+ @@ -587,11 +608,11 @@ def msvc_setup_env(env): for k, v in d.items(): debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) env.PrependENVPath(k, v, delete_existing=True) - + # final check to issue a warning if the compiler is not present msvc_cl = find_program_path(env, 'cl') if not msvc_cl: - SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, + SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") def msvc_exists(version=None): -- cgit v0.12 From eaa2d2712d91d171a79d5dd6528514b13f0dc42f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 18 Nov 2018 14:35:51 -0700 Subject: Typo fix Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6d6e24d..7b4dc2c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -180,7 +180,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE in case 2017 Build Tools only is installed as it is considered a separate product from the default Visual Studio; search for cl.exe in located path instead of just looking for a couple of built-in locations as - 2017 products are putting cl.exe deeper down the heirarchy. + 2017 products are putting cl.exe deeper down the hierarchy. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date -- cgit v0.12 From 9cc5ed21141c76a91a1c287965050071fd5f40fb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 22 Nov 2018 13:48:15 -0700 Subject: PR#3230: fix some debug, accept list from vswhere vc.py: Some of the debug prints weren't quite right, and added a few. When vswhere is called, it can return multiple lines if there are multiple products that match, so handle that case. Preparing for ARM support, add some host/target combos to the table - currently commented out. arm/arm64 added to the canonicalize table where it won't do any harm. common.py: in case we eventually switch to more general logging, use a specific logger rather than the root logger. Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/MSCommon/common.py | 2 +- src/engine/SCons/Tool/MSCommon/vc.py | 49 +++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index b60cd5b..a0140c6 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -46,7 +46,7 @@ elif LOGFILE: debug = lambda message: open(LOGFILE, 'a').write(message + '\n') else: logging.basicConfig(filename=LOGFILE, level=logging.DEBUG) - debug = logging.debug + debug = logging.getLogger(name=__name__).debug else: debug = lambda x: None diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 437633a..87b6b32 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -80,15 +80,17 @@ _ARCH_TO_CANONICAL = { "i486" : "x86", "i586" : "x86", "i686" : "x86", - "ia64" : "ia64", - "itanium" : "ia64", + "ia64" : "ia64", # deprecated + "itanium" : "ia64", # deprecated "x86" : "x86", "x86_64" : "amd64", "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits + "arm" : "arm", + "arm64" : "arm64", } -# Given a (host, target) tuple, return the argument for the bat file. Both host -# and targets should be canonalized. +# Given a (host, target) tuple, return the argument for the bat file. +# Both host and targets should be canonalized. _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "x86"): "x86", ("x86", "amd64"): "x86_amd64", @@ -96,7 +98,12 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", - ("x86", "ia64"): "x86_ia64" + ("x86", "ia64"): "x86_ia64", # gone since 14.0 + #("arm", "arm"): "arm", # since 14.0, maybe gone 14.1? + #("x86", "arm"): "x86_arm", # since 14.0 + #("x86", "arm64"): "x86_arm64", # since 14.1 + #("amd64", "arm"): "amd64_arm", # since 14.0 + #("amd64", "arm64"): "amd64_arm64", # since 14.1 } def get_host_target(env): @@ -247,9 +254,12 @@ def find_vc_pdir_vswhere(msvc_version): if os.path.exists(vswhere_path): sp = subprocess.Popen(vswhere_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) vsdir, err = sp.communicate() - vsdir = vsdir.decode("mbcs") - vsdir = vsdir.rstrip() - vc_pdir = os.path.join(vsdir, 'VC') + vsdir = vsdir.decode("mbcs").splitlines() + # vswhere could easily return multiple lines + # we could define a way to pick the one we prefer, but since + # this data is currently only used to make a check for existence, + # returning the first hit should be good enough for now. + vc_pdir = os.path.join(vsdir[0], 'VC') return vc_pdir else: # No vswhere on system, no install info available @@ -257,7 +267,7 @@ def find_vc_pdir_vswhere(msvc_version): def find_vc_pdir(msvc_version): - """Try to find the product directory for the given version. + """Find the product directory for the given version. Tries to look up the path using a registry key from the table _VCVER_TO_PRODUCT_DIR; if there is no key, calls find_vc_pdir_wshere @@ -289,8 +299,10 @@ def find_vc_pdir(msvc_version): if not key: comps = find_vc_pdir_vswhere(msvc_version) if not comps: - debug('find_vc_dir(): no VC found via vswhere for version {}'.format(repr(key))) + debug('find_vc_pdir_vswhere(): no VC found for version {}'.format(repr(msvc_version))) raise SCons.Util.WinError + debug('find_vc_pdir_vswhere(): VC found: {}'.format(repr(msvc_version))) + return comps else: if common.is_win64(): try: @@ -322,7 +334,7 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): if pdir is None: raise NoVersionFound("No version of Visual Studio found") - debug('vc.py: find_batch_file() pdir:{}'.format(pdir)) + debug('vc.py: find_batch_file() in {}'.format(pdir)) # filter out e.g. "Exp" from the version name msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."]) @@ -483,19 +495,19 @@ def msvc_setup_env_once(env): env["MSVC_SETUP_RUN"] = True def msvc_find_valid_batch_script(env,version): - debug('vc.py:msvc_find_valid_batch_script()') # Find the host platform, target platform, and if present the requested # target platform - (host_platform, target_platform,req_target_platform) = get_host_target(env) + platforms = get_host_target(env) + debug("vc.py: msvs_find_valid_batch_script(): host_platform %s, target_platform %s req_target_platform:%s" % platforms) + host_platform, target_platform, req_target_platform) = platforms try_target_archs = [target_platform] - debug("msvs_find_valid_batch_script(): req_target_platform %s target_platform:%s"%(req_target_platform,target_platform)) # VS2012 has a "cross compile" environment to build 64 bit # with x86_amd64 as the argument to the batch setup script - if req_target_platform in ('amd64','x86_64'): + if req_target_platform in ('amd64', 'x86_64'): try_target_archs.append('x86_amd64') - elif not req_target_platform and target_platform in ['amd64','x86_64']: + elif not req_target_platform and target_platform in ['amd64', 'x86_64']: # There may not be "native" amd64, but maybe "cross" x86_amd64 tools try_target_archs.append('x86_amd64') # If the user hasn't specifically requested a TARGET_ARCH, and @@ -542,9 +554,11 @@ def msvc_find_valid_batch_script(env,version): # Try to use the located batch file for this host/target platform combo debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg)) + found = None if vc_script: try: d = script_env(vc_script, args=arg) + found = vc_script except BatchFileExecutionError as e: debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) vc_script=None @@ -553,6 +567,7 @@ def msvc_find_valid_batch_script(env,version): debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) try: d = script_env(sdk_script) + found = sdk_script except BatchFileExecutionError as e: debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) continue @@ -560,7 +575,7 @@ def msvc_find_valid_batch_script(env,version): debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') continue - debug("vc.py:msvc_find_valid_batch_script() Found a working script/target: %s %s"%(repr(sdk_script),arg)) + debug("vc.py:msvc_find_valid_batch_script() Found a working script/target: %s/%s"%(repr(found),arg)) break # We've found a working target_platform, so stop looking # If we cannot find a viable installed compiler, reset the TARGET_ARCH -- cgit v0.12 From 070d31019e7ed0b57c9670e95db91afcc3932e40 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 22 Nov 2018 14:03:35 -0700 Subject: stray close-paren character Signed-off-by: Mats Wichmann --- src/engine/SCons/Tool/MSCommon/vc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 87b6b32..1f5e2e5 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -500,7 +500,7 @@ def msvc_find_valid_batch_script(env,version): platforms = get_host_target(env) debug("vc.py: msvs_find_valid_batch_script(): host_platform %s, target_platform %s req_target_platform:%s" % platforms) - host_platform, target_platform, req_target_platform) = platforms + host_platform, target_platform, req_target_platform = platforms try_target_archs = [target_platform] # VS2012 has a "cross compile" environment to build 64 bit -- cgit v0.12 From 962c46e4b8f433ecb7a07144849f6dab724fd5f5 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 19:54:47 -0500 Subject: Regenerated docs for 3.0.3 release --- doc/generated/examples/caching_ex-random_1.xml | 4 ++-- doc/generated/examples/troubleshoot_Dump_2.xml | 2 +- doc/generated/examples/troubleshoot_explain1_3.xml | 2 +- doc/generated/variables.gen | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/generated/examples/caching_ex-random_1.xml b/doc/generated/examples/caching_ex-random_1.xml index cab47eb..667ab4b 100644 --- a/doc/generated/examples/caching_ex-random_1.xml +++ b/doc/generated/examples/caching_ex-random_1.xml @@ -1,9 +1,9 @@ % scons -Q -cc -o f2.o -c f2.c cc -o f1.o -c f1.c cc -o f4.o -c f4.c -cc -o f5.o -c f5.c +cc -o f2.o -c f2.c cc -o f3.o -c f3.c +cc -o f5.o -c f5.c cc -o prog f1.o f2.o f3.o f4.o f5.o diff --git a/doc/generated/examples/troubleshoot_Dump_2.xml b/doc/generated/examples/troubleshoot_Dump_2.xml index a621422..08c6f04 100644 --- a/doc/generated/examples/troubleshoot_Dump_2.xml +++ b/doc/generated/examples/troubleshoot_Dump_2.xml @@ -79,7 +79,7 @@ scons: Reading SConscript files ... 'SHCXX': '$CXX', 'SHCXXCOM': '${TEMPFILE("$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM","$SHCXXCOMSTR")}', 'SHCXXFLAGS': ['$CXXFLAGS'], - 'SHELL': None, + 'SHELL': 'command', 'SHLIBPREFIX': '', 'SHLIBSUFFIX': '.dll', 'SHOBJPREFIX': '$OBJPREFIX', diff --git a/doc/generated/examples/troubleshoot_explain1_3.xml b/doc/generated/examples/troubleshoot_explain1_3.xml index cbe4800..ed8f6d9 100644 --- a/doc/generated/examples/troubleshoot_explain1_3.xml +++ b/doc/generated/examples/troubleshoot_explain1_3.xml @@ -3,5 +3,5 @@ cp file.in file.oout scons: warning: Cannot find target file.out after building -File "/home/bdbaddog/scons/git/as_scons/bootstrap/src/script/scons.py", line 204, in <module> +File "/Users/bdbaddog/devel/scons/git/as_scons/src/script/scons.py", line 204, in <module> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 5ed8c2f..436f14e 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -3298,7 +3298,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3308,7 +3308,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. -- cgit v0.12 From 2ecbca718d3d03cebaeb53aeb617107ac15e7e78 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 19:54:57 -0500 Subject: Updated for 3.0.3 release --- ReleaseConfig | 2 +- src/CHANGES.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReleaseConfig b/ReleaseConfig index 6bda340..7ff6087 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -32,7 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # 'final', the patchlevel is set to the release date. This value is # mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) -version_tuple = (3, 0, 3, 'alpha', 0) +version_tuple = (3, 0, 3) # Python versions prior to unsupported_python_version cause a fatal error # when that version is used. Python versions prior to deprecate_python_version diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6732d38..308f113 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,11 +5,11 @@ Change Log -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.3 - Sat, 02 Jan 2018 19:44:18 -0700 - From John Doe: + From William Deegan: - - Whatever John Doe did. + - Fixes to packaging logic. From Mats Wichmann: - Update some doc examples for Py3: map() now returns an interable -- cgit v0.12 From c5f4cb45a170e16f280729da55be53531966bb1e Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 20:04:54 -0500 Subject: Updates for 3.0.3 release --- debian/changelog | 6 +++ src/Announce.txt | 2 +- src/CHANGES.txt | 2 + src/RELEASE.txt | 114 ++++++++++++++++++++++++++++++------------------------- 4 files changed, 71 insertions(+), 53 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7fe610e..e906075 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +scons (3.0.3) unstable; urgency=low + + * Maintenance Release + + -- William Deegan Sat, 02 Jan 2018 19:44:18 -0700 + scons (3.0.2) unstable; urgency=low * Maintenance Release diff --git a/src/Announce.txt b/src/Announce.txt index c7948c0..d981b15 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE VERSION/DATE TO BE FILLED IN LATER +RELEASE 3.0.3 - Sat, 02 Jan 2018 19:44:18 -0700 Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 308f113..505471c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,8 @@ RELEASE 3.0.3 - Sat, 02 Jan 2018 19:44:18 -0700 + NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 + content. From William Deegan: diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 11d20e6..3cc5b6c 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,73 +1,83 @@ - A new SCons checkpoint release, 3.0.3.alpha.yyyymmdd, is now available - on the SCons download page: - https://scons.org/pages/download.html - - XXX The primary purpose of this release ... XXX - - A SCons "checkpoint release" is intended to provide early access to - new features so they can be tested in the field before being released - for adoption by other software distributions. - - Note that a checkpoint release is developed using the same test-driven - development methodology as all SCons releases. Existing SCons - functionality should all work as it does in previous releases (except - for any changes identified in the release notes) and early adopters - should be able to use a checkpoint release safely for production work - with existing SConscript files. If not, it represents not only a bug - in SCons but also a hole in the regression test suite, and we want to - hear about it. + A new SCons release, 3.0.3, is now available on the SCons download page: - New features may be more lightly tested than in past releases, - especially as concerns their interaction with all of the other - functionality in SCons. We are especially interested in hearing bug - reports about new functionality. + https://scons.org/pages/download.html - We do not recommend that downstream distributions (Debian, Fedora, - etc.) package a checkpoint release, mainly to avoid confusing the - "public" release numbering with the long checkpoint release names. - Here is a summary of the changes since 1.3.0: + Here is a summary of the changes since 3.0.1: NEW FUNCTIONALITY - - List new features (presumably why a checkpoint is being released) + - Properly support versioned shared libraries for MacOS. We've also introduced two + new env variables APPLELINK_CURRENT_VERSION and APPLELINK_COMPATIBILITY_VERSION which will specify + what is passed to the linkers -current_version and -compatibility_version flags. If not specified + they will be derived from SHLIBVERSION as such: + - APPLELINK_CURRENT_VERSION = SHLIBVERSION + - APPLELINK_COMPATIBILITY_VERSION = all but the last digit in SHLIBVERSION with .0 appended. + Note that the values of the above will be validated. Valid format for either APPLELINK variable is + X[.Y[.Z]] where 0 <= X <= 65535, 0 <= Y <= 255, 0 <= Z <= 255. + - Add flag must_exist to SConscript() call to fail on missing script. + Not failing on missing script is now considered deprecated, and the first instance will print a + deprecation message. + - Add xz compression format to packaging choices. + - Add Textfile/Substfile to default environment. (issue #3147) + - Added virtualenv support. A new function Virtualenv() determines whether + SCons runs in a virtualenv. The search PATH may also be extended to + prefer executables from the current virtualenv over the ones provided by + base environment. New option --enable-virtualenv provided to import some + virtualenv-related variables to SCons and extend every env['ENV']['PATH'] + automatically. New option --ignore-virtualenv disables this. Two + environment variables, SCONS_ENABLE_VIRTUALENV and + SCONS_IGNORE_VIRTUALENV are supported for the same purpose. DEPRECATED FUNCTIONALITY - - List anything that's been deprecated since the last release + - Going forward calling SConscript on a non-existing SConscript file will issue a warning. Currently + it will issue a deprecation notice. CHANGED/ENHANCED EXISTING FUNCTIONALITY - - List modifications to existing features, where the previous behavior - wouldn't actually be considered a bug - - FIXES - - - List fixes of outright bugs - - IMPROVEMENTS - - - List improvements that wouldn't be visible to the user in the - documentation: performance improvements (describe the circumstances - under which they would be observed), or major code cleanups - - PACKAGING - - - List changes in the way SCons is packaged and/or released + - Recognize new java 9, 10, 11 (as 9.0 and 10.0, 11.0) DOCUMENTATION + - Update some doc examples for Py3: map() now returns an iterable + instead of a list. - - List any significant changes to the documentation (not individual - typo fixes, even if they're mentioned in src/CHANGES.txt to give - the contributor credit) + FIXES - DEVELOPMENT + - Fix issue #2980 with credit to Piotr Bartosik (and William Blevins). This is an issue where using + TimeStamp-MD5 Decider and CacheDir can yield incorrect md5's being written into the .sconsign. + The difference between Piotr Bartosik's patch and the current code is that the more complicated + creation of file to csig map is only done when the count of children for the current node doesn't + match the previous count which is loaded from the sconsign. - - List visible changes in the way SCons is developed - Thanks to CURLY, LARRY, and MOE for their contributions to this release. + Thanks to Bernard Blackham, William Deegan, Ray Donnelly, Andrew Featherstone, Arda Fu, + Philipp Maierhöfer, Matthew Marinets, Fredrik Medley, Daniel Moody, Gary Oberbrunner, + Jonathon Reinhart, Zachary Tessler, Paweł Tomulik, Richard West, Mats Wichmann, Bernhard M. Wiedemann, + and Hao Wu for their contributions to this release. Contributors are listed alphabetically by their last name. -__COPYRIGHT__ -__FILE__ __REVISION__ __DATE__ __DEVELOPER__ +git shortlog --no-merges -ns 3.0.1..HEAD + 235 William Deegan + 79 Daniel Moody + 73 Mats Wichmann + 17 Paweł Tomulik + 16 Andrew Featherstone + 8 grbd + 7 maiphi + 6 Gary Oberbrunner + 6 Daniel + 4 Hao Wu + 3 Gabriel Russell + 2 MatthewMarinets + 2 Jonathon Reinhart + 2 ArdaFu + 1 Bernhard M. Wiedemann + 1 Isaac Pascual Monells + 1 Fredrik Medley + 1 Philipp Maierhoefer + 1 Piotr Kasprzyk + 1 Ray Donnelly + 1 Zachary Tessler + 1 cclauss -- cgit v0.12 From 995b295e108a86ecae369039cdfdd1308ce92621 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 20:06:02 -0500 Subject: updates from update-release-info for 3.0.3 release --- README.rst | 14 +++++++------- SConstruct | 4 ++-- doc/user/main.xml | 4 ++-- src/Announce.txt | 2 +- src/CHANGES.txt | 2 +- testing/framework/TestSCons.py | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index 3c84ce6..b7f49da 100755 --- a/README.rst +++ b/README.rst @@ -499,13 +499,13 @@ about `Executing SCons Without Installing`_):: Depending on the utilities installed on your system, any or all of the following packages will be built:: - build/dist/scons-3.0.2.tar.gz - build/dist/scons-3.0.2.zip - build/dist/scons-doc-3.0.2.tar.gz - build/dist/scons-local-3.0.2.tar.gz - build/dist/scons-local-3.0.2.zip - build/dist/scons-src-3.0.2.tar.gz - build/dist/scons-src-3.0.2.zip + build/dist/scons-3.0.3.tar.gz + build/dist/scons-3.0.3.zip + build/dist/scons-doc-3.0.3.tar.gz + build/dist/scons-local-3.0.3.tar.gz + build/dist/scons-local-3.0.3.zip + build/dist/scons-src-3.0.3.tar.gz + build/dist/scons-src-3.0.3.zip The SConstruct file is supposed to be smart enough to avoid trying to build packages for which you don't have the proper utilities installed. For diff --git a/SConstruct b/SConstruct index 86e9711..22caa1d 100644 --- a/SConstruct +++ b/SConstruct @@ -8,7 +8,7 @@ from __future__ import print_function copyright_years = '2001 - 2018' # This gets inserted into the man pages to reflect the month of release. -month_year = 'December 2018' +month_year = 'January 2019' # # __COPYRIGHT__ @@ -51,7 +51,7 @@ import textwrap import bootstrap project = 'scons' -default_version = '3.0.2' +default_version = '3.0.3' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years SConsignFile() diff --git a/doc/user/main.xml b/doc/user/main.xml index a34405b..42724d1 100644 --- a/doc/user/main.xml +++ b/doc/user/main.xml @@ -74,10 +74,10 @@ Steven Knight and the SCons Development Team - 2004 - 2018 + 2004 - 2019 - 2004 - 2018 + 2004 - 2019 The SCons Foundation diff --git a/src/Announce.txt b/src/Announce.txt index d981b15..b4d50f1 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE 3.0.3 - Sat, 02 Jan 2018 19:44:18 -0700 +RELEASE 3.0.3 - Mon, 05 Jan 2019 20:05:22 -0400 Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 505471c..288f97c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,7 +5,7 @@ Change Log -RELEASE 3.0.3 - Sat, 02 Jan 2018 19:44:18 -0700 +RELEASE 3.0.3 - Mon, 05 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index ee8f0ec..b543c07 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -35,7 +35,7 @@ from TestCmd import PIPE # here provides some independent verification that what we packaged # conforms to what we expect. -default_version = '3.0.2' +default_version = '3.0.3' python_version_unsupported = (2, 6, 0) python_version_deprecated = (2, 7, 0) -- cgit v0.12 From 37e6ab8f3e6d1885f8e87b8bdd77f20039192a6d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 17:12:10 -0800 Subject: Fix version string from 3.1.0 to 3.0.3 --- README.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index b7f49da..ca66d51 100755 --- a/README.rst +++ b/README.rst @@ -178,7 +178,7 @@ Or on Windows:: By default, the above commands will do the following: -- Install the version-numbered "scons-3.1.0" and "sconsign-3.1.0" scripts in +- Install the version-numbered "scons-3.1.0" and "sconsign-3.0.3" scripts in the default system script directory (/usr/bin or C:\\Python\*\\Scripts, for example). This can be disabled by specifying the "--no-version-script" option on the command line. @@ -190,23 +190,23 @@ By default, the above commands will do the following: before making it the default on your system. On UNIX or Linux systems, you can have the "scons" and "sconsign" scripts be - hard links or symbolic links to the "scons-3.1.0" and "sconsign-3.1.0" + hard links or symbolic links to the "scons-3.0.3" and "sconsign-3.0.3" scripts by specifying the "--hardlink-scons" or "--symlink-scons" options on the command line. -- Install "scons-3.1.0.bat" and "scons.bat" wrapper scripts in the Python +- Install "scons-3.0.3.bat" and "scons.bat" wrapper scripts in the Python prefix directory on Windows (C:\\Python\*, for example). This can be disabled by specifying the "--no-install-bat" option on the command line. On UNIX or Linux systems, the "--install-bat" option may be specified to - have "scons-3.1.0.bat" and "scons.bat" files installed in the default system + have "scons-3.0.3.bat" and "scons.bat" files installed in the default system script directory, which is useful if you want to install SCons in a shared file system directory that can be used to execute SCons from both UNIX/Linux and Windows systems. - Install the SCons build engine (a Python module) in an appropriate - version-numbered SCons library directory (/usr/lib/scons-3.1.0 or - C:\\Python\*\\scons-3.1.0, for example). See below for more options related to + version-numbered SCons library directory (/usr/lib/scons-3.0.3 or + C:\\Python\*\\scons-3.0.3, for example). See below for more options related to installing the build engine library. - Install the troff-format man pages in an appropriate directory on UNIX or @@ -484,7 +484,7 @@ running all of "runtest.py -a". Building Packages ================= -We use SCons (version 3.1.0 or later) to build its own packages. If you +We use SCons (version 3.0.3 or later) to build its own packages. If you already have an appropriate version of SCons installed on your system, you can build everything by simply running it:: -- cgit v0.12 From 102c35fc0f5e15ed1548e94911c8ecc02ed8ad5d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 17:15:03 -0800 Subject: Minor versioning fixes --- src/README.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/README.txt b/src/README.txt index ce65b8d..40d7217 100644 --- a/src/README.txt +++ b/src/README.txt @@ -2,7 +2,7 @@ SCons - a software construction tool - Version __VERSION__ + Version 3.0.3 This is SCons, a tool for building software (and other files). SCons is @@ -56,7 +56,7 @@ provided Python-standard setup script as follows: By default, the above command will do the following: - -- Install the version-numbered "scons-__VERSION__" and "sconsign-__VERSION__" + -- Install the version-numbered "scons-3.0.3" and "sconsign-3.0.3" scripts in the default system script directory (/usr/bin or C:\Python*\Scripts, for example). This can be disabled by specifying the "--no-version-script" option on the command @@ -70,17 +70,17 @@ By default, the above command will do the following: making it the default on your system. On UNIX or Linux systems, you can have the "scons" and "sconsign" - scripts be hard links or symbolic links to the "scons-__VERSION__" and - "sconsign-__VERSION__" scripts by specifying the "--hardlink-scons" + scripts be hard links or symbolic links to the "scons-3.0.3" and + "sconsign-3.0.3" scripts by specifying the "--hardlink-scons" or "--symlink-scons" options on the command line. - -- Install "scons-__VERSION__.bat" and "scons.bat" wrapper scripts in the + -- Install "scons-3.0.3.bat" and "scons.bat" wrapper scripts in the Python prefix directory on Windows (C:\Python*, for example). This can be disabled by specifying the "--no-install-bat" option on the command line. On UNIX or Linux systems, the "--install-bat" option may be - specified to have "scons-__VERSION__.bat" and "scons.bat" files + specified to have "scons-3.0.3.bat" and "scons.bat" files installed in the default system script directory, which is useful if you want to install SCons in a shared file system directory that can be used to execute SCons from both UNIX/Linux and @@ -88,7 +88,7 @@ By default, the above command will do the following: -- Install the SCons build engine (a Python module) in an appropriate version-numbered SCons library directory - (/usr/lib/scons-__VERSION__ or C:\Python*\scons-__VERSION__, for example). + (/usr/lib/scons-3.0.3 or C:\Python*\scons-3.0.3, for example). See below for more options related to installing the build engine library. @@ -246,4 +246,4 @@ many contributors, including but not at all limited to: \... and many others. -Copyright (c) 2001 - 2015 The SCons Foundation +Copyright (c) 2001 - 2019 The SCons Foundation -- cgit v0.12 From d93d777d1feee8bc155da9cd488b3461b7da3ae1 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 5 Jan 2019 17:15:14 -0800 Subject: Fix version strings to be 3.0.3 --- src/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/setup.py b/src/setup.py index d189dfc..cfa362b 100755 --- a/src/setup.py +++ b/src/setup.py @@ -325,7 +325,7 @@ class install_scripts(_install_scripts): base = os.path.basename(src) scons = os.path.join(self.install_dir, base) scons_ver = scons + '-' + Version - if sys.platform == "win32": + if is_win32:: scons = scons + '.py' scons_ver = scons_ver + '.py' create_version_script(src, scons_ver) @@ -414,8 +414,8 @@ arguments = { 'version': Version, 'description': description, 'long_description': long_description, - 'author': 'Steven Knight', - 'author_email': 'knight@baldmt.com', + 'author': 'William Deegan', + 'author_email': 'bill@baddogconsulting.com', 'url': "http://www.scons.org/", 'packages': ["SCons", "SCons.compat", -- cgit v0.12 From 3efb7c2a611d1cf9dea74817bcb015dde4e744bc Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 6 Jan 2019 12:48:51 -0800 Subject: Fix typo --- src/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup.py b/src/setup.py index cfa362b..3e5413d 100755 --- a/src/setup.py +++ b/src/setup.py @@ -325,7 +325,7 @@ class install_scripts(_install_scripts): base = os.path.basename(src) scons = os.path.join(self.install_dir, base) scons_ver = scons + '-' + Version - if is_win32:: + if is_win32: scons = scons + '.py' scons_ver = scons_ver + '.py' create_version_script(src, scons_ver) -- cgit v0.12 From 13b03bc29abb128096b404d44fc3b57f1fcf2e24 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 6 Jan 2019 12:49:15 -0800 Subject: Add clangCommon to MANIFEST.in so it get's packaged --- src/engine/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 4a9f240..cf307f4 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -65,6 +65,7 @@ SCons/Tool/c++.py SCons/Tool/cxx.py SCons/Tool/cc.py SCons/Tool/cyglink.py +SCons/Tool/clangCommon/__init__.py SCons/Tool/clang.py SCons/Tool/clangxx.py SCons/Tool/cvf.py -- cgit v0.12 From 0ea03df3fc070363a927cad37cc58ca62d1312b0 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 6 Jan 2019 13:33:36 -0800 Subject: add clangCommon to packaging --- src/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/setup.py b/src/setup.py index 3e5413d..ef2e5e2 100755 --- a/src/setup.py +++ b/src/setup.py @@ -424,6 +424,7 @@ arguments = { "SCons.Scanner", "SCons.Script", "SCons.Tool", + "SCons.Tool.clangCommon", "SCons.Tool.docbook", "SCons.Tool.MSCommon", "SCons.Tool.packaging", -- cgit v0.12 From ba753f0ee5f92c215aab62afa598060141aebdff Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 11:26:37 -0500 Subject: Adding docbooks xsl files and clangCommong --- src/engine/MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 4a9f240..7456824 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -65,6 +65,7 @@ SCons/Tool/c++.py SCons/Tool/cxx.py SCons/Tool/cc.py SCons/Tool/cyglink.py +SCons/Tool/clangCommon/__init__.py SCons/Tool/clang.py SCons/Tool/clangxx.py SCons/Tool/cvf.py @@ -178,3 +179,5 @@ SCons/Tool/msgfmt.py SCons/Tool/msginit.py SCons/Tool/msgmerge.py SCons/Tool/xgettext.py +SCons/Tool/docbook/docbook-xsl-1.76.1/** +SCons/Tool/docbook/utils/** -- cgit v0.12 From 35170015889281f21653acfc8c99e5040246b97c Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 11:26:54 -0500 Subject: Add clangCommon --- src/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/setup.py b/src/setup.py index d189dfc..99700b8 100755 --- a/src/setup.py +++ b/src/setup.py @@ -425,6 +425,7 @@ arguments = { "SCons.Script", "SCons.Tool", "SCons.Tool.docbook", + 'SCons.Tool.clangCommon', "SCons.Tool.MSCommon", "SCons.Tool.packaging", "SCons.Variables", -- cgit v0.12 From 48378d8af7ce77e60138f33bf6e572db5942ceab Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 11:27:59 -0500 Subject: Remove src/engine/MANIFEST-xml.in and logic which refers to it. Can't see why we had a seperate manifest for just the xml files which were then not included in the package, making docbook builders not work --- bootstrap.py | 7 ++----- src/engine/MANIFEST-xml.in | 8 -------- 2 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 src/engine/MANIFEST-xml.in diff --git a/bootstrap.py b/bootstrap.py index 7a4dc91..ea7e0c8 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -178,15 +178,11 @@ def main(): scons_py = os.path.join('src', 'script', 'scons.py') src_engine = os.path.join('src', 'engine') MANIFEST_in = find(os.path.join(src_engine, 'MANIFEST.in')) - MANIFEST_xml_in = find(os.path.join(src_engine, 'MANIFEST-xml.in')) manifest_files = [os.path.join(src_engine, x) for x in parseManifestLines(os.path.join(script_dir, src_engine), open(MANIFEST_in).readlines())] - manifest_xml_files = [os.path.join(src_engine, x) - for x in parseManifestLines(os.path.join(script_dir, src_engine), - open(MANIFEST_xml_in).readlines())] - files = [scons_py] + manifest_files + manifest_xml_files + files = [scons_py] + manifest_files for filename in files: src = find(filename) @@ -214,6 +210,7 @@ def main(): sys.exit(subprocess.Popen(args, env=os.environ).wait()) + if __name__ == "__main__": main() diff --git a/src/engine/MANIFEST-xml.in b/src/engine/MANIFEST-xml.in deleted file mode 100644 index cfbfd3a..0000000 --- a/src/engine/MANIFEST-xml.in +++ /dev/null @@ -1,8 +0,0 @@ -SCons/*.xml -SCons/Platform/*.xml -SCons/Scanner/__init__.xml -SCons/Script/*.xml -SCons/Tool/*.xml -SCons/Tool/docbook/__init__.xml -SCons/Tool/docbook/utils/xmldepend.xsl -SCons/Tool/packaging/__init__.xml -- cgit v0.12 From 8f579b127e277e5b6a99ab26769dfad7783aa772 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 11:29:49 -0500 Subject: update CHANGES.txt --- src/CHANGES.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 288f97c..071bd59 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,13 +5,14 @@ Change Log -RELEASE 3.0.3 - Mon, 05 Jan 2019 20:05:22 -0400 +RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. From William Deegan: - - Fixes to packaging logic. + - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module and the docbook xsl files are added + to the packages. From Mats Wichmann: - Update some doc examples for Py3: map() now returns an interable -- cgit v0.12 From 0e20ef9c3a8737bb1bcdceba8ce9d766cd41d5bd Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 08:44:43 -0800 Subject: Updated docs for 3.0.3 Release --- doc/generated/examples/caching_ex-random_1.xml | 6 +++--- doc/generated/examples/troubleshoot_Dump_2.xml | 2 +- doc/generated/examples/troubleshoot_explain1_3.xml | 2 +- doc/generated/variables.gen | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/generated/examples/caching_ex-random_1.xml b/doc/generated/examples/caching_ex-random_1.xml index 667ab4b..c821b48 100644 --- a/doc/generated/examples/caching_ex-random_1.xml +++ b/doc/generated/examples/caching_ex-random_1.xml @@ -1,9 +1,9 @@ % scons -Q -cc -o f1.o -c f1.c -cc -o f4.o -c f4.c -cc -o f2.o -c f2.c cc -o f3.o -c f3.c +cc -o f4.o -c f4.c +cc -o f1.o -c f1.c cc -o f5.o -c f5.c +cc -o f2.o -c f2.c cc -o prog f1.o f2.o f3.o f4.o f5.o diff --git a/doc/generated/examples/troubleshoot_Dump_2.xml b/doc/generated/examples/troubleshoot_Dump_2.xml index 08c6f04..a621422 100644 --- a/doc/generated/examples/troubleshoot_Dump_2.xml +++ b/doc/generated/examples/troubleshoot_Dump_2.xml @@ -79,7 +79,7 @@ scons: Reading SConscript files ... 'SHCXX': '$CXX', 'SHCXXCOM': '${TEMPFILE("$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM","$SHCXXCOMSTR")}', 'SHCXXFLAGS': ['$CXXFLAGS'], - 'SHELL': 'command', + 'SHELL': None, 'SHLIBPREFIX': '', 'SHLIBSUFFIX': '.dll', 'SHOBJPREFIX': '$OBJPREFIX', diff --git a/doc/generated/examples/troubleshoot_explain1_3.xml b/doc/generated/examples/troubleshoot_explain1_3.xml index ed8f6d9..a60ed80 100644 --- a/doc/generated/examples/troubleshoot_explain1_3.xml +++ b/doc/generated/examples/troubleshoot_explain1_3.xml @@ -3,5 +3,5 @@ cp file.in file.oout scons: warning: Cannot find target file.out after building -File "/Users/bdbaddog/devel/scons/git/as_scons/src/script/scons.py", line 204, in <module> +File "/home/bdbaddog/scons/git/as_scons/src/script/scons.py", line 204, in <module> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 436f14e..5ed8c2f 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -3298,7 +3298,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3308,7 +3308,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. -- cgit v0.12 From 0fb914855c31d064070bc76278a95e67f60b8b67 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 08:45:52 -0800 Subject: Fix date for 3.0.3 in debian/changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e906075..7ef3a14 100755 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ scons (3.0.3) unstable; urgency=low * Maintenance Release - -- William Deegan Sat, 02 Jan 2018 19:44:18 -0700 + -- William Deegan Sat, 07 Jan 2018 19:44:18 -0700 scons (3.0.2) unstable; urgency=low -- cgit v0.12 From 1cc11c66b38e34df8609526e210cf68efee406e2 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 16:46:22 +0000 Subject: Updates for Ubuntu 18.04 LTS build machine --- bin/scons_dev_master.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/scons_dev_master.py b/bin/scons_dev_master.py index 4fa5899..4b1160f 100644 --- a/bin/scons_dev_master.py +++ b/bin/scons_dev_master.py @@ -42,6 +42,7 @@ BUILDING_PACKAGES = [ 'python-epydoc', 'rpm', 'tar', + 'lynx' # additional packages that Bill Deegan's web page suggests #'docbook-to-man', @@ -70,11 +71,12 @@ TESTING_PACKAGES = [ 'bison', 'cssc', 'cvs', - 'hg', 'flex', 'g++', 'gcc', - 'gcj', + # not on ubuntu 18.04 + # 'gcj', + # 'hg', 'ghostscript', 'm4', 'openssh-client', -- cgit v0.12 From adb58640b798f8953611238e2d084c780826e774 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 17:02:36 +0000 Subject: Update EnsureSConsVersion test expected fail version check from version 3 to version 4 --- test/EnsureSConsVersion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EnsureSConsVersion.py b/test/EnsureSConsVersion.py index b31abfe..66543a3 100644 --- a/test/EnsureSConsVersion.py +++ b/test/EnsureSConsVersion.py @@ -50,7 +50,7 @@ Exit(0) test.write('SConstruct', """\ env = Environment() -env.EnsureSConsVersion(3,0) +env.EnsureSConsVersion(4,0) Exit(0) """) -- cgit v0.12 From 92fa2386ebcbcb1788c204a08f4e31130474dfc1 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 09:16:08 -0800 Subject: Update copyright date to 2019 --- ReleaseConfig | 2 +- SConstruct | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ReleaseConfig b/ReleaseConfig index 7ff6087..b5954df 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -51,7 +51,7 @@ deprecated_python_version = (2, 7, 0) #month_year = 'December 2012' # If copyright years is not given, the release year is used as the end. -copyright_years = '2001 - 2018' +copyright_years = '2001 - 2019' # Local Variables: # tab-width:4 diff --git a/SConstruct b/SConstruct index 22caa1d..a7eca26 100644 --- a/SConstruct +++ b/SConstruct @@ -5,7 +5,7 @@ from __future__ import print_function -copyright_years = '2001 - 2018' +copyright_years = '2001 - 2019' # This gets inserted into the man pages to reflect the month of release. month_year = 'January 2019' -- cgit v0.12 From 2393a1992549e05c45359fc8e9cfd0405f79f3a8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 21:57:10 -0500 Subject: Update scons.bat to first look for scons.py and then scons so that a universal python wheel can work on windows --- src/CHANGES.txt | 9 +++++---- src/engine/MANIFEST.in | 4 ++-- src/script/scons.bat | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 071bd59..231badb 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,12 +11,13 @@ RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 From William Deegan: - - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module and the docbook xsl files are added - to the packages. + - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added + to the release packages. + - Modify scons.bat script to check for scons python script without .py extension if no file + scons.py exists. This enables an all platform wheel to work. From Mats Wichmann: - - Update some doc examples for Py3: map() now returns an interable - instead of a list. + - Update doc examples to work with Python 3.5+: map() now returns an iterable instead of a list. RELEASE 3.0.2 - Mon, 31 Dec 2018 16:00:12 -0700 diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 7456824..39aba6c 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -179,5 +179,5 @@ SCons/Tool/msgfmt.py SCons/Tool/msginit.py SCons/Tool/msgmerge.py SCons/Tool/xgettext.py -SCons/Tool/docbook/docbook-xsl-1.76.1/** -SCons/Tool/docbook/utils/** +#SCons/Tool/docbook/docbook-xsl-1.76.1/** +#SCons/Tool/docbook/utils/** diff --git a/src/script/scons.bat b/src/script/scons.bat index a9e777e..10b8637 100644 --- a/src/script/scons.bat +++ b/src/script/scons.bat @@ -22,6 +22,8 @@ popd @REM try the script named as the .bat file in current dir, then in Scripts subdir set scriptname=%~dp0%~n0.py if not exist "%scriptname%" set scriptname=%~dp0Scripts\%~n0.py +@REM Handle when running from wheel where the script has no .py extension +if not exist "%scriptname%" set scriptname=%~dp0%~n0 python "%scriptname%" %* endlocal & set SCONS_ERRORLEVEL=%ERRORLEVEL% -- cgit v0.12 From c06fc3c33f2dded14e4c1328353b986cd8b2ca9a Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 22:23:59 -0500 Subject: Fix datestamp for release --- src/Announce.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Announce.txt b/src/Announce.txt index b4d50f1..9e9c16b 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE 3.0.3 - Mon, 05 Jan 2019 20:05:22 -0400 +RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes -- cgit v0.12 From d6590f200c9b230fee93853f957e3390d377496b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Jan 2019 22:26:58 -0500 Subject: Update release with commit info --- src/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 3cc5b6c..2355f47 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -59,7 +59,7 @@ Contributors are listed alphabetically by their last name. git shortlog --no-merges -ns 3.0.1..HEAD - 235 William Deegan + 254 William Deegan 79 Daniel Moody 73 Mats Wichmann 17 Paweł Tomulik -- cgit v0.12 From a714a848fd6935c305c553347355887c71c0ffdf Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Jan 2019 20:32:07 -0600 Subject: use the vcvars batch script to find installed vc's --- src/engine/SCons/Tool/MSCommon/vc.py | 19 +++++++++---------- src/engine/SCons/Tool/midl.py | 2 +- src/engine/SCons/Tool/mslib.py | 2 +- src/engine/SCons/Tool/mslink.py | 2 +- src/engine/SCons/Tool/msvc.py | 2 +- src/engine/SCons/Tool/msvs.py | 2 +- test/AS/ASFLAGS.py | 2 +- test/AS/ASPPFLAGS.py | 2 +- test/CC/CCFLAGS.py | 2 +- test/CC/CFLAGS.py | 2 +- test/LINK/SHLINKCOMSTR.py | 2 +- test/Libs/LIBPREFIXES.py | 2 +- test/Libs/LIBS.py | 6 ++++-- test/Libs/LIBSUFFIXES.py | 6 +++--- test/Libs/SharedLibraryIxes.py | 2 +- test/long-lines/live.py | 2 +- test/sconsign/script/dblite.py | 2 +- testing/framework/TestSCons.py | 2 +- 18 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 32ee96f..d3686b0 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -344,16 +344,16 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None -def cached_get_installed_vcs(): +def cached_get_installed_vcs(env): global __INSTALLED_VCS_RUN if __INSTALLED_VCS_RUN is None: - ret = get_installed_vcs() + ret = get_installed_vcs(env) __INSTALLED_VCS_RUN = ret return __INSTALLED_VCS_RUN -def get_installed_vcs(): +def get_installed_vcs(env): installed_versions = [] for ver in _VCVER: debug('trying to find VC %s' % ver) @@ -362,11 +362,10 @@ def get_installed_vcs(): if VC_DIR: debug('found VC %s' % ver) # check to see if the x86 or 64 bit compiler is in the bin dir - if (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) - or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe'))): + if msvc_find_valid_batch_script(env,ver): installed_versions.append(ver) else: - debug('find_vc_pdir no cl.exe found %s' % ver) + debug('find_vc_pdir no vcvars script found %s' % ver) else: debug('find_vc_pdir return None for ver %s' % ver) except VisualCException as e: @@ -423,7 +422,7 @@ def get_default_version(env): % (msvc_version, msvs_version)) return msvs_version if not msvc_version: - installed_vcs = cached_get_installed_vcs() + installed_vcs = cached_get_installed_vcs(env) debug('installed_vcs:%s' % installed_vcs) if not installed_vcs: #msg = 'No installed VCs' @@ -500,7 +499,7 @@ def msvc_find_valid_batch_script(env,version): warn_msg = "VC version %s not installed. " + \ "C/C++ compilers are most likely not set correctly.\n" + \ " Installed versions are: %s" - warn_msg = warn_msg % (version, cached_get_installed_vcs()) + warn_msg = warn_msg % (version, cached_get_installed_vcs(env)) SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) continue @@ -579,8 +578,8 @@ def msvc_setup_env(env): SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") -def msvc_exists(version=None): - vcs = cached_get_installed_vcs() +def msvc_exists(env, version=None): + vcs = cached_get_installed_vcs(env) if version is None: return len(vcs) > 0 return version in vcs diff --git a/src/engine/SCons/Tool/midl.py b/src/engine/SCons/Tool/midl.py index ed9ea94..2757c34 100644 --- a/src/engine/SCons/Tool/midl.py +++ b/src/engine/SCons/Tool/midl.py @@ -79,7 +79,7 @@ def generate(env): env['BUILDERS']['TypeLibrary'] = midl_builder def exists(env): - return msvc_exists() + return msvc_exists(env) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/mslib.py b/src/engine/SCons/Tool/mslib.py index c5a7a32..c901a75 100644 --- a/src/engine/SCons/Tool/mslib.py +++ b/src/engine/SCons/Tool/mslib.py @@ -55,7 +55,7 @@ def generate(env): env['LIBSUFFIX'] = '.lib' def exists(env): - return msvc_exists() + return msvc_exists(env) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 55cf33f..c8b00d2 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -328,7 +328,7 @@ def generate(env): env['LDMODULECOM'] = compositeLdmodAction def exists(env): - return msvc_exists() + return msvc_exists(env) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 1412cf7..9f3c1fa 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -289,7 +289,7 @@ def generate(env): env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root() def exists(env): - return msvc_exists() + return msvc_exists(env) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 62f27f2..4b73a3b 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -1990,7 +1990,7 @@ def generate(env): env['SCONS_HOME'] = os.environ.get('SCONS_HOME') def exists(env): - return msvc_exists() + return msvc_exists(env) # Local Variables: # tab-width:4 diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py index 79fde8c..b72d32d 100644 --- a/test/AS/ASFLAGS.py +++ b/test/AS/ASFLAGS.py @@ -42,7 +42,7 @@ o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(): + if msc.msvc_exists(test.Environment()): o_c = ' -x' test.write('SConstruct', """ diff --git a/test/AS/ASPPFLAGS.py b/test/AS/ASPPFLAGS.py index 254a458..d548eaa 100644 --- a/test/AS/ASPPFLAGS.py +++ b/test/AS/ASPPFLAGS.py @@ -42,7 +42,7 @@ o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(): + if msc.msvc_exists(test.Environment()): o_c = ' -x' test.write('SConstruct', """ diff --git a/test/CC/CCFLAGS.py b/test/CC/CCFLAGS.py index 069b429..967f865 100644 --- a/test/CC/CCFLAGS.py +++ b/test/CC/CCFLAGS.py @@ -32,7 +32,7 @@ _obj = TestSCons._obj if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): fooflags = '-DFOO' barflags = '-DBAR' else: diff --git a/test/CC/CFLAGS.py b/test/CC/CFLAGS.py index 590d6b5..6d0ee39 100644 --- a/test/CC/CFLAGS.py +++ b/test/CC/CFLAGS.py @@ -47,7 +47,7 @@ _obj = TestSCons._obj if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): fooflags = '-DFOO' barflags = '-DBAR' else: diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py index 4dd5c7c..bf419e5 100644 --- a/test/LINK/SHLINKCOMSTR.py +++ b/test/LINK/SHLINKCOMSTR.py @@ -73,7 +73,7 @@ test.must_match('test3.dll', "test1.c\ntest2.c\n") if sys.platform == "win32": import SCons.Tool.MSCommon as msc - if msc.msvc_exists(): + if msc.msvc_exists(test.Environment()): # Now test an actual compile and link. Since MS Windows # resets the link actions, this could fail even if the above # test passed. diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py index aed451e..b9621a1 100644 --- a/test/Libs/LIBPREFIXES.py +++ b/test/Libs/LIBPREFIXES.py @@ -31,7 +31,7 @@ import TestSCons if sys.platform == 'win32': _lib = '.lib' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): _lib = '.a' else: _lib = '.a' diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py index 5639228..0798475 100644 --- a/test/Libs/LIBS.py +++ b/test/Libs/LIBS.py @@ -27,17 +27,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons import sys +test = TestSCons.TestSCons() + if sys.platform == 'win32': _exe = '.exe' bar_lib = 'bar.lib' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): bar_lib = 'libbar.a' else: _exe = '' bar_lib = 'libbar.a' -test = TestSCons.TestSCons() + test.subdir('sub1', 'sub2') diff --git a/test/Libs/LIBSUFFIXES.py b/test/Libs/LIBSUFFIXES.py index 13baeab..030e601 100644 --- a/test/Libs/LIBSUFFIXES.py +++ b/test/Libs/LIBSUFFIXES.py @@ -28,16 +28,16 @@ import os import sys import TestSCons +test = TestSCons.TestSCons() + if sys.platform == 'win32': lib_ = '' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): lib_ = 'lib' else: lib_ = 'lib' -test = TestSCons.TestSCons() - test.write('SConstruct', """ env = Environment(LIBSUFFIX = '.xxx', LIBSUFFIXES = ['.xxx']) diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py index 93d67ea..2a58026 100644 --- a/test/Libs/SharedLibraryIxes.py +++ b/test/Libs/SharedLibraryIxes.py @@ -42,7 +42,7 @@ isWindows = sys.platform == 'win32' isMingw = False if isWindows: import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): # We can't seem to find any MSVC version, so we assume # that MinGW is installed instead. Accordingly, we use the # standard gcc/g++ conventions for lib prefixes and suffixes diff --git a/test/long-lines/live.py b/test/long-lines/live.py index 5618f55..8540cd7 100644 --- a/test/long-lines/live.py +++ b/test/long-lines/live.py @@ -43,7 +43,7 @@ if sys.platform == 'win32': linkflag_init = '/LIBPATH:' + test.workpath() linkflag = ' /LIBPATH:' + test.workpath() import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(test.Environment()): lib_shared_dll = 'shared.dll' lib_static_lib = 'libstatic.a' arflag_init = 'r' diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py index 0daf8bf..36718f1 100644 --- a/test/sconsign/script/dblite.py +++ b/test/sconsign/script/dblite.py @@ -114,7 +114,7 @@ date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(): + if msc.msvc_exists(test.Environment()): manifest = r""" embedManifestExeCheck\(target, source, env\)""" else: diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index b543c07..01002c5 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -1072,7 +1072,7 @@ SConscript( sconscript ) try: import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): + if not msc.msvc_exists(self.Environment()): msg = "No MSVC toolchain found...skipping test\n" self.skip_test(msg) except: -- cgit v0.12 From 8324cd2772fafb6f2268db22bcb026cbda2689f8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Jan 2019 21:22:58 -0600 Subject: leave old version to check if cl exists --- src/engine/SCons/Tool/MSCommon/vc.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index d3686b0..c79f393 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -99,6 +99,9 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "ia64"): "x86_ia64" } +def get_msvc_version_numeric(msvc_version): + return ''.join([x for x in msvc_version if x in string_digits + '.']) + def get_host_target(env): debug('vc.py:get_host_target()') @@ -189,7 +192,7 @@ _VCVER_TO_PRODUCT_DIR = { } def msvc_version_to_maj_min(msvc_version): - msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) + msvc_version_numeric = get_msvc_version_numeric(msvc_version) t = msvc_version_numeric.split(".") if not len(t) == 2: @@ -312,7 +315,7 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): debug('vc.py: find_batch_file() pdir:{}'.format(pdir)) # filter out e.g. "Exp" from the version name - msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."]) + msvc_ver_numeric = get_msvc_version_numeric(msvc_version) vernum = float(msvc_ver_numeric) if 7 <= vernum < 8: pdir = os.path.join(pdir, os.pardir, "Common7", "Tools") @@ -361,11 +364,16 @@ def get_installed_vcs(env): VC_DIR = find_vc_pdir(ver) if VC_DIR: debug('found VC %s' % ver) + ver_num = float(get_msvc_version_numeric(ver)) # check to see if the x86 or 64 bit compiler is in the bin dir - if msvc_find_valid_batch_script(env,ver): + if (ver_num > 14 and msvc_find_valid_batch_script(env,ver)): + installed_versions.append(ver) + elif (ver_num <= 14 + and (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) + or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe')))): installed_versions.append(ver) else: - debug('find_vc_pdir no vcvars script found %s' % ver) + debug('find_vc_pdir no compiler found %s' % ver) else: debug('find_vc_pdir return None for ver %s' % ver) except VisualCException as e: -- cgit v0.12 From dd4065f88fb4e00c83adb7d4b521636c8e33f779 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Jan 2019 21:28:03 -0600 Subject: make sure not to modify environment if just checking --- src/engine/SCons/Tool/MSCommon/vc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c79f393..cf776fc 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -366,7 +366,7 @@ def get_installed_vcs(env): debug('found VC %s' % ver) ver_num = float(get_msvc_version_numeric(ver)) # check to see if the x86 or 64 bit compiler is in the bin dir - if (ver_num > 14 and msvc_find_valid_batch_script(env,ver)): + if (ver_num > 14 and msvc_find_valid_batch_script(env,ver,False)): installed_versions.append(ver) elif (ver_num <= 14 and (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) @@ -453,7 +453,7 @@ def msvc_setup_env_once(env): msvc_setup_env(env) env["MSVC_SETUP_RUN"] = True -def msvc_find_valid_batch_script(env,version): +def msvc_find_valid_batch_script(env,version,modify_env=True): debug('vc.py:msvc_find_valid_batch_script()') # Find the host platform, target platform, and if present the requested # target platform @@ -479,7 +479,8 @@ def msvc_find_valid_batch_script(env,version): d = None for tp in try_target_archs: # Set to current arch. - env['TARGET_ARCH']=tp + if modify_env: + env['TARGET_ARCH']=tp debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp) host_target = (host_platform, tp) @@ -536,7 +537,7 @@ def msvc_find_valid_batch_script(env,version): # If we cannot find a viable installed compiler, reset the TARGET_ARCH # To it's initial value - if not d: + if not d and modify_env: env['TARGET_ARCH']=req_target_platform return d -- cgit v0.12 From 360065d5b2bfa600c7a3ed20fea6dc494bd92a6d Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 9 Jan 2019 08:40:36 -0600 Subject: updated to use the target arch --- src/engine/SCons/Tool/MSCommon/vc.py | 67 ++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index cf776fc..7a481a6 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -347,6 +347,65 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None +def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): + ver_num = float(get_msvc_version_numeric(msvc_version)) + found_cl = False + (host_platform, target_platform,req_target_platform) = get_host_target(env) + + # check to see if the x86 or 64 bit compiler is in the bin dir + if ver_num > 14: + try: + f = open(os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')) + vc_specific_version = f.readlines()[0].strip() + except: + return False + + if host_platform in ('amd64','x86_64'): + host_dir = "Hostx64" + elif host_platform in ('i386','i686','x86'): + host_dir = "Hostx86" + else: + return False + + if target_platform in ('amd64','x86_64'): + target_dir = "x64" + elif target_platform in ('i386','i686','x86'): + target_dir = "x86" + else: + return False + + if os.path.exists(os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe')): + return True + elif ver_num <= 14: + if host_platform in ('amd64','x86_64'): + host_dir = "amd64" + elif host_platform in ('i386','i686','x86'): + host_dir = "x86" + else: + return False + + + if target_platform in ('amd64','x86_64'): + target_dir = "amd64" + elif target_platform in ('i386','i686','x86'): + target_dir = "x86" + elif target_platform in ('ia64'): + target_dir = "ia64" + else: + return False + + host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_dir, target_dir)] + if host_target_dir == 'x86': + host_target_dir == '' + else: + host_target_dir += '\\' + cl_dir = 'bin\\' + host_target_dir + 'cl.exe' + print(os.path.join(vc_dir, cl_dir)) + if os.path.exists(os.path.join(vc_dir, cl_dir)): + return True + return False + + def cached_get_installed_vcs(env): global __INSTALLED_VCS_RUN @@ -364,13 +423,7 @@ def get_installed_vcs(env): VC_DIR = find_vc_pdir(ver) if VC_DIR: debug('found VC %s' % ver) - ver_num = float(get_msvc_version_numeric(ver)) - # check to see if the x86 or 64 bit compiler is in the bin dir - if (ver_num > 14 and msvc_find_valid_batch_script(env,ver,False)): - installed_versions.append(ver) - elif (ver_num <= 14 - and (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) - or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe')))): + if _check_cl_exists_in_vc_dir(env, VC_DIR, ver): installed_versions.append(ver) else: debug('find_vc_pdir no compiler found %s' % ver) -- cgit v0.12 From a17c87b1b644acb37270d2282743d471c2aae549 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 9 Jan 2019 08:40:36 -0600 Subject: updated to use the target arch removed debug print --- src/engine/SCons/Tool/MSCommon/vc.py | 66 ++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index cf776fc..fccab88 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -347,6 +347,64 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None +def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): + ver_num = float(get_msvc_version_numeric(msvc_version)) + found_cl = False + (host_platform, target_platform,req_target_platform) = get_host_target(env) + + # check to see if the x86 or 64 bit compiler is in the bin dir + if ver_num > 14: + try: + f = open(os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')) + vc_specific_version = f.readlines()[0].strip() + except: + return False + + if host_platform in ('amd64','x86_64'): + host_dir = "Hostx64" + elif host_platform in ('i386','i686','x86'): + host_dir = "Hostx86" + else: + return False + + if target_platform in ('amd64','x86_64'): + target_dir = "x64" + elif target_platform in ('i386','i686','x86'): + target_dir = "x86" + else: + return False + + if os.path.exists(os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe')): + return True + elif ver_num <= 14: + if host_platform in ('amd64','x86_64'): + host_dir = "amd64" + elif host_platform in ('i386','i686','x86'): + host_dir = "x86" + else: + return False + + + if target_platform in ('amd64','x86_64'): + target_dir = "amd64" + elif target_platform in ('i386','i686','x86'): + target_dir = "x86" + elif target_platform in ('ia64'): + target_dir = "ia64" + else: + return False + + host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_dir, target_dir)] + if host_target_dir == 'x86': + host_target_dir == '' + else: + host_target_dir += '\\' + cl_dir = 'bin\\' + host_target_dir + 'cl.exe' + if os.path.exists(os.path.join(vc_dir, cl_dir)): + return True + return False + + def cached_get_installed_vcs(env): global __INSTALLED_VCS_RUN @@ -364,13 +422,7 @@ def get_installed_vcs(env): VC_DIR = find_vc_pdir(ver) if VC_DIR: debug('found VC %s' % ver) - ver_num = float(get_msvc_version_numeric(ver)) - # check to see if the x86 or 64 bit compiler is in the bin dir - if (ver_num > 14 and msvc_find_valid_batch_script(env,ver,False)): - installed_versions.append(ver) - elif (ver_num <= 14 - and (os.path.exists(os.path.join(VC_DIR, r'bin\cl.exe')) - or os.path.exists(os.path.join(VC_DIR, r'bin\amd64\cl.exe')))): + if _check_cl_exists_in_vc_dir(env, VC_DIR, ver): installed_versions.append(ver) else: debug('find_vc_pdir no compiler found %s' % ver) -- cgit v0.12 From 39bdae14fbee3f7c724ec64b38f117849cbebeda Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Wed, 9 Jan 2019 10:07:21 -0600 Subject: added ability to get vc dir without env (assume host == target) and fixed test --- src/engine/SCons/Tool/MSCommon/vc.py | 10 +++++++--- test/CC/CCFLAGS.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index fccab88..168add5 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -350,8 +350,12 @@ __INSTALLED_VCS_RUN = None def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): ver_num = float(get_msvc_version_numeric(msvc_version)) found_cl = False - (host_platform, target_platform,req_target_platform) = get_host_target(env) - + if env: + (host_platform, target_platform,req_target_platform) = get_host_target(env) + else: + host_platform = platform.machine().lower() + target_platform = host_platform + # check to see if the x86 or 64 bit compiler is in the bin dir if ver_num > 14: try: @@ -414,7 +418,7 @@ def cached_get_installed_vcs(env): return __INSTALLED_VCS_RUN -def get_installed_vcs(env): +def get_installed_vcs(env=None): installed_versions = [] for ver in _VCVER: debug('trying to find VC %s' % ver) diff --git a/test/CC/CCFLAGS.py b/test/CC/CCFLAGS.py index 967f865..a9db61f 100644 --- a/test/CC/CCFLAGS.py +++ b/test/CC/CCFLAGS.py @@ -29,6 +29,8 @@ import TestSCons _obj = TestSCons._obj +test = TestSCons.TestSCons() + if sys.platform == 'win32': import SCons.Tool.MSCommon as msc @@ -42,8 +44,6 @@ else: fooflags = '-DFOO' barflags = '-DBAR' -test = TestSCons.TestSCons() - test.write('SConstruct', """ foo = Environment(CCFLAGS = '%s') bar = Environment(CCFLAGS = '%s') -- cgit v0.12 From f8de931ad51d8f81770c47c7ba6259eccaee0503 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Wed, 9 Jan 2019 10:20:17 -0600 Subject: reverted tests so they can use a default host == target platform for find msvc fixed some other tests --- src/engine/SCons/Tool/MSCommon/vc.py | 4 ++-- test/AS/ASFLAGS.py | 2 +- test/AS/ASPPFLAGS.py | 2 +- test/CC/CCFLAGS.py | 6 +++--- test/CC/CFLAGS.py | 2 +- test/LINK/SHLINKCOMSTR.py | 2 +- test/Libs/LIBPREFIXES.py | 2 +- test/Libs/LIBS.py | 6 ++---- test/Libs/LIBSUFFIXES.py | 6 +++--- test/Libs/SharedLibraryIxes.py | 2 +- test/long-lines/live.py | 2 +- test/sconsign/script/dblite.py | 2 +- testing/framework/TestSCons.py | 2 +- 13 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 168add5..ad921ef 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -409,7 +409,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): return False -def cached_get_installed_vcs(env): +def cached_get_installed_vcs(env=None): global __INSTALLED_VCS_RUN if __INSTALLED_VCS_RUN is None: @@ -643,7 +643,7 @@ def msvc_setup_env(env): SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") -def msvc_exists(env, version=None): +def msvc_exists(env=None, version=None): vcs = cached_get_installed_vcs(env) if version is None: return len(vcs) > 0 diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py index b72d32d..79fde8c 100644 --- a/test/AS/ASFLAGS.py +++ b/test/AS/ASFLAGS.py @@ -42,7 +42,7 @@ o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(test.Environment()): + if msc.msvc_exists(): o_c = ' -x' test.write('SConstruct', """ diff --git a/test/AS/ASPPFLAGS.py b/test/AS/ASPPFLAGS.py index d548eaa..254a458 100644 --- a/test/AS/ASPPFLAGS.py +++ b/test/AS/ASPPFLAGS.py @@ -42,7 +42,7 @@ o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(test.Environment()): + if msc.msvc_exists(): o_c = ' -x' test.write('SConstruct', """ diff --git a/test/CC/CCFLAGS.py b/test/CC/CCFLAGS.py index a9db61f..069b429 100644 --- a/test/CC/CCFLAGS.py +++ b/test/CC/CCFLAGS.py @@ -29,12 +29,10 @@ import TestSCons _obj = TestSCons._obj -test = TestSCons.TestSCons() - if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): fooflags = '-DFOO' barflags = '-DBAR' else: @@ -44,6 +42,8 @@ else: fooflags = '-DFOO' barflags = '-DBAR' +test = TestSCons.TestSCons() + test.write('SConstruct', """ foo = Environment(CCFLAGS = '%s') bar = Environment(CCFLAGS = '%s') diff --git a/test/CC/CFLAGS.py b/test/CC/CFLAGS.py index 6d0ee39..590d6b5 100644 --- a/test/CC/CFLAGS.py +++ b/test/CC/CFLAGS.py @@ -47,7 +47,7 @@ _obj = TestSCons._obj if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): fooflags = '-DFOO' barflags = '-DBAR' else: diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py index bf419e5..4dd5c7c 100644 --- a/test/LINK/SHLINKCOMSTR.py +++ b/test/LINK/SHLINKCOMSTR.py @@ -73,7 +73,7 @@ test.must_match('test3.dll', "test1.c\ntest2.c\n") if sys.platform == "win32": import SCons.Tool.MSCommon as msc - if msc.msvc_exists(test.Environment()): + if msc.msvc_exists(): # Now test an actual compile and link. Since MS Windows # resets the link actions, this could fail even if the above # test passed. diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py index b9621a1..aed451e 100644 --- a/test/Libs/LIBPREFIXES.py +++ b/test/Libs/LIBPREFIXES.py @@ -31,7 +31,7 @@ import TestSCons if sys.platform == 'win32': _lib = '.lib' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): _lib = '.a' else: _lib = '.a' diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py index 0798475..5639228 100644 --- a/test/Libs/LIBS.py +++ b/test/Libs/LIBS.py @@ -27,19 +27,17 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons import sys -test = TestSCons.TestSCons() - if sys.platform == 'win32': _exe = '.exe' bar_lib = 'bar.lib' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): bar_lib = 'libbar.a' else: _exe = '' bar_lib = 'libbar.a' - +test = TestSCons.TestSCons() test.subdir('sub1', 'sub2') diff --git a/test/Libs/LIBSUFFIXES.py b/test/Libs/LIBSUFFIXES.py index 030e601..13baeab 100644 --- a/test/Libs/LIBSUFFIXES.py +++ b/test/Libs/LIBSUFFIXES.py @@ -28,16 +28,16 @@ import os import sys import TestSCons -test = TestSCons.TestSCons() - if sys.platform == 'win32': lib_ = '' import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): lib_ = 'lib' else: lib_ = 'lib' +test = TestSCons.TestSCons() + test.write('SConstruct', """ env = Environment(LIBSUFFIX = '.xxx', LIBSUFFIXES = ['.xxx']) diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py index 2a58026..93d67ea 100644 --- a/test/Libs/SharedLibraryIxes.py +++ b/test/Libs/SharedLibraryIxes.py @@ -42,7 +42,7 @@ isWindows = sys.platform == 'win32' isMingw = False if isWindows: import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): # We can't seem to find any MSVC version, so we assume # that MinGW is installed instead. Accordingly, we use the # standard gcc/g++ conventions for lib prefixes and suffixes diff --git a/test/long-lines/live.py b/test/long-lines/live.py index 8540cd7..5618f55 100644 --- a/test/long-lines/live.py +++ b/test/long-lines/live.py @@ -43,7 +43,7 @@ if sys.platform == 'win32': linkflag_init = '/LIBPATH:' + test.workpath() linkflag = ' /LIBPATH:' + test.workpath() import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(test.Environment()): + if not msc.msvc_exists(): lib_shared_dll = 'shared.dll' lib_static_lib = 'libstatic.a' arflag_init = 'r' diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py index 36718f1..0daf8bf 100644 --- a/test/sconsign/script/dblite.py +++ b/test/sconsign/script/dblite.py @@ -114,7 +114,7 @@ date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - if msc.msvc_exists(test.Environment()): + if msc.msvc_exists(): manifest = r""" embedManifestExeCheck\(target, source, env\)""" else: diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 01002c5..b543c07 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -1072,7 +1072,7 @@ SConscript( sconscript ) try: import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(self.Environment()): + if not msc.msvc_exists(): msg = "No MSVC toolchain found...skipping test\n" self.skip_test(msg) except: -- cgit v0.12 From d325e5fa8843e6667fd87ee7910252570f405607 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Wed, 9 Jan 2019 11:04:29 -0600 Subject: removed unused varied, added named expections, whitespace and comments fixed except check revert some obsolete changes --- src/engine/SCons/Tool/MSCommon/vc.py | 47 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index ad921ef..e9a473f 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -348,20 +348,29 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): - ver_num = float(get_msvc_version_numeric(msvc_version)) - found_cl = False + + # determine if there is a specific target platform we want to build for and + # use that to find a list of valid VCs, default is host platform == target platform + # and same for if no env is specified to extract target platform from if env: - (host_platform, target_platform,req_target_platform) = get_host_target(env) + (host_platform, target_platform, req_target_platform) = get_host_target(env) else: host_platform = platform.machine().lower() target_platform = host_platform - # check to see if the x86 or 64 bit compiler is in the bin dir + ver_num = float(get_msvc_version_numeric(msvc_version)) + + # make sure the cl.exe exists meaning the tool is installed if ver_num > 14: + # 2017 and newer allowed multiple versions of the VC toolset to be installed at the same time. + # Just get the default tool version for now + #TODO: support setting a specific minor VC version try: f = open(os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')) vc_specific_version = f.readlines()[0].strip() - except: + except OSError: + return False + except IndexError: return False if host_platform in ('amd64','x86_64'): @@ -380,34 +389,35 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): if os.path.exists(os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe')): return True + elif ver_num <= 14: + if host_platform in ('amd64','x86_64'): - host_dir = "amd64" + host_platform = "amd64" elif host_platform in ('i386','i686','x86'): - host_dir = "x86" + host_platform = "x86" else: return False - if target_platform in ('amd64','x86_64'): - target_dir = "amd64" + target_platform = "amd64" elif target_platform in ('i386','i686','x86'): - target_dir = "x86" + target_platform = "x86" elif target_platform in ('ia64'): - target_dir = "ia64" + target_platform = "ia64" else: return False - host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_dir, target_dir)] + host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_platform, target_platform)] if host_target_dir == 'x86': host_target_dir == '' else: host_target_dir += '\\' - cl_dir = 'bin\\' + host_target_dir + 'cl.exe' - if os.path.exists(os.path.join(vc_dir, cl_dir)): + + if os.path.exists(os.path.join(vc_dir, 'bin\\' + host_target_dir + 'cl.exe')): return True - return False + return False def cached_get_installed_vcs(env=None): global __INSTALLED_VCS_RUN @@ -509,7 +519,7 @@ def msvc_setup_env_once(env): msvc_setup_env(env) env["MSVC_SETUP_RUN"] = True -def msvc_find_valid_batch_script(env,version,modify_env=True): +def msvc_find_valid_batch_script(env,version): debug('vc.py:msvc_find_valid_batch_script()') # Find the host platform, target platform, and if present the requested # target platform @@ -535,8 +545,7 @@ def msvc_find_valid_batch_script(env,version,modify_env=True): d = None for tp in try_target_archs: # Set to current arch. - if modify_env: - env['TARGET_ARCH']=tp + env['TARGET_ARCH']=tp debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp) host_target = (host_platform, tp) @@ -593,7 +602,7 @@ def msvc_find_valid_batch_script(env,version,modify_env=True): # If we cannot find a viable installed compiler, reset the TARGET_ARCH # To it's initial value - if not d and modify_env: + if not d: env['TARGET_ARCH']=req_target_platform return d -- cgit v0.12 From 65edf2635d0328cfaf8aeec01a7b3f26454cc149 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Thu, 10 Jan 2019 06:04:18 +0300 Subject: Travis sudo is deprecated https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76f6db0..e279ad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ addons: os: - linux -sudo: required - install: - ./.travis/install.sh -- cgit v0.12 From 33697a1b1c6c2d9915d31a616c18b1a993619251 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Thu, 10 Jan 2019 09:41:11 +0300 Subject: Use HTTPS in issue template --- .github/ISSUE_TEMPLATE.md | 13 +++++++++++++ .github/issue_template.md | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/issue_template.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..eeeb6bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,13 @@ +## Please bring your issue to the SCons users mailing list before filing an issue here +## See: https://scons.org/bugs.html + +## If the issue is confirmed to be a bug please include the following information + +* Link to SCons Users thread discussing your issue. +* Version of SCons +* Version of Python +* Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc) +* How you installed SCons +* What Platform are you on? (Linux/Windows and which version) +* How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues. +* How you invoke scons (The command line you're using "scons --flags some_arguments") diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 1d35486..0000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,12 +0,0 @@ -# Please bring your issue to the SCons users mailing list before filing an issue here -# See: http://scons.org/bugs.html - -# If the issue is confirmed to be a bug please include the following information -* Link to SCons Users thread discussing your issue. -* Version of SCons -* Version of Python -* Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc) -* How you installed SCons -* What Platform are you on? (Linux/Windows and which version) -* How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues. -* How you invoke scons (The command line you're using "scons --flags some_arguments") \ No newline at end of file -- cgit v0.12 From 2de6d32d19914975c6e7534c41b5a83c1e9a2a84 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Thu, 10 Jan 2019 09:42:58 +0300 Subject: HTTPS for pull request template [skip ci] --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 60ff50f..9e8b7a2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,11 @@ ## Remove this paragraph Please have a look at our developer documentation before submitting your Pull Request. -http://scons.org/guidelines.html +https://scons.org/guidelines.html ## Contributor Checklist: * [ ] I have created a new test or updated the unit tests to cover the new/changed functionality. * [ ] I have updated `master/src/CHANGES.txt` directory (and read the `README.txt` in that directory) -* [ ] I have updated the appropriate documentation \ No newline at end of file +* [ ] I have updated the appropriate documentation -- cgit v0.12 From a362956e9af4095ff946bffd32ae275030806ac5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 10 Jan 2019 03:02:29 -0600 Subject: added support for checking for arm target support, and UWP apps for 2017 --- src/engine/SCons/Tool/MSCommon/common.py | 2 +- src/engine/SCons/Tool/MSCommon/vc.py | 90 +++++++++++++------- test/MSVC/MSVC_UWP_APP.py | 141 ++++++++++++++++++++----------- 3 files changed, 154 insertions(+), 79 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index a0140c6..f7c07b2 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -206,7 +206,7 @@ def get_output(vcbat, args = None, env = None): output = stdout.decode("mbcs") return output -def parse_output(output, keep=("INCLUDE", "LIB", "LIBPATH", "PATH")): +def parse_output(output, keep=("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat')): """ Parse output from running visual c++/studios vcvarsall.bat and running set To capture the values listed in keep diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 823f9e0..7401f5c 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -84,9 +84,9 @@ _ARCH_TO_CANONICAL = { "itanium" : "ia64", # deprecated "x86" : "x86", "x86_64" : "amd64", - "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits "arm" : "arm", "arm64" : "arm64", + "aarch64" : "arm64", } # Given a (host, target) tuple, return the argument for the bat file. @@ -372,6 +372,20 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None +def _get_host_target_dir(host_platform, target_platform): + + host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH.get((host_platform, target_platform), False) + + if not host_target_dir: + debug('_check_cl_exists_in_vc_dir(): unsupported host/target combination' + host_target_dir) + return False + elif host_target_dir in 'x86': + host_target_dir == '' + else: + host_target_dir += '\\' + + return host_target_dir + def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): # determine if there is a specific target platform we want to build for and @@ -383,6 +397,11 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): host_platform = platform.machine().lower() target_platform = host_platform + host_platform = _ARCH_TO_CANONICAL[host_platform] + target_platform = _ARCH_TO_CANONICAL[target_platform] + + debug('_check_cl_exists_in_vc_dir(): host platform %s, target platform %s' % (host_platform, target_platform)) + ver_num = float(get_msvc_version_numeric(msvc_version)) # make sure the cl.exe exists meaning the tool is installed @@ -390,58 +409,71 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): # 2017 and newer allowed multiple versions of the VC toolset to be installed at the same time. # Just get the default tool version for now #TODO: support setting a specific minor VC version + default_toolset_file = os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt') try: - f = open(os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')) + f = open(default_toolset_file) vc_specific_version = f.readlines()[0].strip() except OSError: + debug('_check_cl_exists_in_vc_dir(): failed to open ' + default_toolset_file) return False except IndexError: + debug('_check_cl_exists_in_vc_dir(): failed to get MSVC version from ' + default_toolset_file) return False - if host_platform in ('amd64','x86_64'): + if host_platform == 'amd64': host_dir = "Hostx64" - elif host_platform in ('i386','i686','x86'): + elif host_platform == 'x86': host_dir = "Hostx86" else: + debug('_check_cl_exists_in_vc_dir(): unsupported host platform ' + host_platform) return False - if target_platform in ('amd64','x86_64'): + if target_platform == 'amd64': target_dir = "x64" - elif target_platform in ('i386','i686','x86'): - target_dir = "x86" + elif target_platform in ('x86', 'arm', 'arm64'): + target_dir = target_platform else: + debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - - if os.path.exists(os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe')): + + cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe') + debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + if os.path.exists(cl_path): + debug('_check_cl_exists_in_vc_dir(): found cl.exe!') return True - elif ver_num <= 14: + elif ver_num <= 14 and ver_num >= 8: - if host_platform in ('amd64','x86_64'): - host_platform = "amd64" - elif host_platform in ('i386','i686','x86'): - host_platform = "x86" - else: + if host_platform not in ('amd64','x86'): + debug('_check_cl_exists_in_vc_dir(): unsupported host platform ' + host_platform) return False - if target_platform in ('amd64','x86_64'): - target_platform = "amd64" - elif target_platform in ('i386','i686','x86'): - target_platform = "x86" - elif target_platform in ('ia64'): - target_platform = "ia64" - else: + if target_platform not in ('amd64','x86', 'ia64', 'arm' , 'arm64'): + debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH[(host_platform, target_platform)] - if host_target_dir == 'x86': - host_target_dir == '' - else: - host_target_dir += '\\' - - if os.path.exists(os.path.join(vc_dir, 'bin\\' + host_target_dir + 'cl.exe')): + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + 'cl.exe') + debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + + cl_path_exists = os.path.exists(cl_path) + if not cl_path_exists and host_platform == 'amd64': + # older versions of visual studio only had x86 binaries, so if the host platform is amd64, we need to check cross compile options (x86 binary compiles some other target on a 64 bit os) + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + 'cl.exe') + debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path_exists = os.path.exists(cl_path) + + if cl_path_exists: + debug('_check_cl_exists_in_vc_dir(): found cl.exe!') return True + elif ver_num < 8 and ver_num >= 6: + # not sure about these versions so if a VC dir was found, consider it possibly valid + # and let the batch script run, and any issues can get caught there + return os.path.exists(vc_dir) + else: + # version not support return false + debug('_check_cl_exists_in_vc_dir(): unsupported MSVC version: ' + str(ver_num)) + return False def cached_get_installed_vcs(env=None): diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py index c72c739..cdd260c 100644 --- a/test/MSVC/MSVC_UWP_APP.py +++ b/test/MSVC/MSVC_UWP_APP.py @@ -31,22 +31,28 @@ the desired effect. import TestSCons import SCons.Tool.MSCommon.vc as msvc +from SCons.Tool.MSCommon.vc import get_msvc_version_numeric def AreVCStoreLibPathsInLIBPATH(output): libpath = None msvc_version = None + UWP_APP = None lines = output.splitlines() for line in lines: if 'env[ENV][LIBPATH]=' in line: libpath = line.split('=')[1] elif 'env[MSVC_VERSION]=' in line: msvc_version = line.split('=')[1] + elif 'env[ENV][VSCMD_ARG_app_plat]=' in line: + UWP_APP = line.split('=')[1] if not libpath or not msvc_version: # Couldn't find the libpath or msvc version in the output return (False, False, None) libpaths = libpath.lower().split(';') + msvc_num = float(get_msvc_version_numeric(msvc_version)) + (vclibstore_path_present, vclibstorerefs_path_present) = (False, False) for path in libpaths: # Look for the Store VC Lib paths in the LIBPATH: @@ -55,10 +61,18 @@ def AreVCStoreLibPathsInLIBPATH(output): # For example, # C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store\amd64 # C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\store\references - if r'vc\lib\store\references' in path: - vclibstorerefs_path_present = True - elif r'vc\lib\store' in path: - vclibstore_path_present = True + + if msvc_num <= 14: + if r'vc\lib\store\references' in path: + vclibstorerefs_path_present = True + elif r'vc\lib\store' in path: + vclibstore_path_present = True + elif msvc_num > 14: + if UWP_APP == "UWP": + if(r'\lib\x86\store\references' in path + or r'\lib\x64\store' in path): + vclibstorerefs_path_present = True + vclibstore_path_present = True return (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) @@ -68,60 +82,89 @@ test = TestSCons.TestSCons() test.skip_if_not_msvc() -test.write('SConstruct', """ +installed_msvc_versions = msvc.cached_get_installed_vcs() +# MSVC guaranteed to be at least one version on the system or else skip_if_not_msvc() function +# would have skipped the test + +msvc_140 = '14.0' in installed_msvc_versions +msvc_141 = '14.1' in installed_msvc_versions + +if not (msvc_140 or msvc_141): + test.skip_test("Available MSVC doesn't support App store") + +if msvc_140: + + test.write('SConstruct', """ if ARGUMENTS.get('MSVC_UWP_APP'): help_vars = Variables() help_vars.Add(EnumVariable( - 'MSVC_UWP_APP', - 'Build for a Universal Windows Platform (UWP) Application', - '0', - allowed_values=('0', '1'))) + 'MSVC_UWP_APP', + 'Build for a Universal Windows Platform (UWP) Application', + '0', + allowed_values=('0', '1'))) else: help_vars = None -env = Environment(tools=['default', 'msvc'], variables=help_vars) +env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION='14.0') # Print the ENV LIBPATH to stdout print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) -""") + """) -installed_msvc_versions = msvc.cached_get_installed_vcs() -# MSVC guaranteed to be at least one version on the system or else skip_if_not_msvc() function -# would have skipped the test -greatest_msvc_version_on_system = installed_msvc_versions[0] -maj, min = msvc.msvc_version_to_maj_min(greatest_msvc_version_on_system) - -# We always use the greatest MSVC version installed on the system - -if maj < 14: - # Skip the test if MSVC version is less than VS2015 - test.skip_test("Available MSVC doesn't support App store ") - -# Test setting MSVC_UWP_APP is '1' (True) -test.run(arguments = "MSVC_UWP_APP=1") -(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) -test.fail_test(msvc_version != greatest_msvc_version_on_system, - message='MSVC_VERSION (%s) does not match expected greatest version on system (%s)' \ - % (msvc_version, greatest_msvc_version_on_system)) -test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False), - message='VC Store LIBPATHs NOT present when MSVC_UWP_APP=1 (msvc_version=%s)' % msvc_version) - -# Test setting MSVC_UWP_APP is '0' (False) -test.run(arguments = "MSVC_UWP_APP=0") -(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) -test.fail_test(msvc_version != greatest_msvc_version_on_system, - message='MSVC_VERSION (%s) does not match expected greatest version on system (%s)' \ - % (msvc_version, greatest_msvc_version_on_system)) -test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), - message='VC Store LIBPATHs present when MSVC_UWP_APP=0 (msvc_version=%s)' % msvc_version) - -# Test not setting MSVC_UWP_APP -test.run(arguments = "") -(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) -test.fail_test(msvc_version != greatest_msvc_version_on_system, - message='MSVC_VERSION (%s) does not match expected greatest version on system (%s)' \ - % (msvc_version, greatest_msvc_version_on_system)) -test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), - message='VC Store LIBPATHs present when MSVC_UWP_APP not set (msvc_version=%s)' % msvc_version) + # Test setting MSVC_UWP_APP is '1' (True) + test.run(arguments = "MSVC_UWP_APP=1") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False), + message='VC Store LIBPATHs NOT present when MSVC_UWP_APP=1 (msvc_version=%s)' % msvc_version) + + # Test setting MSVC_UWP_APP is '0' (False) + test.run(arguments = "MSVC_UWP_APP=0") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), + message='VC Store LIBPATHs present when MSVC_UWP_APP=0 (msvc_version=%s)' % msvc_version) + + # Test not setting MSVC_UWP_APP + test.run(arguments = "") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), + message='VC Store LIBPATHs present when MSVC_UWP_APP not set (msvc_version=%s)' % msvc_version) + +if msvc_141: + + test.write('SConstruct', """ +if ARGUMENTS.get('MSVC_UWP_APP'): + help_vars = Variables() + help_vars.Add(EnumVariable( + 'MSVC_UWP_APP', + 'Build for a Universal Windows Platform (UWP) Application', + '0', + allowed_values=('0', '1'))) +else: + help_vars = None +env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION='14.1') +# Print the ENV LIBPATH to stdout +print(str(env.get('ENV'))) +print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) +print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) +print('env[ENV][VSCMD_ARG_app_plat]=%s' % env.get('ENV').get('VSCMD_ARG_app_plat')) + """) + + # 2017 adds + test.run(arguments = "MSVC_UWP_APP=1") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False), + message='VC Store LIBPATHs NOT present when MSVC_UWP_APP=1 (msvc_version=%s)' % msvc_version) + + # Test setting MSVC_UWP_APP is '0' (False) + test.run(arguments = "MSVC_UWP_APP=0") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), + message='VC Store LIBPATHs NOT present when MSVC_UWP_APP=1 (msvc_version=%s)' % msvc_version) + + # Test not setting MSVC_UWP_APP + test.run(arguments = "") + (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) + test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True), + message='VC Store LIBPATHs NOT present when MSVC_UWP_APP=1 (msvc_version=%s)' % msvc_version) test.pass_test() -- cgit v0.12 From 3e68e53b03e531f453edba8bc0443b5c19dde211 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 10 Jan 2019 03:05:24 -0600 Subject: added name for cl.exe and have older versions walk for cl.exe fixed syntax error removed debug print --- src/engine/SCons/Tool/MSCommon/vc.py | 29 +++++++++++++++++------------ test/MSVC/MSVC_UWP_APP.py | 7 +++---- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 7401f5c..007a80d 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -106,6 +106,8 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("amd64", "arm64"): "amd64_arm64", # since 14.1 } +_CL_EXE_NAME = 'cl.exe' + def get_msvc_version_numeric(msvc_version): return ''.join([x for x in msvc_version if x in string_digits + '.']) @@ -436,10 +438,10 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) if os.path.exists(cl_path): - debug('_check_cl_exists_in_vc_dir(): found cl.exe!') + debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True elif ver_num <= 14 and ver_num >= 8: @@ -452,24 +454,27 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) return False - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if not cl_path_exists and host_platform == 'amd64': # older versions of visual studio only had x86 binaries, so if the host platform is amd64, we need to check cross compile options (x86 binary compiles some other target on a 64 bit os) - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + 'cl.exe') - debug('_check_cl_exists_in_vc_dir(): checking for cl.exe at ' + cl_path) + cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + _CL_EXE_NAME) + debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if cl_path_exists: - debug('_check_cl_exists_in_vc_dir(): found cl.exe!') + debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True elif ver_num < 8 and ver_num >= 6: - # not sure about these versions so if a VC dir was found, consider it possibly valid - # and let the batch script run, and any issues can get caught there - return os.path.exists(vc_dir) + # not sure about these versions so if a walk the VC dir (could be slow) + for root, _, files in os.walk(vc_dir): + if _CL_EXE_NAME in files: + debug('get_installed_vcs ' + _CL_EXE_NAME + ' found %s' % os.path.join(root, _CL_EXE_NAME)) + return True + return False else: # version not support return false debug('_check_cl_exists_in_vc_dir(): unsupported MSVC version: ' + str(ver_num)) @@ -712,7 +717,7 @@ def msvc_setup_env(env): msvc_cl = find_program_path(env, 'cl') if not msvc_cl: SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, - "Could not find MSVC compiler 'cl.exe', it may need to be installed separately with Visual Studio") + "Could not find MSVC compiler 'cl', it may need to be installed separately with Visual Studio") def msvc_exists(env=None, version=None): vcs = cached_get_installed_vcs(env) diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py index cdd260c..861edcd 100644 --- a/test/MSVC/MSVC_UWP_APP.py +++ b/test/MSVC/MSVC_UWP_APP.py @@ -108,7 +108,7 @@ env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION=' # Print the ENV LIBPATH to stdout print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) - """) +""") # Test setting MSVC_UWP_APP is '1' (True) test.run(arguments = "MSVC_UWP_APP=1") @@ -142,13 +142,12 @@ else: help_vars = None env = Environment(tools=['default', 'msvc'], variables=help_vars, MSVC_VERSION='14.1') # Print the ENV LIBPATH to stdout -print(str(env.get('ENV'))) print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION')) print('env[ENV][VSCMD_ARG_app_plat]=%s' % env.get('ENV').get('VSCMD_ARG_app_plat')) - """) +""") - # 2017 adds + # Test setting MSVC_UWP_APP is '1' (True) test.run(arguments = "MSVC_UWP_APP=1") (vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout()) test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False), -- cgit v0.12 From 55ff97a345140430f824db0164b1bf79abc63c7f Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 11 Jan 2019 15:12:13 -0500 Subject: revert master to develop mode --- ReleaseConfig | 2 +- src/Announce.txt | 2 +- src/CHANGES.txt | 7 ++++ src/RELEASE.txt | 114 +++++++++++++++++++++++++------------------------------ 4 files changed, 61 insertions(+), 64 deletions(-) diff --git a/ReleaseConfig b/ReleaseConfig index b5954df..900e8b5 100755 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -32,7 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # 'final', the patchlevel is set to the release date. This value is # mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) -version_tuple = (3, 0, 3) +version_tuple = (3, 0, 4, 'alpha', 0) # Python versions prior to unsupported_python_version cause a fatal error # when that version is used. Python versions prior to deprecate_python_version diff --git a/src/Announce.txt b/src/Announce.txt index 9e9c16b..c7948c0 100755 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -18,7 +18,7 @@ So that everyone using SCons can help each other learn how to use it more effectively, please go to http://scons.org/lists.html#users to sign up for the scons-users mailing list. -RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 +RELEASE VERSION/DATE TO BE FILLED IN LATER Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 231badb..4baf70a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,6 +5,13 @@ Change Log +RELEASE VERSION/DATE TO BE FILLED IN LATER + + From John Doe: + + - Whatever John Doe did. + + RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 2355f47..8987ee2 100755 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,83 +1,73 @@ + A new SCons checkpoint release, 3.0.4.alpha.yyyymmdd, is now available + on the SCons download page: - A new SCons release, 3.0.3, is now available on the SCons download page: + http://www.scons.org/download.php - https://scons.org/pages/download.html + XXX The primary purpose of this release ... XXX + A SCons "checkpoint release" is intended to provide early access to + new features so they can be tested in the field before being released + for adoption by other software distributions. - Here is a summary of the changes since 3.0.1: + Note that a checkpoint release is developed using the same test-driven + development methodology as all SCons releases. Existing SCons + functionality should all work as it does in previous releases (except + for any changes identified in the release notes) and early adopters + should be able to use a checkpoint release safely for production work + with existing SConscript files. If not, it represents not only a bug + in SCons but also a hole in the regression test suite, and we want to + hear about it. + + New features may be more lightly tested than in past releases, + especially as concerns their interaction with all of the other + functionality in SCons. We are especially interested in hearing bug + reports about new functionality. + + We do not recommend that downstream distributions (Debian, Fedora, + etc.) package a checkpoint release, mainly to avoid confusing the + "public" release numbering with the long checkpoint release names. + + Here is a summary of the changes since 1.3.0: NEW FUNCTIONALITY - - Properly support versioned shared libraries for MacOS. We've also introduced two - new env variables APPLELINK_CURRENT_VERSION and APPLELINK_COMPATIBILITY_VERSION which will specify - what is passed to the linkers -current_version and -compatibility_version flags. If not specified - they will be derived from SHLIBVERSION as such: - - APPLELINK_CURRENT_VERSION = SHLIBVERSION - - APPLELINK_COMPATIBILITY_VERSION = all but the last digit in SHLIBVERSION with .0 appended. - Note that the values of the above will be validated. Valid format for either APPLELINK variable is - X[.Y[.Z]] where 0 <= X <= 65535, 0 <= Y <= 255, 0 <= Z <= 255. - - Add flag must_exist to SConscript() call to fail on missing script. - Not failing on missing script is now considered deprecated, and the first instance will print a - deprecation message. - - Add xz compression format to packaging choices. - - Add Textfile/Substfile to default environment. (issue #3147) - - Added virtualenv support. A new function Virtualenv() determines whether - SCons runs in a virtualenv. The search PATH may also be extended to - prefer executables from the current virtualenv over the ones provided by - base environment. New option --enable-virtualenv provided to import some - virtualenv-related variables to SCons and extend every env['ENV']['PATH'] - automatically. New option --ignore-virtualenv disables this. Two - environment variables, SCONS_ENABLE_VIRTUALENV and - SCONS_IGNORE_VIRTUALENV are supported for the same purpose. + - List new features (presumably why a checkpoint is being released) DEPRECATED FUNCTIONALITY - - Going forward calling SConscript on a non-existing SConscript file will issue a warning. Currently - it will issue a deprecation notice. + - List anything that's been deprecated since the last release CHANGED/ENHANCED EXISTING FUNCTIONALITY - - Recognize new java 9, 10, 11 (as 9.0 and 10.0, 11.0) + - List modifications to existing features, where the previous behavior + wouldn't actually be considered a bug + + FIXES + + - List fixes of outright bugs + + IMPROVEMENTS + + - List improvements that wouldn't be visible to the user in the + documentation: performance improvements (describe the circumstances + under which they would be observed), or major code cleanups + + PACKAGING + + - List changes in the way SCons is packaged and/or released DOCUMENTATION - - Update some doc examples for Py3: map() now returns an iterable - instead of a list. - FIXES + - List any significant changes to the documentation (not individual + typo fixes, even if they're mentioned in src/CHANGES.txt to give + the contributor credit) - - Fix issue #2980 with credit to Piotr Bartosik (and William Blevins). This is an issue where using - TimeStamp-MD5 Decider and CacheDir can yield incorrect md5's being written into the .sconsign. - The difference between Piotr Bartosik's patch and the current code is that the more complicated - creation of file to csig map is only done when the count of children for the current node doesn't - match the previous count which is loaded from the sconsign. + DEVELOPMENT + - List visible changes in the way SCons is developed - Thanks to Bernard Blackham, William Deegan, Ray Donnelly, Andrew Featherstone, Arda Fu, - Philipp Maierhöfer, Matthew Marinets, Fredrik Medley, Daniel Moody, Gary Oberbrunner, - Jonathon Reinhart, Zachary Tessler, Paweł Tomulik, Richard West, Mats Wichmann, Bernhard M. Wiedemann, - and Hao Wu for their contributions to this release. + Thanks to CURLY, LARRY, and MOE for their contributions to this release. Contributors are listed alphabetically by their last name. -git shortlog --no-merges -ns 3.0.1..HEAD - 254 William Deegan - 79 Daniel Moody - 73 Mats Wichmann - 17 Paweł Tomulik - 16 Andrew Featherstone - 8 grbd - 7 maiphi - 6 Gary Oberbrunner - 6 Daniel - 4 Hao Wu - 3 Gabriel Russell - 2 MatthewMarinets - 2 Jonathon Reinhart - 2 ArdaFu - 1 Bernhard M. Wiedemann - 1 Isaac Pascual Monells - 1 Fredrik Medley - 1 Philipp Maierhoefer - 1 Piotr Kasprzyk - 1 Ray Donnelly - 1 Zachary Tessler - 1 cclauss +__COPYRIGHT__ +__FILE__ __REVISION__ __DATE__ __DEVELOPER__ -- cgit v0.12 From dbb5bb7c6905e388c41dad912830b983ea70e57d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 03:21:08 -0600 Subject: added test for vs 14.1 and checking arm targets --- src/engine/SCons/Tool/MSCommon/vs.py | 15 +++-- src/engine/SCons/Tool/msvs.py | 20 ++++-- test/MSVC/TARGET_ARCH.py | 22 +++++++ test/MSVS/vs-14.1-exec.py | 113 +++++++++++++++++++++++++++++++++ test/MSVS/vs-14.1-files.py | 108 +++++++++++++++++++++++++++++++ test/MSVS/vs-14.1-scc-files.py | 115 ++++++++++++++++++++++++++++++++++ test/MSVS/vs-14.1-scc-legacy-files.py | 98 +++++++++++++++++++++++++++++ testing/framework/TestSConsMSVS.py | 108 +++++++++++++++++++++++++++++++ 8 files changed, 586 insertions(+), 13 deletions(-) create mode 100644 test/MSVS/vs-14.1-exec.py create mode 100644 test/MSVS/vs-14.1-files.py create mode 100644 test/MSVS/vs-14.1-scc-files.py create mode 100644 test/MSVS/vs-14.1-scc-legacy-files.py diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py index f9382fb..8fd4ea0 100644 --- a/src/engine/SCons/Tool/MSCommon/vs.py +++ b/src/engine/SCons/Tool/MSCommon/vs.py @@ -68,9 +68,9 @@ class VisualStudio(object): SCons.Tool.MSCommon.vc.get_installed_vcs() dir = SCons.Tool.MSCommon.vc.find_vc_pdir(self.vc_version) if not dir: - debug('find_vs_dir(): no installed VC %s' % self.vc_version) + debug('find_vs_dir_by_vc(): no installed VC %s' % self.vc_version) return None - return dir + return os.path.abspath(os.path.join(dir, os.pardir)) def find_vs_dir_by_reg(self): root = 'Software\\' @@ -95,12 +95,11 @@ class VisualStudio(object): First try to find by registry, and if that fails find via VC dir """ - - if True: - vs_dir=self.find_vs_dir_by_reg() - return vs_dir - else: - return self.find_vs_dir_by_vc() + vs_dir=self.find_vs_dir_by_reg() + if not vs_dir: + vs_dir = self.find_vs_dir_by_vc() + debug('find_vs_dir(): found VS in ' + str(vs_dir )) + return vs_dir def find_executable(self): vs_dir = self.get_vs_dir() diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 4b73a3b..60ba278 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -1096,12 +1096,17 @@ V10DSPCommandLine = """\ \t\t$(NMakeForcedUsingAssemblies) """ +V15DSPHeader = """\ + + +""" + class _GenerateV10DSP(_DSPGenerator, _GenerateV10User): """Generates a Project file for MSVS 2010""" - def __init__(self, dspfile, source, env): + def __init__(self, dspfile, header, source, env): _DSPGenerator.__init__(self, dspfile, source, env) - self.dspheader = V10DSPHeader + self.dspheader = header self.dspconfiguration = V10DSPProjectConfiguration self.dspglobals = V10DSPGlobals @@ -1501,7 +1506,9 @@ class _GenerateV7DSW(_DSWGenerator): def PrintSolution(self): """Writes a solution file""" self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr) - if self.version_num >= 12.0: + if self.version_num > 14.0: + self.file.write('# Visual Studio 15\n') + elif self.version_num >= 12.0: self.file.write('# Visual Studio 14\n') elif self.version_num >= 11.0: self.file.write('# Visual Studio 11\n') @@ -1679,8 +1686,11 @@ def GenerateDSP(dspfile, source, env): version_num = 6.0 if 'MSVS_VERSION' in env: version_num, suite = msvs_parse_version(env['MSVS_VERSION']) - if version_num >= 10.0: - g = _GenerateV10DSP(dspfile, source, env) + if version_num > 14.0: + g = _GenerateV10DSP(dspfile, V15DSPHeader, source, env) + g.Build() + elif version_num >= 10.0: + g = _GenerateV10DSP(dspfile, V10DSPHeader, source, env) g.Build() elif version_num >= 7.0: g = _GenerateV7DSP(dspfile, source, env) diff --git a/test/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py index 1df28d0..9d5c008 100644 --- a/test/MSVC/TARGET_ARCH.py +++ b/test/MSVC/TARGET_ARCH.py @@ -29,6 +29,8 @@ Test the ability to configure the $TARGET_ARCH construction variable. """ import TestSCons +import SCons.Tool.MSCommon.vc as msvc +from SCons.Tool.MSCommon.vc import get_msvc_version_numeric _python_ = TestSCons._python_ @@ -56,6 +58,26 @@ test.run(arguments = ".", status=2, stderr=None) test.must_contain_any_line(test.stderr(), "Unrecognized target architecture") test.must_contain_any_line(test.stderr(), "Valid architectures") +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + TARGET_ARCH = 'arm', MSVC_VERSION='11.0') +if env.Detect('cl'): + env.Command('checkarm', [], 'cl') +""" % locals()) +test.run(arguments = ".", stderr = None) +if test.stderr().strip() is not "" and "ARM" not in test.stderr(): + test.fail_test() + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + TARGET_ARCH = 'arm64', MSVC_VERSION='11.0') +if env.Detect('cl'): + env.Command('checkarm64', [], 'cl') +""" % locals()) +test.run(arguments = ".", stderr = None) +if test.stderr().strip() is not "" and "ARM64" not in test.stderr(): + test.fail_test() + test.pass_test() # Local Variables: diff --git a/test/MSVS/vs-14.1-exec.py b/test/MSVS/vs-14.1-exec.py new file mode 100644 index 0000000..d7b4d10 --- /dev/null +++ b/test/MSVS/vs-14.1-exec.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that we can actually build a simple program using our generated +Visual Studio 14.1 project (.vcxproj) and solution (.sln) files +using Visual Studio 14.1 (Professional edition). +""" + +import os +import sys + +import TestSConsMSVS + +test = TestSConsMSVS.TestSConsMSVS() + +if sys.platform != 'win32': + msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform + test.skip_test(msg) + +msvs_version = '14.1' + +if not msvs_version in test.msvs_versions(): + msg = "Visual Studio %s not installed; skipping test.\n" % msvs_version + test.skip_test(msg) + + + +# Let SCons figure out the Visual Studio environment variables for us and +# print out a statement that we can exec to suck them into our external +# environment so we can execute devenv and really try to build something. + +test.run(arguments = '-n -q -Q -f -', stdin = """\ +env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') +if env.WhereIs('cl'): + print("os.environ.update(%%s)" %% repr(env['ENV'])) +""" % locals()) + +if(test.stdout() == ""): + msg = "Visual Studio %s missing cl.exe; skipping test.\n" % msvs_version + test.skip_test(msg) + +exec(test.stdout()) + + + +test.subdir('sub dir') + +test.write(['sub dir', 'SConstruct'], """\ +env=Environment(MSVS_VERSION = '%(msvs_version)s') + +env.MSVSProject(target = 'foo.vcxproj', + srcs = ['foo.c'], + buildtarget = 'foo.exe', + variant = 'Release', + DebugSettings = {'LocalDebuggerCommandArguments':'echo "" > output.txt'}) +env.Program('foo.c') +""" % locals()) + +test.write(['sub dir', 'foo.c'], r""" +int +main(int argc, char *argv) +{ + printf("foo.c\n"); + exit (0); +} +""") + +test.run(chdir='sub dir', arguments='.') + +test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) + +import SCons.Platform.win32 +system_dll_path = os.path.join( SCons.Platform.win32.get_system_root(), 'System32' ) +os.environ['PATH'] = os.environ['PATH'] + os.pathsep + system_dll_path + +test.run(chdir='sub dir', + program=[test.get_msvs_executable(msvs_version)], + arguments=['foo.sln', '/build', 'Release']) + +test.run(program=test.workpath('sub dir', 'foo'), stdout="foo.c\n") +test.validate_msvs_file(test.workpath('sub dir', 'foo.vcxproj.user')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-14.1-files.py b/test/MSVS/vs-14.1-files.py new file mode 100644 index 0000000..a7c8437 --- /dev/null +++ b/test/MSVS/vs-14.1-files.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that we can generate Visual Studio 14.1 project (.vcxproj) and +solution (.sln) files that look correct. +""" + +import os + +import TestSConsMSVS + +test = TestSConsMSVS.TestSConsMSVS() +host_arch = test.get_vs_host_arch() + + +# Make the test infrastructure think we have this version of MSVS installed. +test._msvs_versions = ['14.1'] + + + +expected_slnfile = TestSConsMSVS.expected_slnfile_14_1 +expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_14_1 +SConscript_contents = TestSConsMSVS.SConscript_contents_14_1 + + + +test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch}) + +test.run(arguments="Test.vcxproj") + +test.must_exist(test.workpath('Test.vcxproj')) +test.must_exist(test.workpath('Test.vcxproj.filters')) +vcxproj = test.read('Test.vcxproj', 'r') +expect = test.msvs_substitute(expected_vcprojfile, '14.1', None, 'SConstruct') +# don't compare the pickled data +assert vcxproj[:len(expect)] == expect, test.diff_substr(expect, vcxproj) + +test.must_exist(test.workpath('Test.sln')) +sln = test.read('Test.sln', 'r') +expect = test.msvs_substitute(expected_slnfile, '14.1', None, 'SConstruct') +# don't compare the pickled data +assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + +test.run(arguments='-c .') + +test.must_not_exist(test.workpath('Test.vcxproj')) +test.must_not_exist(test.workpath('Test.vcxproj.filters')) +test.must_not_exist(test.workpath('Test.sln')) + +test.run(arguments='Test.vcxproj') + +test.must_exist(test.workpath('Test.vcxproj')) +test.must_exist(test.workpath('Test.vcxproj.filters')) +test.must_exist(test.workpath('Test.sln')) + +test.run(arguments='-c Test.sln') + +test.must_not_exist(test.workpath('Test.vcxproj')) +test.must_not_exist(test.workpath('Test.vcxproj.filters')) +test.must_not_exist(test.workpath('Test.sln')) + + + +# Test that running SCons with $PYTHON_ROOT in the environment +# changes the .vcxproj output as expected. +os.environ['PYTHON_ROOT'] = 'xyzzy' +python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSConsMSVS.python)[1]) + +test.run(arguments='Test.vcxproj') + +test.must_exist(test.workpath('Test.vcxproj')) +vcxproj = test.read('Test.vcxproj', 'r') +expect = test.msvs_substitute(expected_vcprojfile, '14.1', None, 'SConstruct', + python=python) +# don't compare the pickled data +assert vcxproj[:len(expect)] == expect, test.diff_substr(expect, vcxproj) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-14.1-scc-files.py b/test/MSVS/vs-14.1-scc-files.py new file mode 100644 index 0000000..6fa12f8 --- /dev/null +++ b/test/MSVS/vs-14.1-scc-files.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that we can generate Visual Studio 14.1 project (.vcxproj) and +solution (.sln) files that contain SCC information and look correct. +""" + +import os + +import TestSConsMSVS + +test = TestSConsMSVS.TestSConsMSVS() + +# Make the test infrastructure think we have this version of MSVS installed. +test._msvs_versions = ['14.1'] + + + +expected_slnfile = TestSConsMSVS.expected_slnfile_14_1 +expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_14_1 +SConscript_contents = """\ +env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='14.1', + CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], + CPPPATH=['inc1', 'inc2'], + MSVS_SCC_CONNECTION_ROOT='.', + MSVS_SCC_PROVIDER='MSSCCI:Perforce SCM', + MSVS_SCC_PROJECT_NAME='Perforce Project') + +testsrc = ['test1.cpp', 'test2.cpp'] +testincs = ['sdk_dir\sdk.h'] +testlocalincs = ['test.h'] +testresources = ['test.rc'] +testmisc = ['readme.txt'] + +env.MSVSProject(target = 'Test.vcxproj', + srcs = testsrc, + incs = testincs, + localincs = testlocalincs, + resources = testresources, + misc = testmisc, + buildtarget = 'Test.exe', + variant = 'Release') +""" + +expected_sln_sccinfo = """\ +\tGlobalSection(SourceCodeControl) = preSolution +\t\tSccNumberOfProjects = 2 +\t\tSccProjectName0 = Perforce\\u0020Project +\t\tSccLocalPath0 = . +\t\tSccProvider0 = MSSCCI:Perforce\\u0020SCM +\t\tCanCheckoutShared = true +\t\tSccProjectUniqueName1 = Test.vcxproj +\t\tSccLocalPath1 = . +\t\tCanCheckoutShared = true +\t\tSccProjectFilePathRelativizedFromConnection1 = .\\\\ +\tEndGlobalSection +""" + +expected_vcproj_sccinfo = """\ +\t\tPerforce Project +\t\t. +\t\tMSSCCI:Perforce SCM +""" + + +test.write('SConstruct', SConscript_contents) + +test.run(arguments="Test.vcxproj") + +test.must_exist(test.workpath('Test.vcxproj')) +vcproj = test.read('Test.vcxproj', 'r') +expect = test.msvs_substitute(expected_vcprojfile, '14.1', None, 'SConstruct', + vcproj_sccinfo=expected_vcproj_sccinfo) +# don't compare the pickled data +assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + +test.must_exist(test.workpath('Test.sln')) +sln = test.read('Test.sln', 'r') +expect = test.msvs_substitute(expected_slnfile, '14.1', None, 'SConstruct', + sln_sccinfo=expected_sln_sccinfo) +# don't compare the pickled data +assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVS/vs-14.1-scc-legacy-files.py b/test/MSVS/vs-14.1-scc-legacy-files.py new file mode 100644 index 0000000..96e70a9 --- /dev/null +++ b/test/MSVS/vs-14.1-scc-legacy-files.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that we can generate Visual Studio 14.1 project (.vcxproj) and +solution (.sln) files that contain SCC information and look correct. +""" + +import os + +import TestSConsMSVS + +test = TestSConsMSVS.TestSConsMSVS() + +# Make the test infrastructure think we have this version of MSVS installed. +test._msvs_versions = ['14.1'] + + + +expected_slnfile = TestSConsMSVS.expected_slnfile_14_1 +expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_14_1 +SConscript_contents = """\ +env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='14.1', + CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], + CPPPATH=['inc1', 'inc2'], + MSVS_SCC_LOCAL_PATH='C:\\MyMsVsProjects', + MSVS_SCC_PROJECT_NAME='Perforce Project') + +testsrc = ['test1.cpp', 'test2.cpp'] +testincs = ['sdk_dir\sdk.h'] +testlocalincs = ['test.h'] +testresources = ['test.rc'] +testmisc = ['readme.txt'] + +env.MSVSProject(target = 'Test.vcxproj', + srcs = testsrc, + incs = testincs, + localincs = testlocalincs, + resources = testresources, + misc = testmisc, + buildtarget = 'Test.exe', + variant = 'Release') +""" + +expected_vcproj_sccinfo = """\ +\t\tPerforce Project +\t\tC:\\MyMsVsProjects +""" + + +test.write('SConstruct', SConscript_contents) + +test.run(arguments="Test.vcxproj") + +test.must_exist(test.workpath('Test.vcxproj')) +vcproj = test.read('Test.vcxproj', 'r') +expect = test.msvs_substitute(expected_vcprojfile, '14.1', None, 'SConstruct', + vcproj_sccinfo=expected_vcproj_sccinfo) +# don't compare the pickled data +assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) + +test.must_exist(test.workpath('Test.sln')) +sln = test.read('Test.sln', 'r') +expect = test.msvs_substitute(expected_slnfile, '14.1', None, 'SConstruct') +# don't compare the pickled data +assert sln[:len(expect)] == expect, test.diff_substr(expect, sln) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/testing/framework/TestSConsMSVS.py b/testing/framework/TestSConsMSVS.py index 1e879d9..b975ebe 100644 --- a/testing/framework/TestSConsMSVS.py +++ b/testing/framework/TestSConsMSVS.py @@ -536,6 +536,26 @@ Global EndGlobal """ +expected_slnfile_14_1 = """\ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.vcxproj", "Test.vcxproj", "{39A97E1F-1A52-8954-A0B1-A10A8487545E}" +EndProject +Global + +\tGlobalSection(SolutionConfigurationPlatforms) = preSolution +\t\tRelease|Win32 = Release|Win32 +\tEndGlobalSection +\tGlobalSection(ProjectConfigurationPlatforms) = postSolution +\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.ActiveCfg = Release|Win32 +\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.Build.0 = Release|Win32 +\tEndGlobalSection +\tGlobalSection(SolutionProperties) = preSolution +\t\tHideSolutionNode = FALSE +\tEndGlobalSection +EndGlobal +""" + expected_vcprojfile_8_0 = """\ """ +expected_vcprojfile_14_1 = """\ + + +\t +\t\t +\t\t\tRelease +\t\t\tWin32 +\t\t +\t +\t +\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E} + +\t\tTest +\t\tMakeFileProj +\t +\t +\t +\t\tMakefile +\t\tfalse +\t\tv141 +\t +\t +\t +\t +\t +\t\t +\t +\t +\t +\t<_ProjectFileVersion>10.0.30319.1 +\t\techo Starting SCons && "" -c "" -C "" -f SConstruct "Test.exe" +\t\techo Starting SCons && "" -c "" -C "" -f SConstruct "Test.exe" +\t\techo Starting SCons && "" -c "" -C "" -f SConstruct -c "Test.exe" +\t\tTest.exe +\t\tDEF1;DEF2;DEF3=1234 +\t\tinc1;inc2 +\t\t$(NMakeForcedIncludes) +\t\t$(NMakeAssemblySearchPath) +\t\t$(NMakeForcedUsingAssemblies) +\t +\t +\t\t +\t +\t +\t\t +\t +\t +\t\t +\t +\t +\t\t +\t +\t +\t\t +\t\t +\t +\t +\t\t +\t +\t +\t +\t + +""" + SConscript_contents_8_0 = """\ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0', CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], @@ -1022,6 +1107,29 @@ env.MSVSProject(target = 'Test.vcxproj', variant = 'Release') """ +SConscript_contents_14_1 = """\ +env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='14.1', + CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')], + CPPPATH=['inc1', 'inc2'], + HOST_ARCH='%(HOST_ARCH)s') + +testsrc = ['test1.cpp', 'test2.cpp'] +testincs = ['sdk_dir\sdk.h'] +testlocalincs = ['test.h'] +testresources = ['test.rc'] +testmisc = ['readme.txt'] + +env.MSVSProject(target = 'Test.vcxproj', + slnguid = '{SLNGUID}', + srcs = testsrc, + incs = testincs, + localincs = testlocalincs, + resources = testresources, + misc = testmisc, + buildtarget = 'Test.exe', + variant = 'Release') +""" + class TestSConsMSVS(TestSCons): """Subclass for testing MSVS-specific portions of SCons.""" -- cgit v0.12 From f8b78579a50f6caddc8e5bb96d704f462822a8d1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 03:23:39 -0600 Subject: updated CHANGES.txt --- src/CHANGES.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index b37c8e4..dbebb6d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -9,8 +9,10 @@ RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. - From William Deegan: + From Daniel Moody: + - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. + From William Deegan: - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added to the release packages. - Modify scons.bat script to check for scons python script without .py extension if no file -- cgit v0.12 From 580b28e01b8472a9f0ede7bdf1559181a79297fa Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 03:29:35 -0600 Subject: removed unused imports and other sider changes fixed syntax issue --- test/MSVC/TARGET_ARCH.py | 2 -- test/MSVS/vs-14.1-exec.py | 2 +- test/MSVS/vs-14.1-scc-files.py | 2 -- test/MSVS/vs-14.1-scc-legacy-files.py | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/test/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py index 9d5c008..a960bd8 100644 --- a/test/MSVC/TARGET_ARCH.py +++ b/test/MSVC/TARGET_ARCH.py @@ -29,8 +29,6 @@ Test the ability to configure the $TARGET_ARCH construction variable. """ import TestSCons -import SCons.Tool.MSCommon.vc as msvc -from SCons.Tool.MSCommon.vc import get_msvc_version_numeric _python_ = TestSCons._python_ diff --git a/test/MSVS/vs-14.1-exec.py b/test/MSVS/vs-14.1-exec.py index d7b4d10..2f593e0 100644 --- a/test/MSVS/vs-14.1-exec.py +++ b/test/MSVS/vs-14.1-exec.py @@ -43,7 +43,7 @@ if sys.platform != 'win32': msvs_version = '14.1' -if not msvs_version in test.msvs_versions(): +if msvs_version not in test.msvs_versions(): msg = "Visual Studio %s not installed; skipping test.\n" % msvs_version test.skip_test(msg) diff --git a/test/MSVS/vs-14.1-scc-files.py b/test/MSVS/vs-14.1-scc-files.py index 6fa12f8..74e055e 100644 --- a/test/MSVS/vs-14.1-scc-files.py +++ b/test/MSVS/vs-14.1-scc-files.py @@ -29,8 +29,6 @@ Test that we can generate Visual Studio 14.1 project (.vcxproj) and solution (.sln) files that contain SCC information and look correct. """ -import os - import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() diff --git a/test/MSVS/vs-14.1-scc-legacy-files.py b/test/MSVS/vs-14.1-scc-legacy-files.py index 96e70a9..0444b16 100644 --- a/test/MSVS/vs-14.1-scc-legacy-files.py +++ b/test/MSVS/vs-14.1-scc-legacy-files.py @@ -29,8 +29,6 @@ Test that we can generate Visual Studio 14.1 project (.vcxproj) and solution (.sln) files that contain SCC information and look correct. """ -import os - import TestSConsMSVS test = TestSConsMSVS.TestSConsMSVS() -- cgit v0.12 From 2fe4f5b4038ab41ba9547ce2ff9e5e8270860bb0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 15:03:15 -0600 Subject: updated msvs to handle newer versions, and moved host/target combos to dict --- src/engine/SCons/Tool/MSCommon/vc.py | 59 ++++++++++++++++++++++-------------- src/engine/SCons/Tool/msvsTests.py | 5 +++ 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 007a80d..ec63fba 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -88,6 +88,28 @@ _ARCH_TO_CANONICAL = { "arm64" : "arm64", "aarch64" : "arm64", } + +_HOST_TRGT_TO_CL_DIR_GREATER_THAN_14 = { + ("amd64","amd64") : "Hostx64\\x64", + ("amd64","x86") : "Hostx64\\x86", + ("amd64","arm") : "Hostx64\\arm", + ("amd64","arm64") : "Hostx64\\arm64", + ("x86","amd64") : "Hostx86\\x64", + ("x86","x86") : "Hostx86\\x86", + ("x86","arm") : "Hostx86\\arm", + ("x86","arm64") : "Hostx86\\arm64", +} + +_HOST_TRGT_TO_CL_DIR = { + ("amd64","amd64") : "amd64", + ("amd64","x86") : "amd64_x86", + ("amd64","arm") : "amd64_arm", + ("amd64","arm64") : "amd64_arm64", + ("x86","amd64") : "x86_amd64", + ("x86","x86") : "", + ("x86","arm") : "x86_arm", + ("x86","arm64") : "x86_arm64", +} # Given a (host, target) tuple, return the argument for the bat file. # Both host and targets should be canonalized. @@ -422,23 +444,12 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): failed to get MSVC version from ' + default_toolset_file) return False - if host_platform == 'amd64': - host_dir = "Hostx64" - elif host_platform == 'x86': - host_dir = "Hostx86" - else: - debug('_check_cl_exists_in_vc_dir(): unsupported host platform ' + host_platform) + host_trgt_dir = _HOST_TRGT_TO_CL_DIR_GREATER_THAN_14.get((host_platform, target_platform), None) + if not host_trgt_dir: + debug('_check_cl_exists_in_vc_dir(): unsupported host/target platform combo') return False - if target_platform == 'amd64': - target_dir = "x64" - elif target_platform in ('x86', 'arm', 'arm64'): - target_dir = target_platform - else: - debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) - return False - - cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_dir, target_dir, _CL_EXE_NAME) + cl_path = os.path.join(vc_dir, r'Tools\MSVC', vc_specific_version, 'bin', host_trgt_dir, _CL_EXE_NAME) debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) if os.path.exists(cl_path): debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') @@ -446,21 +457,23 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): elif ver_num <= 14 and ver_num >= 8: - if host_platform not in ('amd64','x86'): - debug('_check_cl_exists_in_vc_dir(): unsupported host platform ' + host_platform) - return False - - if target_platform not in ('amd64','x86', 'ia64', 'arm' , 'arm64'): - debug('_check_cl_exists_in_vc_dir(): unsupported target platform ' + target_platform) + host_trgt_dir = _HOST_TRGT_TO_CL_DIR.get((host_platform, target_platform), None) + if not host_trgt_dir: + debug('_check_cl_exists_in_vc_dir(): unsupported host/target platform combo') return False - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir(host_platform, target_platform) + _CL_EXE_NAME) + cl_path = os.path.join(vc_dir, 'bin', host_trgt_dir, _CL_EXE_NAME) debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) if not cl_path_exists and host_platform == 'amd64': # older versions of visual studio only had x86 binaries, so if the host platform is amd64, we need to check cross compile options (x86 binary compiles some other target on a 64 bit os) - cl_path = os.path.join(vc_dir, 'bin\\' + _get_host_target_dir('x86', target_platform) + _CL_EXE_NAME) + + host_trgt_dir = _HOST_TRGT_TO_CL_DIR.get(('x86', target_platform), None) + if not host_trgt_dir: + return False + + cl_path = os.path.join(vc_dir, 'bin', host_trgt_dir, _CL_EXE_NAME) debug('_check_cl_exists_in_vc_dir(): checking for ' + _CL_EXE_NAME + ' at ' + cl_path) cl_path_exists = os.path.exists(cl_path) diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py index bf82114..6adc598 100644 --- a/src/engine/SCons/Tool/msvsTests.py +++ b/src/engine/SCons/Tool/msvsTests.py @@ -540,6 +540,10 @@ def DummyQueryValue(key, value): def DummyExists(path): return 1 +def DummyVsWhere(msvc_version): + # not testing versions with vswhere, so return none + return None + class msvsTestCase(unittest.TestCase): """This test case is run several times with different defaults. See its subclasses below.""" @@ -809,6 +813,7 @@ if __name__ == "__main__": SCons.Util.RegEnumKey = DummyEnumKey SCons.Util.RegEnumValue = DummyEnumValue SCons.Util.RegQueryValueEx = DummyQueryValue + SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere os.path.exists = DummyExists # make sure all files exist :-) os.path.isfile = DummyExists # make sure all files are files :-) -- cgit v0.12 From b1141a34a2e9281f973ecb6b5bbf9280755ce40e Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 15:04:56 -0600 Subject: update comment --- src/engine/SCons/Tool/MSCommon/vc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index ec63fba..6c46049 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -467,8 +467,9 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): cl_path_exists = os.path.exists(cl_path) if not cl_path_exists and host_platform == 'amd64': - # older versions of visual studio only had x86 binaries, so if the host platform is amd64, we need to check cross compile options (x86 binary compiles some other target on a 64 bit os) - + # older versions of visual studio only had x86 binaries, + # so if the host platform is amd64, we need to check cross + # compile options (x86 binary compiles some other target on a 64 bit os) host_trgt_dir = _HOST_TRGT_TO_CL_DIR.get(('x86', target_platform), None) if not host_trgt_dir: return False -- cgit v0.12 From 53c892c123ac9ea3d4f1cdb3e5e0e1887e8c73a4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 21:19:15 -0600 Subject: updated changes.txt --- src/CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4baf70a..9f53b1d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -8,16 +8,16 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From John Doe: - - Whatever John Doe did. + From Daniel Moody: + - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. From William Deegan: - - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added to the release packages. - Modify scons.bat script to check for scons python script without .py extension if no file -- cgit v0.12 From 5fd70fdb0910f4463ecee64218f4cae74cecc15c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 21:33:08 -0600 Subject: fix changes.txt and added some comments --- src/CHANGES.txt | 23 ++++++++++++++--------- src/engine/SCons/Tool/MSCommon/vc.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index dbebb6d..8925d5a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,25 +5,30 @@ Change Log -RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 - NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 - content. +RELEASE VERSION/DATE TO BE FILLED IN LATER + From John Doe: + - Whatever John Doe did. + From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. - From William Deegan: - - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added - to the release packages. - - Modify scons.bat script to check for scons python script without .py extension if no file - scons.py exists. This enables an all platform wheel to work. - From Mats Wichmann: - Update doc examples to work with Python 3.5+: map() now returns an iterable instead of a list. - Improve finding of Microsoft compiler: add a 'products' wildcard in case 2017 Build Tools only is installed as it is considered a separate product from the default Visual Studio +RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 + NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 + content. + + From William Deegan: + - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added + to the release packages. + - Modify scons.bat script to check for scons python script without .py extension if no file + scons.py exists. This enables an all platform wheel to work. + RELEASE 3.0.2 - Mon, 31 Dec 2018 16:00:12 -0700 From Bernard Blackham: diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 6c46049..67f3dcc 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -89,6 +89,8 @@ _ARCH_TO_CANONICAL = { "aarch64" : "arm64", } +# get path to the cl.exe dir for newer VS versions +# based off a tuple of (host, target) platforms _HOST_TRGT_TO_CL_DIR_GREATER_THAN_14 = { ("amd64","amd64") : "Hostx64\\x64", ("amd64","x86") : "Hostx64\\x86", @@ -100,6 +102,8 @@ _HOST_TRGT_TO_CL_DIR_GREATER_THAN_14 = { ("x86","arm64") : "Hostx86\\arm64", } +# get path to the cl.exe dir for older VS versions +# based off a tuple of (host, target) platforms _HOST_TRGT_TO_CL_DIR = { ("amd64","amd64") : "amd64", ("amd64","x86") : "amd64_x86", @@ -131,6 +135,19 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = { _CL_EXE_NAME = 'cl.exe' def get_msvc_version_numeric(msvc_version): + """Get the raw version numbers from a MSVC_VERSION string, so it + could be cast to float or other numeric values. For example, '14.0Exp' + would get converted to '14.0'. + + Args: + msvc_version: str + string representing the version number, could contain non + digit characters + + Returns: + str: the value converted to a numeric only string + + """ return ''.join([x for x in msvc_version if x in string_digits + '.']) def get_host_target(env): @@ -411,6 +428,25 @@ def _get_host_target_dir(host_platform, target_platform): return host_target_dir def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): + """Find the cl.exe on the filesystem in the vc_dir depending on + TARGET_ARCH, HOST_ARCH and the msvc version. TARGET_ARCH and + HOST_ARCH can be extracted from the passed env, unless its None, + which then the native platform is assumed the host and target. + + Args: + env: Environment + a construction environment, usually if this is passed its + because there is a desired TARGET_ARCH to be used when searching + for a cl.exe + vc_dir: str + the path to the VC dir in the MSVC installation + msvc_version: str + msvc version (major.minor, e.g. 10.0) + + Returns: + bool: + + """ # determine if there is a specific target platform we want to build for and # use that to find a list of valid VCs, default is host platform == target platform -- cgit v0.12 From 36c170d87f89e6ea96c7c4bae1a04963d71d317f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 21:51:31 -0600 Subject: accidently reset changes, so recommiting --- src/engine/SCons/Platform/__init__.py | 22 ++++++++++++++-- test/TEMPFILEPREFIX.py | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 8784d5e..8117e60 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -243,8 +243,9 @@ class TempFileMunge(object): source) if self.cmdstr is not None else '' # Print our message only if XXXCOMSTR returns an empty string if len(cmdstr) == 0 : - print("Using tempfile "+native_tmp+" for command line:\n"+ - str(cmd[0]) + " " + " ".join(args)) + cmdstr = ("Using tempfile "+native_tmp+" for command line:\n"+ + str(cmd[0]) + " " + " ".join(args)) + self._print_cmd_str(target, source, env, cmdstr) # Store the temporary file command list into the target Node.attributes # to avoid creating two temporary files one for print and one for execute. @@ -256,6 +257,23 @@ class TempFileMunge(object): pass return cmdlist + def _print_cmd_str(self, target, source, env, cmdstr): + # check if the user has specified a cmd line print function + print_func = None + try: + get = env.get + except AttributeError: + pass + else: + print_func = get('PRINT_CMD_LINE_FUNC') + + # use the default action cmd line print if user did not supply one + if not print_func: + action = SCons.Action._ActionAction() + action.print_cmd_line(cmdstr, target, source, env) + else: + print_func(cmdstr, target, source, env) + def Platform(name = platform_default()): """Select a canned Platform specification. diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py index c47ebc4..7f4322b 100644 --- a/test/TEMPFILEPREFIX.py +++ b/test/TEMPFILEPREFIX.py @@ -67,6 +67,55 @@ xxx.py foo.out foo.in xxx.py -via\\S+ """) +test.write('SConstruct', """ +import os + +def print_cmd_line(s, targets, sources, env): + pass + +env = Environment( + BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', + MAXLINELENGTH = 16, + TEMPFILEPREFIX = '-via', + PRINT_CMD_LINE_FUNC=print_cmd_line +) +env.AppendENVPath('PATH', os.curdir) +env.Command('foo.out', 'foo.in', '$BUILDCOM') +""") + +test.run(arguments = '-n -Q .', + stdout = """""") + +test.write('SConstruct', """ +import os +from SCons.Platform import TempFileMunge + +class TestTempFileMunge(TempFileMunge): + + def __init__(self, cmd, cmdstr = None): + super(TestTempFileMunge, self).__init__(cmd, cmdstr) + + def _print_cmd_str(self, target, source, env, cmdstr): + super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr) + +env = Environment( + TEMPFILE = TestTempFileMunge, + BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', + MAXLINELENGTH = 16, + TEMPFILEPREFIX = '-via', + +) +env.AppendENVPath('PATH', os.curdir) +env.Command('foo.out', 'foo.in', '$BUILDCOM') +""") + +test.run(arguments = '-n -Q .', + stdout = """\ +Using tempfile \\S+ for command line: +xxx.py foo.out foo.in +xxx.py -via\\S+ +""") + test.pass_test() # Local Variables: -- cgit v0.12 From 03a1cb0d3117ce297030010a813e14551185d99d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Jan 2019 16:01:37 -0600 Subject: accidently moved a change in CHANGES.txt, moving it back removed unused function --- src/CHANGES.txt | 5 ++++- src/engine/SCons/Tool/MSCommon/vc.py | 14 -------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8925d5a..a12fedb 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,7 +14,6 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. From Mats Wichmann: - - Update doc examples to work with Python 3.5+: map() now returns an iterable instead of a list. - Improve finding of Microsoft compiler: add a 'products' wildcard in case 2017 Build Tools only is installed as it is considered a separate product from the default Visual Studio @@ -29,6 +28,10 @@ RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 - Modify scons.bat script to check for scons python script without .py extension if no file scons.py exists. This enables an all platform wheel to work. + From Mats Wichmann: + - Update doc examples to work with Python 3.5+: map() now returns an iterable instead of a list. + + RELEASE 3.0.2 - Mon, 31 Dec 2018 16:00:12 -0700 From Bernard Blackham: diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 67f3dcc..8cc85f6 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -413,20 +413,6 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): __INSTALLED_VCS_RUN = None -def _get_host_target_dir(host_platform, target_platform): - - host_target_dir = _HOST_TARGET_ARCH_TO_BAT_ARCH.get((host_platform, target_platform), False) - - if not host_target_dir: - debug('_check_cl_exists_in_vc_dir(): unsupported host/target combination' + host_target_dir) - return False - elif host_target_dir in 'x86': - host_target_dir == '' - else: - host_target_dir += '\\' - - return host_target_dir - def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): """Find the cl.exe on the filesystem in the vc_dir depending on TARGET_ARCH, HOST_ARCH and the msvc version. TARGET_ARCH and -- cgit v0.12 From 14795955fe1d7cfbeb758cf58fc5d87d737a0384 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Jan 2019 22:35:06 -0600 Subject: updated documentation --- src/engine/SCons/Tool/msvc.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index d4ffe0d..dacdcba 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -353,6 +353,7 @@ constructor; setting it later has no effect. Valid values for Windows are +14.1, 14.0, 14.0Exp, 12.0, @@ -425,18 +426,24 @@ This variable must be passed as an argument to the Environment() constructor; setting it later has no effect. This is currently only used on Windows, but in the future it will be used on other OSes as well. +If this is set and MSVC_VERSION is not set, this will search for +all installed MSVC's that support the TARGET_ARCH, selecting the +latest version for use. Valid values for Windows are x86, +arm, i386 (for 32 bits); amd64, +arm64, emt64, x86_64 (for 64 bits); and ia64 (Itanium). + For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. -- cgit v0.12 From 247001f13f3816f74cc4d5eba41efa2aa38a3b4a Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 14 Jan 2019 11:36:28 -0600 Subject: updated platform dict names and used context manager for opening toolset version file updated other dict references --- src/engine/SCons/Tool/MSCommon/vc.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 8cc85f6..c4ba803 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -91,7 +91,7 @@ _ARCH_TO_CANONICAL = { # get path to the cl.exe dir for newer VS versions # based off a tuple of (host, target) platforms -_HOST_TRGT_TO_CL_DIR_GREATER_THAN_14 = { +_HOST_TARGET_TO_CL_DIR_GREATER_THAN_14 = { ("amd64","amd64") : "Hostx64\\x64", ("amd64","x86") : "Hostx64\\x86", ("amd64","arm") : "Hostx64\\arm", @@ -104,7 +104,7 @@ _HOST_TRGT_TO_CL_DIR_GREATER_THAN_14 = { # get path to the cl.exe dir for older VS versions # based off a tuple of (host, target) platforms -_HOST_TRGT_TO_CL_DIR = { +_HOST_TARGET_TO_CL_DIR = { ("amd64","amd64") : "amd64", ("amd64","x86") : "amd64_x86", ("amd64","arm") : "amd64_arm", @@ -457,16 +457,16 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): #TODO: support setting a specific minor VC version default_toolset_file = os.path.join(vc_dir, r'Auxiliary\Build\Microsoft.VCToolsVersion.default.txt') try: - f = open(default_toolset_file) - vc_specific_version = f.readlines()[0].strip() - except OSError: - debug('_check_cl_exists_in_vc_dir(): failed to open ' + default_toolset_file) + with open(default_toolset_file) as f: + vc_specific_version = f.readlines()[0].strip() + except IOError: + debug('_check_cl_exists_in_vc_dir(): failed to read ' + default_toolset_file) return False except IndexError: - debug('_check_cl_exists_in_vc_dir(): failed to get MSVC version from ' + default_toolset_file) + debug('_check_cl_exists_in_vc_dir(): failed to find MSVC version in ' + default_toolset_file) return False - host_trgt_dir = _HOST_TRGT_TO_CL_DIR_GREATER_THAN_14.get((host_platform, target_platform), None) + host_trgt_dir = _HOST_TARGET_TO_CL_DIR_GREATER_THAN_14.get((host_platform, target_platform), None) if not host_trgt_dir: debug('_check_cl_exists_in_vc_dir(): unsupported host/target platform combo') return False @@ -479,7 +479,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): elif ver_num <= 14 and ver_num >= 8: - host_trgt_dir = _HOST_TRGT_TO_CL_DIR.get((host_platform, target_platform), None) + host_trgt_dir = _HOST_TARGET_TO_CL_DIR.get((host_platform, target_platform), None) if not host_trgt_dir: debug('_check_cl_exists_in_vc_dir(): unsupported host/target platform combo') return False @@ -492,7 +492,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): # older versions of visual studio only had x86 binaries, # so if the host platform is amd64, we need to check cross # compile options (x86 binary compiles some other target on a 64 bit os) - host_trgt_dir = _HOST_TRGT_TO_CL_DIR.get(('x86', target_platform), None) + host_trgt_dir = _HOST_TARGET_TO_CL_DIR.get(('x86', target_platform), None) if not host_trgt_dir: return False -- cgit v0.12 From b04db00ba0818a1f22c08491b50fc7977cbe8bbd Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 15 Jan 2019 17:28:02 -0700 Subject: [WIP] customizable tempfile extension (issue #2431) Apply the patch (adjusted) from issue #2341: instead of hardcoding the filename extenstion for the tempfile to help with linking on Windows targets, allow some variability. Current marked WIP because there are some other comments in the issue tracker that can maybe be flushed out by submitting this PR, and there are no tests (should presumably go in test/TEMPFILEPREFIX.py, or a new test TEMPFILEEXTENSION.py) Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 2 ++ src/engine/SCons/Platform/__init__.py | 35 +++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2c0cef6..8059f5d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Improve finding of Microsoft compiler: add a 'products' wildcard in case 2017 Build Tools only is installed as it is considered a separate product from the default Visual Studio + - Add TEMPFILEEXTENSION as in the patch attached to issue #2431, + updated to current codebase. From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 8117e60..75c4839 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -144,15 +144,20 @@ class TempFileMunge(object): line limitation. Example usage: - env["TEMPFILE"] = TempFileMunge - env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES','$LINKCOMSTR')}" + env["TEMPFILE"] = TempFileMunge + env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES','$LINKCOMSTR')}" By default, the name of the temporary file used begins with a - prefix of '@'. This may be configred for other tool chains by - setting '$TEMPFILEPREFIX'. - - env["TEMPFILEPREFIX"] = '-@' # diab compiler - env["TEMPFILEPREFIX"] = '-via' # arm tool chain + prefix of '@'. This may be configured for other tool chains by + setting '$TEMPFILEPREFIX': + env["TEMPFILEPREFIX"] = '-@' # diab compiler + env["TEMPFILEPREFIX"] = '-via' # arm tool chain + env["TEMPFILEPREFIX"] = '' # (the empty string) PC Lint + + You can configure the extension of the temporary file through the + TEMPFILEEXTENSION variable, which defaults to '.lnk' (see comments + in the code below): + env["TEMPFILEEXTENSION"] = '.lnt' # PC Lint """ def __init__(self, cmd, cmdstr = None): self.cmd = cmd @@ -194,16 +199,21 @@ class TempFileMunge(object): # We do a normpath because mktemp() has what appears to be # a bug in Windows that will use a forward slash as a path - # delimiter. Windows's link mistakes that for a command line + # delimiter. Windows' link mistakes that for a command line # switch and barfs. # # We use the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - (fd, tmp) = tempfile.mkstemp('.lnk', text=True) + if env.has_key('TEMPFILEEXTENSION'): + extension = env.subst('$TEMPFILEEXTENSION') + else: + extension = '.lnk' # TODO: better way to pick default? + (fd, tmp) = tempfile.mkstemp(extension, text=True) + native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) - if env.get('SHELL',None) == 'sh': + if env.get('SHELL', None) == 'sh': # The sh shell will try to escape the backslashes in the # path, so unescape them. native_tmp = native_tmp.replace('\\', r'\\\\') @@ -216,8 +226,9 @@ class TempFileMunge(object): # Windows path names. rm = 'del' - prefix = env.subst('$TEMPFILEPREFIX') - if not prefix: + if env.has_key('TEMPFILEPREFIX'): + prefix = env.subst('$TEMPFILEPREFIX') + else: prefix = '@' args = list(map(SCons.Subst.quote_spaces, cmd[1:])) -- cgit v0.12 From 8c669448e9ef3bcd7c3c16a81beb56770ae7b445 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 16 Jan 2019 13:04:23 -0700 Subject: Change TEMPFILEEXTENSION to TEMPFILESUFFIX All the other file extension variables end in SUFFIX, so change this new one to match for consistency. Added doc entry. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 4 ++-- src/engine/SCons/Platform/__init__.py | 8 ++++---- src/engine/SCons/Platform/__init__.xml | 24 ++++++++++++++++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8059f5d..450052c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,8 +14,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Improve finding of Microsoft compiler: add a 'products' wildcard in case 2017 Build Tools only is installed as it is considered a separate product from the default Visual Studio - - Add TEMPFILEEXTENSION as in the patch attached to issue #2431, - updated to current codebase. + - Add TEMPFILESUFFIX to allow a customizable filename extension, as + described in the patch attached to issue #2431. From Daniel Moody: - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 75c4839..db5b947 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -205,11 +205,11 @@ class TempFileMunge(object): # We use the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - if env.has_key('TEMPFILEEXTENSION'): - extension = env.subst('$TEMPFILEEXTENSION') + if env.has_key('TEMPFILESUFFIX'): + suffix = env.subst('$TEMPFILESUFFIX') else: - extension = '.lnk' # TODO: better way to pick default? - (fd, tmp) = tempfile.mkstemp(extension, text=True) + suffix = '.lnk' # TODO: better way to pick default? + fd, tmp = tempfile.mkstemp(suffix, text=True) native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) diff --git a/src/engine/SCons/Platform/__init__.xml b/src/engine/SCons/Platform/__init__.xml index 0802369..f113278 100644 --- a/src/engine/SCons/Platform/__init__.xml +++ b/src/engine/SCons/Platform/__init__.xml @@ -232,13 +232,29 @@ The suffix used for shared object file names. The prefix for a temporary file used -to execute lines longer than $MAXLINELENGTH. -The default is '@'. -This may be set for toolchains that use other values, -such as '-@' for the diab compiler +to store lines lines longer than $MAXLINELENGTH +as operations which call out to a shell will fail +if the line is too long, which particularly +impacts linking. +The default is '@', which works for the Microsoft +and GNU toolchains on Windows. +Set this appropriately for other toolchains, +for example '-@' for the diab compiler or '-via' for ARM toolchain. + + + +The suffix used for the temporary file name +used for long command lines. The name should +include the dot ('.') if one is wanted as +it will not be added automatically. +The default is '.lnk'. + + + + -- cgit v0.12 From cf33e092a699cb72031105a1b23ae09c962beffc Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 16 Jan 2019 14:53:07 -0700 Subject: Add test for TEMPFILESUFFIX Signed-off-by: Mats Wichmann --- test/TEMPFILEPREFIX.py | 7 +-- test/TEMPFILESUFFIX.py | 126 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 test/TEMPFILESUFFIX.py diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py index 7f4322b..f5093e1 100644 --- a/test/TEMPFILEPREFIX.py +++ b/test/TEMPFILEPREFIX.py @@ -25,8 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that setting the $TEMPFILEPREFIX variable will append to the -beginning of the TEMPFILE invocation of a long command line. +Verify that setting the $TEMPFILEPREFIX variable will cause +it to appear at the front of name of the generated tempfile +used for long command lines. """ import os @@ -97,7 +98,7 @@ class TestTempFileMunge(TempFileMunge): def _print_cmd_str(self, target, source, env, cmdstr): super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr) - + env = Environment( TEMPFILE = TestTempFileMunge, BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', diff --git a/test/TEMPFILESUFFIX.py b/test/TEMPFILESUFFIX.py new file mode 100644 index 0000000..aee1e2d --- /dev/null +++ b/test/TEMPFILESUFFIX.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that setting the $TEMPFILESUFFIX variable will cause +it to appear at the end of name of the generated tempfile +used for long command lines. +""" + +import os +import stat + +import TestSCons + +test = TestSCons.TestSCons(match=TestSCons.match_re) + +test.write('echo.py', """\ +from __future__ import print_function +import sys +print(sys.argv) +""") + +echo_py = test.workpath('echo.py') + +st = os.stat(echo_py) +os.chmod(echo_py, st[stat.ST_MODE] | 0o111) + +test.write('SConstruct', """ +import os +env = Environment( + BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', + MAXLINELENGTH = 16, + TEMPFILESUFFIX = '.foo', +) +env.AppendENVPath('PATH', os.curdir) +env.Command('foo.out', 'foo.in', '$BUILDCOM') +""") + +test.write('foo.in', "foo.in\n") + +test.run(arguments = '-n -Q .', + stdout = """\ +Using tempfile \\S+ for command line: +xxx.py foo.out foo.in +xxx.py \\S+ +""") + +test.write('SConstruct', """ +import os + +def print_cmd_line(s, targets, sources, env): + pass + +env = Environment( + BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', + MAXLINELENGTH = 16, + TEMPFILESUFFIX = '.foo', + PRINT_CMD_LINE_FUNC=print_cmd_line +) +env.AppendENVPath('PATH', os.curdir) +env.Command('foo.out', 'foo.in', '$BUILDCOM') +""") + +test.run(arguments = '-n -Q .', + stdout = """""") + +test.write('SConstruct', """ +import os +from SCons.Platform import TempFileMunge + +class TestTempFileMunge(TempFileMunge): + + def __init__(self, cmd, cmdstr = None): + super(TestTempFileMunge, self).__init__(cmd, cmdstr) + + def _print_cmd_str(self, target, source, env, cmdstr): + super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr) + +env = Environment( + TEMPFILE = TestTempFileMunge, + BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}', + MAXLINELENGTH = 16, + TEMPFILESUFFIX = '.foo', + +) +env.AppendENVPath('PATH', os.curdir) +env.Command('foo.out', 'foo.in', '$BUILDCOM') +""") + +test.run(arguments = '-n -Q .', + stdout = """\ +Using tempfile \\S+ for command line: +xxx.py foo.out foo.in +xxx.py \\S+ +""") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 79f4f1bddfc6495fc924e66928b9d06a6128cf1b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 16 Jan 2019 16:58:27 -0700 Subject: Set defaults for TEMPFILE* differently Per review comments, subst either return the right thing or None, use this are the way to test for setting default instead of has_key. Signed-off-by: Mats Wichmann --- src/engine/SCons/Platform/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index db5b947..ab064ce 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -205,12 +205,11 @@ class TempFileMunge(object): # We use the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - if env.has_key('TEMPFILESUFFIX'): - suffix = env.subst('$TEMPFILESUFFIX') - else: - suffix = '.lnk' # TODO: better way to pick default? - fd, tmp = tempfile.mkstemp(suffix, text=True) + suffix = env.subst('$TEMPFILESUFFIX') + if not suffix: + suffix = '.lnk' + fd, tmp = tempfile.mkstemp(suffix, text=True) native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) if env.get('SHELL', None) == 'sh': @@ -226,9 +225,8 @@ class TempFileMunge(object): # Windows path names. rm = 'del' - if env.has_key('TEMPFILEPREFIX'): - prefix = env.subst('$TEMPFILEPREFIX') - else: + prefix = env.subst('$TEMPFILEPREFIX') + if not prefix: prefix = '@' args = list(map(SCons.Subst.quote_spaces, cmd[1:])) -- cgit v0.12 From 0ec7ba737006c4935726f59847add5782c7657b5 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 17 Jan 2019 10:23:30 -0700 Subject: TEMPFILEPRFIX test changed back Testing "if not prefix" would return false if an empty string is passed, but that setting should be valid. Signed-off-by: Mats Wichmann --- src/engine/SCons/Platform/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index ab064ce..3168378 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -194,7 +194,7 @@ class TempFileMunge(object): node = target[0] if SCons.Util.is_List(target) else target cmdlist = getattr(node.attributes, 'tempfile_cmdlist', None) \ if node is not None else None - if cmdlist is not None : + if cmdlist is not None: return cmdlist # We do a normpath because mktemp() has what appears to be @@ -202,11 +202,12 @@ class TempFileMunge(object): # delimiter. Windows' link mistakes that for a command line # switch and barfs. # - # We use the .lnk suffix for the benefit of the Phar Lap + # Default to the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - suffix = env.subst('$TEMPFILESUFFIX') - if not suffix: + if env.has_key('TEMPFILESUFFIX'): + suffix = env.subst('$TEMPFILESUFFIX') + else: suffix = '.lnk' fd, tmp = tempfile.mkstemp(suffix, text=True) -- cgit v0.12 From 4fcc152faa3eecfb4f21219ffb373b9c743b0365 Mon Sep 17 00:00:00 2001 From: Tobias Herzog Date: Fri, 18 Jan 2019 21:35:49 +0100 Subject: Enhance cpp scanner regex logic to detect if/elif expressions without whitespaces correctly for example "#if(defined FOO)" or "#elif!(BAR)" --- src/CHANGES.txt | 4 ++ src/engine/SCons/cpp.py | 9 ++-- src/engine/SCons/cppTests.py | 107 ++++++++++++++++++++++++++++++++++++++++++- src/script/scons.py | 0 4 files changed, 115 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/script/scons.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2c0cef6..57f8c99 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -19,6 +19,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets. - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC + From Tobias Herzog + - Enhance cpp scanner regex logic to detect if/elif expressions without whitespaces but + parenthesis like "#if(defined FOO)" or "#elif!(BAR)" correctly. + RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400 NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2 content. diff --git a/src/engine/SCons/cpp.py b/src/engine/SCons/cpp.py index d2178a7..cdd3923 100644 --- a/src/engine/SCons/cpp.py +++ b/src/engine/SCons/cpp.py @@ -43,10 +43,13 @@ import re # that we want to fetch, using the regular expressions to which the lists # of preprocessor directives map. cpp_lines_dict = { - # Fetch the rest of a #if/#elif/#ifdef/#ifndef as one argument, + # Fetch the rest of a #if/#elif as one argument, + # with white space optional. + ('if', 'elif') : '\s*(.+)', + + # Fetch the rest of a #ifdef/#ifndef as one argument, # separated from the keyword by white space. - ('if', 'elif', 'ifdef', 'ifndef',) - : '\s+(.+)', + ('ifdef', 'ifndef',): '\s+(.+)', # Fetch the rest of a #import/#include/#include_next line as one # argument, with white space optional. diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py index d496273..ebf7fde 100644 --- a/src/engine/SCons/cppTests.py +++ b/src/engine/SCons/cppTests.py @@ -363,6 +363,62 @@ ifndef_input = """ """ +if_defined_no_space_input = """ +#define DEFINED 0 + +#if(defined DEFINED) +#include "file47-yes" +#endif + +#if(!defined DEFINED) +#include +#elif(!defined DEFINED) +#include +#else +#include +#endif + +#if!(defined DEFINED) +#include "file51-no" +#elif!(defined DEFINED) +#include +#else +#include "file53-yes" +#endif +""" + +if_no_space_input = """ +#define DEFINED 0 + +#if(DEFINED) +#include "file54-no" +#endif + +#if!(DEFINED) +#include +#elif!(DEFINED) +#include +#endif + +#if(DEFINED) +#include "file57-no" +#elif(!DEFINED) +#include +#endif + +#if!( DEFINED) +#include "file59-yes" +#elif!( DEFINED) +#include +#endif + +#if( DEFINED) +#include "file61-no" +#elif(! DEFINED) +#include +#endif +""" + # pp_class = PreProcessor # #pp_class = DumbPreProcessor @@ -450,6 +506,19 @@ class cppTestCase(unittest.TestCase): result = self.cpp.process_contents(ifndef_input) assert expect == result, (expect, result) + def test_if_defined_no_space(self): + """Test #if(defined, i.e.without space but parenthesis""" + expect = self.if_defined_no_space_expect + result = self.cpp.process_contents(if_defined_no_space_input) + assert expect == result, (expect, result) + + def test_if_no_space(self): + """Test #if(, i.e. without space but parenthesis""" + expect = self.if_no_space_expect + result = self.cpp.process_contents(if_no_space_input) + assert expect == result, (expect, result) + + class cppAllTestCase(cppTestCase): def setUp(self): self.cpp = self.cpp_class(current = ".", @@ -541,7 +610,20 @@ class PreProcessorTestCase(cppAllTestCase): ('include', '"', 'file45-yes'), ('include', '<', 'file46-yes'), ] - + + if_defined_no_space_expect = [ + ('include', '"', 'file47-yes'), + ('include', '<', 'file50-yes'), + ('include', '"', 'file53-yes'), + ] + + if_no_space_expect = [ + ('include', '<', 'file55-yes'), + ('include', '<', 'file58-yes'), + ('include', '"', 'file59-yes'), + ('include', '<', 'file62-yes'), + ] + class DumbPreProcessorTestCase(cppAllTestCase): cpp_class = cpp.DumbPreProcessor @@ -654,7 +736,6 @@ class DumbPreProcessorTestCase(cppAllTestCase): ('include', '"', 'file7-yes') ] - ifndef_expect = [ ('include', '"', 'file45-no'), ('include', '"', 'file45-yes'), @@ -662,6 +743,28 @@ class DumbPreProcessorTestCase(cppAllTestCase): ('include', '<', 'file46-no'), ] + if_defined_no_space_expect = [ + ('include', '"', 'file47-yes'), + ('include', '<', 'file48-no'), + ('include', '<', 'file49-no'), + ('include', '<', 'file50-yes'), + ('include', '"', 'file51-no'), + ('include', '<', 'file52-no'), + ('include', '"', 'file53-yes'), + ] + + if_no_space_expect = [ + ('include', '"', 'file54-no'), + ('include', '<', 'file55-yes'), + ('include', '<', 'file56-no'), + ('include', '"', 'file57-no'), + ('include', '<', 'file58-yes'), + ('include', '"', 'file59-yes'), + ('include', '<', 'file60-no'), + ('include', '"', 'file61-no'), + ('include', '<', 'file62-yes'), + ] + import os import re import shutil diff --git a/src/script/scons.py b/src/script/scons.py old mode 100644 new mode 100755 -- cgit v0.12