summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/MSCommon/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Tool/MSCommon/common.py')
-rw-r--r--engine/SCons/Tool/MSCommon/common.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/engine/SCons/Tool/MSCommon/common.py b/engine/SCons/Tool/MSCommon/common.py
index e3fda5a..006e17e 100644
--- a/engine/SCons/Tool/MSCommon/common.py
+++ b/engine/SCons/Tool/MSCommon/common.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2013/03/03 09:48:35 garyo"
+__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2014/03/02 14:18:15 garyo"
__doc__ = """
Common helper functions for working with the Microsoft tool chain.
@@ -55,12 +55,12 @@ _is_win64 = None
def is_win64():
"""Return true if running on windows 64 bits.
-
+
Works whether python itself runs in 64 bits or 32 bits."""
# Unfortunately, python does not provide a useful way to determine
# if the underlying Windows OS is 32-bit or 64-bit. Worse, whether
# the Python itself is 32-bit or 64-bit affects what it returns,
- # so nothing in sys.* or os.* help.
+ # so nothing in sys.* or os.* help.
# Apparently the best solution is to use env vars that Windows
# sets. If PROCESSOR_ARCHITECTURE is not x86, then the python
@@ -120,11 +120,21 @@ def normalize_env(env, keys, force=False):
if k in os.environ and (force or not k in normenv):
normenv[k] = os.environ[k].encode('mbcs')
+ # This shouldn't be necessary, since the default environment should include system32,
+ # but keep this here to be safe, since it's needed to find reg.exe which the MSVC
+ # bat scripts use.
+ sys32_dir = os.path.join(os.environ.get("SystemRoot", os.environ.get("windir",r"C:\Windows\system32")),"System32")
+
+ if sys32_dir not in normenv['PATH']:
+ normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_dir
+
+ debug("PATH: %s"%normenv['PATH'])
+
return normenv
def get_output(vcbat, args = None, env = None):
"""Parse the output of given bat file, with given args."""
-
+
if env is None:
# Create a blank environment, for use in launching the tools
env = SCons.Environment.Environment(tools=[])
@@ -136,6 +146,9 @@ def get_output(vcbat, args = None, env = None):
# settings in vs.py.
vars = [
'COMSPEC',
+# VS100 and VS110: Still set, but modern MSVC setup scripts will
+# discard these if registry has values. However Intel compiler setup
+# script still requires these as of 2013/2014.
'VS110COMNTOOLS',
'VS100COMNTOOLS',
'VS90COMNTOOLS',
@@ -166,6 +179,11 @@ def get_output(vcbat, args = None, env = None):
# and won't work under Pythons not built with threading.
stdout = popen.stdout.read()
stderr = popen.stderr.read()
+
+ # Extra debug logic, uncomment if necessar
+# debug('get_output():stdout:%s'%stdout)
+# debug('get_output():stderr:%s'%stderr)
+
if stderr:
# TODO: find something better to do with stderr;
# this at least prevents errors from getting swallowed.
@@ -196,7 +214,7 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
p = p.encode('mbcs')
# XXX: For some reason, VC98 .bat file adds "" around the PATH
# values, and it screws up the environment later, so we strip
- # it.
+ # it.
p = p.strip('"')
dkeep[key].append(p)