summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRocco Matano <devnull@localhost>2014-03-07 14:39:43 (GMT)
committerRocco Matano <devnull@localhost>2014-03-07 14:39:43 (GMT)
commitea1890249923aab9cda388b2d22b566dbb7b8949 (patch)
treeadf82b67b42bed5f5374239ece9fc1d1ce87960e /src
parent8986df6b325e924f4143b03705129899fccc72ba (diff)
downloadSCons-ea1890249923aab9cda388b2d22b566dbb7b8949.zip
SCons-ea1890249923aab9cda388b2d22b566dbb7b8949.tar.gz
SCons-ea1890249923aab9cda388b2d22b566dbb7b8949.tar.bz2
fix some minor 2to3 issues on windows
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Platform/win32.py22
-rw-r--r--src/engine/SCons/Tool/386asm.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py5
3 files changed, 16 insertions, 13 deletions
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 879817d..1e4fb2a 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -61,16 +61,21 @@ else:
parallel_msg = None
import builtins
-
- _builtin_file = builtins.file
+ builtin_file = getattr(builtins, 'file', None) is not None
+
+ if builtin_file:
+ _builtin_file = builtins.file
+
+ 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)
+
+ builtins.file = _scons_file
+
_builtin_open = builtins.open
- 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)
-
def _scons_open(*args, **kw):
fp = _builtin_open(*args, **kw)
win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()),
@@ -78,7 +83,6 @@ else:
0)
return fp
- builtins.file = _scons_file
builtins.open = _scons_open
try:
diff --git a/src/engine/SCons/Tool/386asm.py b/src/engine/SCons/Tool/386asm.py
index 8acc55f..51738eb 100644
--- a/src/engine/SCons/Tool/386asm.py
+++ b/src/engine/SCons/Tool/386asm.py
@@ -37,7 +37,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
from SCons.Tool.PharLapCommon import addPharLapPaths
import SCons.Util
-as_module = __import__('as', globals(), locals(), [])
+as_module = __import__('as', globals(), locals(), [], 1)
def generate(env):
"""Add Builders and construction variables for ar to an Environment."""
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index e5c78e9..4a91310 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -115,11 +115,11 @@ def normalize_env(env, keys, force=False):
normenv = {}
if env:
for k in env.keys():
- normenv[k] = copy.deepcopy(env[k]).encode('mbcs')
+ normenv[k] = copy.deepcopy(env[k])
for k in keys:
if k in os.environ and (force or not k in normenv):
- normenv[k] = os.environ[k].encode('mbcs')
+ normenv[k] = os.environ[k]
# 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
@@ -212,7 +212,6 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
for p in plist:
# Do not add empty paths (when a var ends with ;)
if p:
- 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.