diff options
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/Platform/win32.py')
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Platform/win32.py | 67 |
1 files changed, 58 insertions, 9 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Platform/win32.py b/3rdParty/SCons/scons-local/SCons/Platform/win32.py index 64b83a7..935e8d4 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/win32.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/win32.py @@ -8,7 +8,7 @@ selection method. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/win32.py 4761 2010/04/04 14:04:44 bdeegan" import os import os.path @@ -42,8 +42,6 @@ from SCons.Platform.posix import exitvalmap from SCons.Platform import TempFileMunge import SCons.Util - - try: import msvcrt import win32api @@ -67,7 +65,7 @@ else: _builtin_file = __builtin__.file _builtin_open = __builtin__.open - + def _scons_file(*args, **kw): fp = apply(_builtin_file, args, kw) win32api.SetHandleInformation(msvcrt.get_osfhandle(fp.fileno()), @@ -134,18 +132,18 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr): ret = exitvalmap[e[0]] except KeyError: sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1])) - if stderr != None: + if stderr is not None: stderr.write("scons: %s: %s\n" % (cmd, e[1])) # copy child output from tempfiles to our streams # and do clean up stuff - if stdout != None and stdoutRedirected == 0: + if stdout is not None and stdoutRedirected == 0: try: stdout.write(open( tmpFileStdout, "r" ).read()) os.remove( tmpFileStdout ) except (IOError, OSError): pass - if stderr != None and stderrRedirected == 0: + if stderr is not None and stderrRedirected == 0: try: stderr.write(open( tmpFileStderr, "r" ).read()) os.remove( tmpFileStderr ) @@ -197,7 +195,7 @@ def get_system_root(): return _system_root # A resonable default if we can't read the registry - val = os.environ.get('SystemRoot', "C:/WINDOWS") + val = os.environ.get('SystemRoot', "C:\\WINDOWS") if SCons.Util.can_read_reg: try: @@ -239,6 +237,53 @@ def get_program_files_dir(): return val + + +# Determine which windows CPU were running on. +class ArchDefinition: + """ + A class for defining architecture-specific settings and logic. + """ + def __init__(self, arch, synonyms=[]): + self.arch = arch + self.synonyms = synonyms + +SupportedArchitectureList = [ + ArchDefinition( + 'x86', + ['i386', 'i486', 'i586', 'i686'], + ), + + ArchDefinition( + 'x86_64', + ['AMD64', 'amd64', 'em64t', 'EM64T', 'x86_64'], + ), + + ArchDefinition( + 'ia64', + ['IA64'], + ), +] + +SupportedArchitectureMap = {} +for a in SupportedArchitectureList: + SupportedArchitectureMap[a.arch] = a + for s in a.synonyms: + SupportedArchitectureMap[s] = a + +def get_architecture(arch=None): + """Returns the definition for the specified architecture string. + + If no string is specified, the system default is returned (as defined + by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment + variables). + """ + if arch is None: + arch = os.environ.get('PROCESSOR_ARCHITEW6432') + if not arch: + arch = os.environ.get('PROCESSOR_ARCHITECTURE') + return SupportedArchitectureMap.get(arch, ArchDefinition('', [''])) + def generate(env): # Attempt to find cmd.exe (for WinNT/2k/XP) or # command.com for Win9x @@ -329,6 +374,10 @@ def generate(env): env['TEMPFILEPREFIX'] = '@' env['MAXLINELENGTH'] = 2048 env['ESCAPE'] = escape + + env['HOST_OS'] = 'win32' + env['HOST_ARCH'] = get_architecture().arch + # Local Variables: # tab-width:4 |