diff options
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/compat')
7 files changed, 73 insertions, 26 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/compat/__init__.py b/3rdParty/SCons/scons-local/SCons/compat/__init__.py index f48ae4a..dfedf1d 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/__init__.py +++ b/3rdParty/SCons/scons-local/SCons/compat/__init__.py @@ -1,5 +1,5 @@ # -# 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 @@ -60,7 +60,7 @@ function defined below loads the module as the "real" name (without the rest of our code will find our pre-loaded compatibility module. """ -__revision__ = "src/engine/SCons/compat/__init__.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/compat/__init__.py 4761 2010/04/04 14:04:44 bdeegan" def import_as(module, name): """ @@ -175,6 +175,14 @@ except AttributeError: return os.path.exists(path) or os.path.islink(path) os.path.lexists = lexists + +try: + import platform +except ImportError: + # Pre-2.3 Python has no platform module. + import_as('_scons_platform', 'platform') + + import shlex try: shlex.split @@ -250,6 +258,43 @@ except ImportError: # Pre-1.6 Python has no UserString module. import_as('_scons_UserString', 'UserString') +import tempfile +try: + tempfile.mkstemp +except AttributeError: + # Pre-2.3 Python has no tempfile.mkstemp function, so try to simulate it. + # adapted from the mkstemp implementation in python 3. + import os + import errno + def mkstemp(*args, **kw): + text = False + # TODO (1.5) + #if 'text' in kw : + if 'text' in kw.keys() : + text = kw['text'] + del kw['text'] + elif len( args ) == 4 : + text = args[3] + args = args[:3] + flags = os.O_RDWR | os.O_CREAT | os.O_EXCL + if not text and hasattr( os, 'O_BINARY' ) : + flags = flags | os.O_BINARY + while True: + try : + name = apply(tempfile.mktemp, args, kw) + fd = os.open( name, flags, 0600 ) + return (fd, os.path.abspath(name)) + except OSError, e: + if e.errno == errno.EEXIST: + continue + raise + + tempfile.mkstemp = mkstemp + del mkstemp + + + + # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/3rdParty/SCons/scons-local/SCons/compat/_scons_UserString.py b/3rdParty/SCons/scons-local/SCons/compat/_scons_UserString.py index 4b736fd..0310bdd 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/_scons_UserString.py +++ b/3rdParty/SCons/scons-local/SCons/compat/_scons_UserString.py @@ -1,5 +1,5 @@ # -# 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 @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/compat/_scons_UserString.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_UserString.py 4761 2010/04/04 14:04:44 bdeegan" __doc__ = """ A user-defined wrapper around string objects diff --git a/3rdParty/SCons/scons-local/SCons/compat/_scons_hashlib.py b/3rdParty/SCons/scons-local/SCons/compat/_scons_hashlib.py index 2fc1ce6..0778bdc 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/_scons_hashlib.py +++ b/3rdParty/SCons/scons-local/SCons/compat/_scons_hashlib.py @@ -1,5 +1,5 @@ # -# 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 @@ -31,7 +31,7 @@ purposes, anyway). In fact, this module will raise an ImportError if the underlying md5 module isn't available. """ -__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 4761 2010/04/04 14:04:44 bdeegan" import md5 import string diff --git a/3rdParty/SCons/scons-local/SCons/compat/_scons_itertools.py b/3rdParty/SCons/scons-local/SCons/compat/_scons_itertools.py index d2289d3..ac16f3d 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/_scons_itertools.py +++ b/3rdParty/SCons/scons-local/SCons/compat/_scons_itertools.py @@ -1,5 +1,5 @@ # -# 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 @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/compat/_scons_itertools.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_itertools.py 4761 2010/04/04 14:04:44 bdeegan" __doc__ = """ Implementations of itertools functions for Python versions that don't diff --git a/3rdParty/SCons/scons-local/SCons/compat/_scons_optparse.py b/3rdParty/SCons/scons-local/SCons/compat/_scons_optparse.py index 386dfea..219adba 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/_scons_optparse.py +++ b/3rdParty/SCons/scons-local/SCons/compat/_scons_optparse.py @@ -920,7 +920,7 @@ class Values: def read_file(self, filename, mode="careful"): vars = {} - execfile(filename, vars) + exec open(filename, 'rU').read() in vars self._update(vars, mode) def ensure_value(self, attr, value): diff --git a/3rdParty/SCons/scons-local/SCons/compat/_scons_subprocess.py b/3rdParty/SCons/scons-local/SCons/compat/_scons_subprocess.py index 4968825..ccd403a 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/_scons_subprocess.py +++ b/3rdParty/SCons/scons-local/SCons/compat/_scons_subprocess.py @@ -381,7 +381,21 @@ if mswindows: # can't import it. pass import msvcrt - if 0: # <-- change this to use pywin32 instead of the _subprocess driver + try: + # Try to get _subprocess + from _subprocess import * + class STARTUPINFO: + dwFlags = 0 + hStdInput = None + hStdOutput = None + hStdError = None + wShowWindow = 0 + class pywintypes: + error = IOError + except ImportError: + # If not there, then drop back to requiring pywin32 + # TODO: Should this be wrapped in try as well? To notify user to install + # pywin32 ? With URL to it? import pywintypes from win32api import GetStdHandle, STD_INPUT_HANDLE, \ STD_OUTPUT_HANDLE, STD_ERROR_HANDLE @@ -393,20 +407,8 @@ if mswindows: GetExitCodeProcess, STARTF_USESTDHANDLES, \ STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 - else: - # SCons: don't die on Python versions that don't have _subprocess. - try: - from _subprocess import * - except ImportError: - pass - class STARTUPINFO: - dwFlags = 0 - hStdInput = None - hStdOutput = None - hStdError = None - wShowWindow = 0 - class pywintypes: - error = IOError + + else: import select import errno diff --git a/3rdParty/SCons/scons-local/SCons/compat/builtins.py b/3rdParty/SCons/scons-local/SCons/compat/builtins.py index f7267ca..e56e1ed 100644 --- a/3rdParty/SCons/scons-local/SCons/compat/builtins.py +++ b/3rdParty/SCons/scons-local/SCons/compat/builtins.py @@ -1,5 +1,5 @@ # -# 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 @@ -55,7 +55,7 @@ the FUNCTIONS or DATA output, that means those names are already built in to this version of Python and we don't need to add them from this module. """ -__revision__ = "src/engine/SCons/compat/builtins.py 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/compat/builtins.py 4761 2010/04/04 14:04:44 bdeegan" import __builtin__ |