diff options
author | Mats Wichmann <mats@linux.com> | 2021-11-26 17:25:50 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2021-11-26 18:16:59 (GMT) |
commit | 9649d0fd2326d607ee545625cea45cf72aab87a6 (patch) | |
tree | f1dfbf812ca0624b9836a583d7da6c14af14d450 /SCons/Script/Main.py | |
parent | c335e187fb9b2c79fe03489c13cb7859969ed25c (diff) | |
download | SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.zip SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.gz SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.bz2 |
Fix tests to not hang on Windows with bad .py assoc
For systems where the association for .py files is not to an actual
Python interpreter, those few cases where we need to run a Python script
directly as a program don't work. This could be because the association
was never set up, or because some other program (e.g. Visual Studio Code)
has taken it over. In some cases may appear to "hang" because the
alternate program is waiting for user interaction
runtest.py now has a mechanism to check (thanks to Brett Cannon for
providing this incantation). It isn't super precise (looks for the
substring "py" in the queried association), but should work out.
It sets an environment variable which the test framework can read
and as a result set a flag which individual tests can read.
Two tests in scons-time which had previously been set to skip-if-win32
now look at this flag instead. Three tests in sconsign now also look at
this flag. This allows a clean run on my dev box with VS Code having
taken over the .py association.
Various things can break if the environment used to fire off
Windows processes doesn't contain %UserProfile%. Added this to the
short list of passthrough env vars. Apparently an environment without
this value is now considered invalid (it blew up the erroneously
launched VS Code, but we've apparently been lucky it hasn't blown
up more things - believe there was also a report of a problem
with the Visual Studio setup scripts).
A little extra cleanup:
- a couple of Py2-isms were cleaned out (Script/Main.py and in the test
framework)
- The paths to look for site-scons were rewritten (part of this was
another Py2-ism), and the system path changed a bit - the old path is
still checked, and the manpage updated to reflect this.
- runtest.py dropped the unused whereis functions.
- the three sconsign tests now use f-string formatting, mostly as an
experiment to see how easy it is to convert.
Fixes #4053
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Script/Main.py')
-rw-r--r-- | SCons/Script/Main.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/SCons/Script/Main.py b/SCons/Script/Main.py index c09ebb8..b873bc2 100644 --- a/SCons/Script/Main.py +++ b/SCons/Script/Main.py @@ -788,13 +788,12 @@ def _load_all_site_scons_dirs(topdir, verbose=False): return os.path.expanduser('~/'+d) if platform == 'win32' or platform == 'cygwin': - # Note we use $ here instead of %...% because older - # pythons (prior to 2.6?) didn't expand %...% on Windows. - # This set of dirs should work on XP, Vista, 7 and later. sysdirs=[ - os.path.expandvars('$ALLUSERSPROFILE\\Application Data\\scons'), - os.path.expandvars('$USERPROFILE\\Local Settings\\Application Data\\scons')] - appdatadir = os.path.expandvars('$APPDATA\\scons') + os.path.expandvars('%AllUsersProfile%\\scons'), + # TODO older path, kept for compat + os.path.expandvars('%AllUsersProfile%\\Application Data\\scons'), + os.path.expandvars('%LocalAppData%\\scons')] + appdatadir = os.path.expandvars('%AppData%\\scons') if appdatadir not in sysdirs: sysdirs.append(appdatadir) sysdirs.append(homedir('.scons')) |