summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Platform/win32.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-24 09:57:09 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-24 09:57:09 +0200
commitc7665433b2004d2b404d6fb9d6fd064998486f63 (patch)
tree8525ef6d24f7c6ceb238945ebb2cc997c7afc905 /src/engine/SCons/Platform/win32.py
parente48d2727885efda8369c7edbc2e3929a59532adc (diff)
parent6e228c305122f0564eda1e67d56651f8386d24d7 (diff)
Merge branch 'release/debian/3.1.0+repack-1'debian/3.1.0+repack-1
Diffstat (limited to 'src/engine/SCons/Platform/win32.py')
-rw-r--r--src/engine/SCons/Platform/win32.py47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 79955e7..ea567a2 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/win32.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Platform/win32.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import os.path
@@ -39,8 +39,14 @@ import tempfile
from SCons.Platform.posix import exitvalmap
from SCons.Platform import TempFileMunge
+from SCons.Platform.virtualenv import ImportVirtualenv
+from SCons.Platform.virtualenv import ignore_virtualenv, enable_virtualenv
import SCons.Util
+CHOCO_DEFAULT_PATH = [
+ r'C:\ProgramData\chocolatey\bin'
+]
+
try:
import msvcrt
import win32api
@@ -80,16 +86,8 @@ else:
win32con.HANDLE_FLAG_INHERIT, 0)
file = _scons_file
else:
- import io
- for io_class in ['BufferedReader', 'BufferedWriter', 'BufferedRWPair',
- 'BufferedRandom', 'TextIOWrapper']:
- _builtin_file = getattr(io, io_class)
- class _scons_file(_builtin_file):
- def __init__(self, *args, **kw):
- _builtin_file.__init__(self, *args, **kw)
- win32api.SetHandleInformation(msvcrt.get_osfhandle(self.fileno()),
- win32con.HANDLE_FLAG_INHERIT, 0)
- setattr(io, io_class, _scons_file)
+ # No longer needed for python 3.4 and above. Files are opened non sharable
+ pass
@@ -132,7 +130,7 @@ try:
# Without this, python can randomly crash while using -jN.
# See the python bug at http://bugs.python.org/issue6476
# and SCons issue at
- # http://scons.tigris.org/issues/show_bug.cgi?id=2449
+ # https://github.com/SCons/scons/issues/2449
def spawnve(mode, file, args, env):
spawn_lock.acquire()
try:
@@ -195,29 +193,31 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
# actually do the spawn
try:
- args = [sh, '/C', escape(' '.join(args)) ]
+ args = [sh, '/C', escape(' '.join(args))]
ret = spawnve(os.P_WAIT, sh, args, env)
except OSError as e:
# catch any error
try:
- ret = exitvalmap[e[0]]
+ ret = exitvalmap[e.errno]
except KeyError:
- sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1]))
+ sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e.errno, cmd, e.strerror))
if stderr is not None:
- stderr.write("scons: %s: %s\n" % (cmd, e[1]))
+ stderr.write("scons: %s: %s\n" % (cmd, e.strerror))
# copy child output from tempfiles to our streams
# and do clean up stuff
if stdout is not None and stdoutRedirected == 0:
try:
- stdout.write(open( tmpFileStdout, "r" ).read())
- os.remove( tmpFileStdout )
+ with open(tmpFileStdout, "r" ) as tmp:
+ stdout.write(tmp.read())
+ os.remove(tmpFileStdout)
except (IOError, OSError):
pass
if stderr is not None and stderrRedirected == 0:
try:
- stderr.write(open( tmpFileStderr, "r" ).read())
- os.remove( tmpFileStderr )
+ with open(tmpFileStderr, "r" ) as tmp:
+ stderr.write(tmp.read())
+ os.remove(tmpFileStderr)
except (IOError, OSError):
pass
return ret
@@ -436,7 +436,7 @@ def generate(env):
if v:
env['ENV']['COMSPEC'] = v
- env.AppendENVPath('PATH', get_system_root() + '\System32')
+ env.AppendENVPath('PATH', get_system_root() + '\\System32')
env['ENV']['PATHEXT'] = '.COM;.EXE;.BAT;.CMD'
env['OBJPREFIX'] = ''
@@ -462,6 +462,9 @@ def generate(env):
env['HOST_OS'] = 'win32'
env['HOST_ARCH'] = get_architecture().arch
+ if enable_virtualenv and not ignore_virtualenv:
+ ImportVirtualenv(env)
+
# Local Variables:
# tab-width:4