summaryrefslogtreecommitdiff
path: root/engine/SCons/Platform/win32.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Platform/win32.py')
-rw-r--r--engine/SCons/Platform/win32.py37
1 files changed, 18 insertions, 19 deletions
diff --git a/engine/SCons/Platform/win32.py b/engine/SCons/Platform/win32.py
index 1443099..57d9bdc 100644
--- a/engine/SCons/Platform/win32.py
+++ b/engine/SCons/Platform/win32.py
@@ -30,11 +30,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/win32.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Platform/win32.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
-import string
import sys
import tempfile
@@ -61,27 +60,27 @@ except AttributeError:
else:
parallel_msg = None
- import __builtin__
+ import builtins
- _builtin_file = __builtin__.file
- _builtin_open = __builtin__.open
+ _builtin_file = builtins.file
+ _builtin_open = builtins.open
def _scons_file(*args, **kw):
- fp = apply(_builtin_file, args, kw)
+ fp = _builtin_file(*args, **kw)
win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()),
win32con.HANDLE_FLAG_INHERIT,
0)
return fp
def _scons_open(*args, **kw):
- fp = apply(_builtin_open, args, kw)
+ fp = _builtin_open(*args, **kw)
win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()),
win32con.HANDLE_FLAG_INHERIT,
0)
return fp
- __builtin__.file = _scons_file
- __builtin__.open = _scons_open
+ builtins.file = _scons_file
+ builtins.open = _scons_open
@@ -109,11 +108,11 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
stderrRedirected = 0
for arg in args:
# are there more possibilities to redirect stdout ?
- if (string.find( arg, ">", 0, 1 ) != -1 or
- string.find( arg, "1>", 0, 2 ) != -1):
+ if (arg.find( ">", 0, 1 ) != -1 or
+ arg.find( "1>", 0, 2 ) != -1):
stdoutRedirected = 1
# are there more possibilities to redirect stderr ?
- if string.find( arg, "2>", 0, 2 ) != -1:
+ if arg.find( "2>", 0, 2 ) != -1:
stderrRedirected = 1
# redirect output of non-redirected streams to our tempfiles
@@ -124,7 +123,7 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
# actually do the spawn
try:
- args = [sh, '/C', escape(string.join(args)) ]
+ args = [sh, '/C', escape(' '.join(args)) ]
ret = os.spawnve(os.P_WAIT, sh, args, env)
except OSError, e:
# catch any error
@@ -162,7 +161,7 @@ def exec_spawn(l, env):
result = 127
if len(l) > 2:
if len(l[2]) < 1000:
- command = string.join(l[0:3])
+ command = ' '.join(l[0:3])
else:
command = l[0]
else:
@@ -174,7 +173,7 @@ def spawn(sh, escape, cmd, args, env):
if not sh:
sys.stderr.write("scons: Could not find command interpreter, is it in your PATH?\n")
return 127
- return exec_spawn([sh, '/C', escape(string.join(args))], env)
+ return exec_spawn([sh, '/C', escape(' '.join(args))], env)
# Windows does not allow special characters in file names anyway, so no
# need for a complex escape function, we will just quote the arg, except
@@ -240,7 +239,7 @@ def get_program_files_dir():
# Determine which windows CPU were running on.
-class ArchDefinition:
+class ArchDefinition(object):
"""
A class for defining architecture-specific settings and logic.
"""
@@ -318,7 +317,7 @@ def generate(env):
tmp_path = systemroot + os.pathsep + \
os.path.join(systemroot,'System32')
tmp_pathext = '.com;.exe;.bat;.cmd'
- if os.environ.has_key('PATHEXT'):
+ if 'PATHEXT' in os.environ:
tmp_pathext = os.environ['PATHEXT']
cmd_interp = SCons.Util.WhereIs('cmd', tmp_path, tmp_pathext)
if not cmd_interp:
@@ -330,7 +329,7 @@ def generate(env):
cmd_interp = env.Detect('command')
- if not env.has_key('ENV'):
+ if 'ENV' not in env:
env['ENV'] = {}
# Import things from the external environment to the construction
@@ -347,7 +346,7 @@ def generate(env):
if v:
env['ENV'][var] = v
- if not env['ENV'].has_key('COMSPEC'):
+ if 'COMSPEC' not in env['ENV']:
v = os.environ.get("COMSPEC")
if v:
env['ENV']['COMSPEC'] = v