summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-03-04 17:37:54 (GMT)
committerMats Wichmann <mats@linux.com>2020-03-17 14:27:08 (GMT)
commit735147d4d6434ba236571be3ec88f2ec53ea6554 (patch)
treeeb48d259280477547f6cf1b36651ab29a340a144
parent7b0ec3e478423829e9ed23938d6aed178a140343 (diff)
downloadSCons-735147d4d6434ba236571be3ec88f2ec53ea6554.zip
SCons-735147d4d6434ba236571be3ec88f2ec53ea6554.tar.gz
SCons-735147d4d6434ba236571be3ec88f2ec53ea6554.tar.bz2
Pass some env vars that affect msvs tool setup.
MSCommon already makes sure a few variables are propagated before calling the the dev env setup script (vcvarsall.bat or relative). This change adds two more: VSCMD_DEBUG enables VsDevCmd.bat (which is eventually called) to log the environment before and after setup, and VSCMD_SKIP_SENDTELEMETRY, if set, inhibits the new (VS 2019) functionality to send telemetry information. The change is motivated by the telemetry code generating undecodable output for certain locales. This should allow suppressing it, but doesn't really fix the underlying problem that we're not handling text right on Windows (on Py2 this would not have failed, but that was an error as well - it should have). Signed-off-by: Mats Wichmann <mats@linux.com>
-rwxr-xr-xsrc/CHANGES.txt2
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py27
2 files changed, 19 insertions, 10 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 514ecf7..958a475 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -84,6 +84,8 @@ From Rob Boehne
- Fixed bug where changing TEXTFILESUFFIX would cause Substfile() to rebuild. (Github Issue #3540)
- Script/Main.py now uses importlib instead of imp module.
- Drop some Python 2-isms.
+ - Pass on VSCMD_DEBUG and VSCMD_SKIP_SENDTELEMETRY to msvc tool setup
+ if set in environment.
RELEASE 3.1.2 - Mon, 17 Dec 2019 02:06:27 +0000
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index 7f832c6..422d897 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -185,16 +185,21 @@ def get_output(vcbat, args=None, env=None):
# Create a blank environment, for use in launching the tools
env = SCons.Environment.Environment(tools=[])
- # TODO: This is a hard-coded list of the variables that (may) need
- # to be imported from os.environ[] for v[sc]*vars*.bat file
- # execution to work. This list should really be either directly
- # controlled by vc.py, or else derived from the common_tools_var
- # settings in vs.py.
+ # TODO: Hard-coded list of the variables that (may) need to be
+ # imported from os.environ[] for the chain of development batch
+ # files to execute correctly. One call to vcvars*.bat may
+ # end up running a dozen or more scripts, changes not only with
+ # each release but with what is installed at the time. We think
+ # in modern installations most are set along the way and don't
+ # need to be picked from the env, but include these for safety's sake.
+ # Any VSCMD variables definitely are picked from the env and
+ # control execution in interesting ways.
+ # Note these really should be unified - either controlled by vs.py,
+ # or synced with the the common_tools_var # settings in vs.py.
vs_vc_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.
+ 'COMSPEC', # path to "shell"
+ 'VS160COMNTOOLS', # path to common tools for given version
+ 'VS150COMNTOOLS',
'VS140COMNTOOLS',
'VS120COMNTOOLS',
'VS110COMNTOOLS',
@@ -204,6 +209,8 @@ def get_output(vcbat, args=None, env=None):
'VS71COMNTOOLS',
'VS70COMNTOOLS',
'VS60COMNTOOLS',
+ 'VSCMD_DEBUG', # enable logging and other debug aids
+ 'VSCMD_SKIP_SENDTELEMETRY',
]
env['ENV'] = normalize_env(env['ENV'], vs_vc_vars, force=False)
@@ -237,7 +244,7 @@ def get_output(vcbat, args=None, env=None):
if stderr:
# TODO: find something better to do with stderr;
# this at least prevents errors from getting swallowed.
- sys.stderr.write(stderr)
+ sys.stderr.write(stderr.decode("mbcs"))
if popen.wait() != 0:
raise IOError(stderr.decode("mbcs"))