diff options
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/Platform')
10 files changed, 86 insertions, 31 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Platform/__init__.py b/3rdParty/SCons/scons-local/SCons/Platform/__init__.py index 9c23554..717ba43 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/__init__.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/__init__.py @@ -20,7 +20,7 @@ their own platform definition. """ # -# 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 @@ -42,7 +42,9 @@ their own platform definition. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/__init__.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/__init__.py 4761 2010/04/04 14:04:44 bdeegan" + +import SCons.compat import imp import os @@ -176,8 +178,8 @@ class TempFileMunge: # We use the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - tmp = os.path.normpath(tempfile.mktemp('.lnk')) - native_tmp = SCons.Util.get_native_path(tmp) + (fd, tmp) = tempfile.mkstemp('.lnk', text=True) + native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) if env['SHELL'] and env['SHELL'] == 'sh': # The sh shell will try to escape the backslashes in the @@ -197,7 +199,8 @@ class TempFileMunge: prefix = '@' args = map(SCons.Subst.quote_spaces, cmd[1:]) - open(tmp, 'w').write(string.join(args, " ") + "\n") + os.write(fd, string.join(args, " ") + "\n") + os.close(fd) # XXX Using the SCons.Action.print_actions value directly # like this is bogus, but expedient. This class should # really be rewritten as an Action that defines the diff --git a/3rdParty/SCons/scons-local/SCons/Platform/aix.py b/3rdParty/SCons/scons-local/SCons/Platform/aix.py index c3f5d0f..b45ca93 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/aix.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/aix.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/aix.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/aix.py 4761 2010/04/04 14:04:44 bdeegan" import os import string diff --git a/3rdParty/SCons/scons-local/SCons/Platform/cygwin.py b/3rdParty/SCons/scons-local/SCons/Platform/cygwin.py index cdc516d..4b607f6 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/cygwin.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/cygwin.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/cygwin.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/cygwin.py 4761 2010/04/04 14:04:44 bdeegan" import posix from SCons.Platform import TempFileMunge diff --git a/3rdParty/SCons/scons-local/SCons/Platform/darwin.py b/3rdParty/SCons/scons-local/SCons/Platform/darwin.py index a92b2f1..b2e3931 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/darwin.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/darwin.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/darwin.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/darwin.py 4761 2010/04/04 14:04:44 bdeegan" import posix diff --git a/3rdParty/SCons/scons-local/SCons/Platform/hpux.py b/3rdParty/SCons/scons-local/SCons/Platform/hpux.py index aa90e71..19db32f 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/hpux.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/hpux.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/hpux.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/hpux.py 4761 2010/04/04 14:04:44 bdeegan" import posix diff --git a/3rdParty/SCons/scons-local/SCons/Platform/irix.py b/3rdParty/SCons/scons-local/SCons/Platform/irix.py index a20a7de..914a8db 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/irix.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/irix.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/irix.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/irix.py 4761 2010/04/04 14:04:44 bdeegan" import posix diff --git a/3rdParty/SCons/scons-local/SCons/Platform/os2.py b/3rdParty/SCons/scons-local/SCons/Platform/os2.py index f8fa379..e3b2754 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/os2.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/os2.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,8 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/os2.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/os2.py 4761 2010/04/04 14:04:44 bdeegan" +import win32 def generate(env): if not env.has_key('ENV'): @@ -47,6 +48,8 @@ def generate(env): env['SHLIBSUFFIX'] = '.dll' env['LIBPREFIXES'] = '$LIBPREFIX' env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] + env['HOST_OS'] = 'os2' + env['HOST_ARCH'] = win32.get_architecture().arch # Local Variables: # tab-width:4 diff --git a/3rdParty/SCons/scons-local/SCons/Platform/posix.py b/3rdParty/SCons/scons-local/SCons/Platform/posix.py index 0a31dd6..0c2a9e3 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/posix.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/posix.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/posix.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/posix.py 4761 2010/04/04 14:04:44 bdeegan" import errno import os @@ -116,7 +116,7 @@ def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr): str = cmd_stdout.read() if len(str) == 0: stdout_eof = 1 - elif stdout != None: + elif stdout is not None: stdout.write(str) if cmd_stderr in i: str = cmd_stderr.read() diff --git a/3rdParty/SCons/scons-local/SCons/Platform/sunos.py b/3rdParty/SCons/scons-local/SCons/Platform/sunos.py index 74f298a..448a4c4 100644 --- a/3rdParty/SCons/scons-local/SCons/Platform/sunos.py +++ b/3rdParty/SCons/scons-local/SCons/Platform/sunos.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/sunos.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Platform/sunos.py 4761 2010/04/04 14:04:44 bdeegan" import posix 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 |