From 0eaef4f2b8064882e7497695ba352c719b543dc8 Mon Sep 17 00:00:00 2001 From: William Deegan <bill@baddogconsulting.com> Date: Thu, 6 Jul 2017 11:54:40 -0400 Subject: python micro optimization in faster than find --- src/engine/SCons/PathList.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py index 77e30c4..76cbeab 100644 --- a/src/engine/SCons/PathList.py +++ b/src/engine/SCons/PathList.py @@ -104,11 +104,11 @@ class _PathList(object): pl = [] for p in pathlist: try: - index = p.find('$') + found = '$' in p except (AttributeError, TypeError): type = TYPE_OBJECT else: - if index == -1: + if not found: type = TYPE_STRING_NO_SUBST else: type = TYPE_STRING_SUBST -- cgit v0.12 From d2b59cc6d18e5d3139f623ab4285de34b3dd5596 Mon Sep 17 00:00:00 2001 From: William Deegan <bill@baddogconsulting.com> Date: Mon, 10 Jul 2017 15:01:04 -0400 Subject: py2/3 always convert stdin to bytes if py3. Previously was 3.5 only --- QMTest/TestCmd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 00d61d3..0aab9a8 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -1516,8 +1516,8 @@ class TestCmd(object): if is_List(stdin): stdin = ''.join(stdin) - if stdin and IS_PY3 and sys.version_info[1] < 6: - stdin = bytearray(stdin,'utf-8') + if stdin and IS_PY3:# and sys.version_info[1] < 6: + stdin = to_bytes(stdin) # TODO(sgk): figure out how to re-use the logic in the .finish() # method above. Just calling it from here causes problems with -- cgit v0.12 From 506a8fefa9fa26a057e1464be2db8680b90339b4 Mon Sep 17 00:00:00 2001 From: Ibrahim Esmat <iesmat@microsoft.com> Date: Fri, 21 Jul 2017 10:54:55 -0700 Subject: Windows: Added the capability to build Windows Store Compatible libraries that can be used with Universal Windows Platform (UWP) Apps and published to the Windows Store --- src/CHANGES.txt | 4 ++++ src/engine/SCons/Tool/MSCommon/vc.py | 21 ++++++++++++++------- src/engine/SCons/Tool/msvc.xml | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5be0399..c585eaf 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,6 +11,10 @@ NOTE: This is a major release. You should expect that some targets may rebuild Significant changes in some python action signatures. Also switching between PY 2 and PY 3.5, 3.6 may cause rebuilds. In no case should rebuilds not happen. + From Ibrahim Esmat: + - Added the capability to build Windows Store Compatible libraries that can be used + with Universal Windows Platform (UWP) Apps and published to the store + From Richard West: - Added nested / namespace tool support - Added a small fix to the python3 tool loader when loading a tool as a package diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 7b8dd9d..ff48e01 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -82,7 +82,7 @@ _ARCH_TO_CANONICAL = { "itanium" : "ia64", "x86" : "x86", "x86_64" : "amd64", - "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits + "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits } # Given a (host, target) tuple, return the argument for the bat file. Both host @@ -185,18 +185,17 @@ _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 + '.']) t = msvc_version_numeric.split(".") if not len(t) == 2: - raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) + raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) try: - maj = int(t[0]) - min = int(t[1]) - return maj, min + maj = int(t[0]) + min = int(t[1]) + return maj, min except ValueError as e: - raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) + 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 @@ -435,6 +434,14 @@ 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+ + if maj >= 14: + if env.get('UWP_APP') == '1': + # Initialize environment variables with store/universal paths + arg += ' store' # Try to locate a batch file for this host/target platform combo try: diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index 2b4619e..18f4fb6 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -352,6 +352,8 @@ constructor; setting it later has no effect. <para> Valid values for Windows are +<literal>14.0</literal>, +<literal>14.0Exp</literal>, <literal>12.0</literal>, <literal>12.0Exp</literal>, <literal>11.0</literal>, @@ -440,4 +442,27 @@ For example, if you want to compile 64-bit binaries, you would set </summary> </cvar> +<cvar name="UWP_APP"> +<summary> +<para> +Build libraries for a Universal Windows Platform (UWP) Application. +</para> + +<para> +If &cv-UWP_APP; is set, the Visual Studio environment will be set up to point +to the Windows Store compatible libraries and Visual Studio runtimes. In doing so, +any libraries that are built will be able to be used in a UWP App and published +to the Windows Store. +This flag will only have an effect with Visual Studio 2015+. +This variable must be passed as an argument to the Environment() +constructor; setting it later has no effect. +</para> + +<para> +Valid values are '1' or '0' +</para> + +</summary> +</cvar> + </sconsdoc> -- cgit v0.12 From 990d7e365e97fa5f700aebd97e5ec699a6f69976 Mon Sep 17 00:00:00 2001 From: Ibrahim Esmat <iesmat@microsoft.com> Date: Fri, 21 Jul 2017 11:13:24 -0700 Subject: Windows: Added the capability to build Windows Store Compatible libraries Fixed whitespace --- 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 ff48e01..c0a1043 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -82,7 +82,7 @@ _ARCH_TO_CANONICAL = { "itanium" : "ia64", "x86" : "x86", "x86_64" : "amd64", - "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits + "x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits } # Given a (host, target) tuple, return the argument for the bat file. Both host -- cgit v0.12 From 696fe750f247bb4cadbbf8be6970e15af67e1e4b Mon Sep 17 00:00:00 2001 From: Ibrahim Esmat <iesmat@microsoft.com> Date: Mon, 24 Jul 2017 12:09:00 -0700 Subject: Change UWP_APP to be MSVC_UWP_APP --- src/engine/SCons/Tool/MSCommon/vc.py | 2 +- src/engine/SCons/Tool/msvc.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c0a1043..4126314 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -439,7 +439,7 @@ def msvc_find_valid_batch_script(env,version): maj, min = msvc_version_to_maj_min(version) # VS2015+ if maj >= 14: - if env.get('UWP_APP') == '1': + if env.get('MSVC_UWP_APP') == '1': # Initialize environment variables with store/universal paths arg += ' store' diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index 18f4fb6..1823a89 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -442,14 +442,14 @@ For example, if you want to compile 64-bit binaries, you would set </summary> </cvar> -<cvar name="UWP_APP"> +<cvar name="MSVC_UWP_APP"> <summary> <para> Build libraries for a Universal Windows Platform (UWP) Application. </para> <para> -If &cv-UWP_APP; is set, the Visual Studio environment will be set up to point +If &cv-MSVC_UWP_APP; is set, the Visual Studio environment will be set up to point to the Windows Store compatible libraries and Visual Studio runtimes. In doing so, any libraries that are built will be able to be used in a UWP App and published to the Windows Store. -- cgit v0.12 From 6537bede8fd7a346865cebfde59d3d4fe8f9cf1f Mon Sep 17 00:00:00 2001 From: Ibrahim Esmat <iesmat@microsoft.com> Date: Wed, 26 Jul 2017 00:26:08 -0700 Subject: Added MSVC_UWP_APP test to test setting MSVC_UWP_APP construction variable with desired effect. --- test/MSVC/MSVC_UWP_APP.py | 103 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 test/MSVC/MSVC_UWP_APP.py diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py new file mode 100644 index 0000000..b6012cc --- /dev/null +++ b/test/MSVC/MSVC_UWP_APP.py @@ -0,0 +1,103 @@ +#!/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 the ability to configure the $MSVC_UWP_APP construction variable with +the desired effect. +""" + +import TestSCons + +def AreVCStoreLibPathsInLIBPATH(output): + lines = output.splitlines() + for line in lines: + if 'env[ENV][LIBPATH]=' in line: + idx_eq = line.find('=') + libpath = line[idx_eq + 1:] + + if not libpath: + # Couldn't find the libpath in the output + return (False, False) + + libpaths = libpath.lower().split(';') + (vclibstore_path_present, vclibstorerefs_path_present) = (False, False) + for path in libpaths: + # Look for the Store VC Lib paths in the LIBPATH: + # [VS install path]\VC\LIB\store\ and + # [VS install path]\VC\LIB\store\references + # 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 'vc\\lib\\store\\references' in path: + vclibstorerefs_path_present = True + elif 'vc\\lib\\store' in path: + vclibstore_path_present = True + + return (vclibstore_path_present, vclibstorerefs_path_present) + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +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) +# Print the ENV LIBPATH to stdout +print ('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) +""") + +# Test setting MSVC_UWP_APP is '1' (True) +test.run(arguments = "MSVC_UWP_APP=1") +(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout()) +test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False)) + +# Test setting MSVC_UWP_APP is '0' (False) +test.run(arguments = "MSVC_UWP_APP=0") +(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout()) +test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True)) + +# Test not setting MSVC_UWP_APP +test.run(arguments = "") +(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout()) +test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True)) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 120b1633f2bc371df744fce06f5c5024fe59a174 Mon Sep 17 00:00:00 2001 From: Ibrahim Esmat <iesmat@microsoft.com> Date: Wed, 26 Jul 2017 11:39:13 -0700 Subject: Minor changes for Code Review --- test/MSVC/MSVC_UWP_APP.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py index b6012cc..2521ad6 100644 --- a/test/MSVC/MSVC_UWP_APP.py +++ b/test/MSVC/MSVC_UWP_APP.py @@ -46,14 +46,14 @@ def AreVCStoreLibPathsInLIBPATH(output): (vclibstore_path_present, vclibstorerefs_path_present) = (False, False) for path in libpaths: # Look for the Store VC Lib paths in the LIBPATH: - # [VS install path]\VC\LIB\store\ and + # [VS install path]\VC\LIB\store[\arch] and # [VS install path]\VC\LIB\store\references # 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 'vc\\lib\\store\\references' in path: + if r'vc\lib\store\references' in path: vclibstorerefs_path_present = True - elif 'vc\\lib\\store' in path: + elif r'vc\lib\store' in path: vclibstore_path_present = True return (vclibstore_path_present, vclibstorerefs_path_present) @@ -76,7 +76,7 @@ else: help_vars = None env = Environment(tools=['default', 'msvc'], variables=help_vars) # Print the ENV LIBPATH to stdout -print ('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) +print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH')) """) # Test setting MSVC_UWP_APP is '1' (True) -- cgit v0.12