diff options
author | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-30 22:17:36 +0000 |
---|---|---|
committer | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-30 22:17:36 +0000 |
commit | 7ef735ae2811757a4883f1664fd5f8ab9773b477 (patch) | |
tree | ee914997913fcda6b8dedd29089245056c18fedf | |
parent | 08cfdbb67a38a68eeb2e6e5a6a32e84148aea39d (diff) | |
download | chromium_src-7ef735ae2811757a4883f1664fd5f8ab9773b477.zip chromium_src-7ef735ae2811757a4883f1664fd5f8ab9773b477.tar.gz chromium_src-7ef735ae2811757a4883f1664fd5f8ab9773b477.tar.bz2 |
Update to SCons 1.2.0.
Review URL: http://codereview.chromium.org/17024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7511 0039d316-1c4b-4281-b951-d872f2087c98
174 files changed, 1564 insertions, 740 deletions
diff --git a/third_party/scons/README.google b/third_party/scons/README.google index 2f9a794..ae5824f 100644 --- a/third_party/scons/README.google +++ b/third_party/scons/README.google @@ -1,7 +1,7 @@ This is a copy of SCons, a Python-based software build tool (that is, replacement for Make) that we use for cross-platform builds. -Current version: 1.0.1.d20080915 +Current version: 1.2.0 Originally obtained from: @@ -13,13 +13,11 @@ this directory for specifics. We check in the contents of the scons-local-* package(s) provided by the SCons Project. -Before checking in, we copy the contents of the version-specific -"scons-local-{VERSION}" to the "scons-local". We do this so we can use -Subversion to diff and revert versions more easily, and to make it easier -to propagate any local modifications we might make to any new versions -we check in. - -We currently do not have any local modifications to the SCons code itself. +Before checking in, copy the contents of the version-specific +"scons-local-{VERSION}" subdirectory to the "scons-local" subdirectory. +We do this so we can use Subversion to diff and revert imported versions, +and to make it easier to propagate any local modifications we might make +to any new versions we check in. To import a new version of SCons: @@ -34,7 +32,8 @@ To import a new version of SCons: - Copy the contents of the version-specific directory to scons-local: $ cp -rf scons-local-{VERSION}/* scons-local + $ rm -rf scons-local-{VERSION} - Update this README.google file to reflect the new version number. -- Check in. +- Check in (after appropriate testing, of course). diff --git a/third_party/scons/scons-local/SCons/Action.py b/third_party/scons/scons-local/SCons/Action.py index bfd7a7d..d740de6 100644 --- a/third_party/scons/scons-local/SCons/Action.py +++ b/third_party/scons/scons-local/SCons/Action.py @@ -30,9 +30,9 @@ other modules: a pre-substitution command for debugging purposes. get_contents() - Fetches the "contents" of an Action for signature calculation. - This is what gets MD5 checksumm'ed to decide if a target needs - to be rebuilt because its action changed. + Fetches the "contents" of an Action for signature calculation + plus the varlist. This is what gets MD5 checksummed to decide + if a target needs to be rebuilt because its action changed. genstring() Returns a string representation of the Action *without* @@ -49,7 +49,7 @@ this module: __str__() Returns a string approximation of the Action; no variable substitution is performed. - + execute() The internal method that really, truly, actually handles the execution of a command or Python function. This is used so @@ -57,6 +57,10 @@ this module: pre-substitution representations, and *then* execute an action without worrying about the specific Actions involved. + get_presig() + Fetches the "contents" of a subclass for signature calculation. + The varlist is added to this to produce the Action's contents. + strfunction() Returns a substituted string representation of the Action. This is used by the _ActionAction.show() command to display the @@ -72,7 +76,6 @@ way for wrapping up the functions. """ -# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining @@ -93,14 +96,12 @@ way for wrapping up the functions. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "src/engine/SCons/Action.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Action.py 3842 2008/12/20 22:59:52 scons" import cPickle import dis import os -import os.path import string import sys import subprocess @@ -109,11 +110,14 @@ from SCons.Debug import logInstanceCreation import SCons.Errors import SCons.Executor import SCons.Util +import SCons.Subst -class _Null: - pass +# we use these a lot, so try to optimize them +is_String = SCons.Util.is_String +is_List = SCons.Util.is_List -_null = _Null +class _null: + pass print_actions = 1 execute_actions = 1 @@ -175,7 +179,7 @@ def _callable_contents(obj): def _object_contents(obj): """Return the signature contents of any Python object. - + We have to handle the case where object contains a code object since it can be pickled directly. """ @@ -199,7 +203,7 @@ def _object_contents(obj): return _function_contents(obj) except AttributeError: - # Should be a pickable Python object. + # Should be a pickable Python object. try: return cPickle.dumps(obj) except (cPickle.PicklingError, TypeError): @@ -216,7 +220,7 @@ def _code_contents(code): By providing direct access to the code object of the function, Python makes this extremely easy. Hooray! - + Unfortunately, older versions of Python include line number indications in the compiled byte code. Boo! So we remove the line number byte codes to prevent @@ -237,13 +241,13 @@ def _code_contents(code): # The code contents depends on any constants accessed by the # function. Note that we have to call _object_contents on each # constants because the code object of nested functions can - # show-up among the constants. - # + # show-up among the constants. + # # Note that we also always ignore the first entry of co_consts # which contains the function doc string. We assume that the # function does not access its doc string. contents.append(',(' + string.join(map(_object_contents,code.co_consts[1:]),',') + ')') - + # The code contents depends on the variable names used to # accessed global variable, as changing the variable name changes # the variable actually accessed and therefore changes the @@ -283,7 +287,7 @@ def _function_contents(func): contents.append(',(' + string.join(xxx, ',') + ')') return string.join(contents, '') - + def _actionAppend(act1, act2): # This function knows how to slap two actions together. @@ -304,7 +308,34 @@ def _actionAppend(act1, act2): else: return ListAction([ a1, a2 ]) -def _do_create_action(act, *args, **kw): +def _do_create_keywords(args, kw): + """This converts any arguments after the action argument into + their equivalent keywords and adds them to the kw argument. + """ + v = kw.get('varlist', ()) + # prevent varlist="FOO" from being interpreted as ['F', 'O', 'O'] + if is_String(v): v = (v,) + kw['varlist'] = tuple(v) + if args: + # turn positional args into equivalent keywords + cmdstrfunc = args[0] + if cmdstrfunc is None or is_String(cmdstrfunc): + kw['cmdstr'] = cmdstrfunc + elif callable(cmdstrfunc): + kw['strfunction'] = cmdstrfunc + else: + raise SCons.Errors.UserError( + 'Invalid command display variable type. ' + 'You must either pass a string or a callback which ' + 'accepts (target, source, env) as parameters.') + if len(args) > 1: + kw['varlist'] = args[1:] + kw['varlist'] + if kw.get('strfunction', _null) is not _null \ + and kw.get('cmdstr', _null) is not _null: + raise SCons.Errors.UserError( + 'Cannot have both strfunction and cmdstr args to Action()') + +def _do_create_action(act, kw): """This is the actual "implementation" for the Action factory method, below. This handles the fact that passing lists to Action() itself has @@ -317,8 +348,11 @@ def _do_create_action(act, *args, **kw): if isinstance(act, ActionBase): return act - if SCons.Util.is_List(act): - return apply(CommandAction, (act,)+args, kw) + + if is_List(act): + #TODO(1.5) return CommandAction(act, **kw) + return apply(CommandAction, (act,), kw) + if callable(act): try: gen = kw['generator'] @@ -329,8 +363,9 @@ def _do_create_action(act, *args, **kw): action_type = CommandGeneratorAction else: action_type = FunctionAction - return apply(action_type, (act,)+args, kw) - if SCons.Util.is_String(act): + return action_type(act, kw) + + if is_String(act): var=SCons.Util.get_environment_var(act) if var: # This looks like a string that is purely an Environment @@ -339,30 +374,37 @@ def _do_create_action(act, *args, **kw): # of that Environment variable, so a user could put something # like a function or a CommandGenerator in that variable # instead of a string. - return apply(LazyAction, (var,)+args, kw) + return LazyAction(var, kw) commands = string.split(str(act), '\n') if len(commands) == 1: - return apply(CommandAction, (commands[0],)+args, kw) - else: - listCmdActions = map(lambda x, args=args, kw=kw: - apply(CommandAction, (x,)+args, kw), - commands) - return ListAction(listCmdActions) + #TODO(1.5) return CommandAction(commands[0], **kw) + return apply(CommandAction, (commands[0],), kw) + # The list of string commands may include a LazyAction, so we + # reprocess them via _do_create_list_action. + return _do_create_list_action(commands, kw) return None +def _do_create_list_action(act, kw): + """A factory for list actions. Convert the input list into Actions + and then wrap them in a ListAction.""" + acts = [] + for a in act: + aa = _do_create_action(a, kw) + if aa is not None: acts.append(aa) + if not acts: + return None + elif len(acts) == 1: + return acts[0] + else: + return ListAction(acts) + def Action(act, *args, **kw): """A factory for action objects.""" - if SCons.Util.is_List(act): - acts = map(lambda a, args=args, kw=kw: - apply(_do_create_action, (a,)+args, kw), - act) - acts = filter(None, acts) - if len(acts) == 1: - return acts[0] - else: - return ListAction(acts) - else: - return apply(_do_create_action, (act,)+args, kw) + # Really simple: the _do_create_* routines do the heavy lifting. + _do_create_keywords(args, kw) + if is_List(act): + return _do_create_list_action(act, kw) + return _do_create_action(act, kw) class ActionBase: """Base class for all types of action objects that can be held by @@ -375,6 +417,17 @@ class ActionBase: def genstring(self, target, source, env): return str(self) + def get_contents(self, target, source, env): + result = [ self.get_presig(target, source, env) ] + # This should never happen, as the Action() factory should wrap + # the varlist, but just in case an action is created directly, + # we duplicate this check here. + vl = self.varlist + if is_String(vl): vl = (vl,) + for v in vl: + result.append(env.subst('${'+v+'}')) + return string.join(result, '') + def __add__(self, other): return _actionAppend(self, other) @@ -400,9 +453,16 @@ class ActionBase: class _ActionAction(ActionBase): """Base class for actions that create output objects.""" - def __init__(self, strfunction=_null, presub=_null, chdir=None, exitstatfunc=None, **kw): - if not strfunction is _null: - self.strfunction = strfunction + def __init__(self, cmdstr=_null, strfunction=_null, varlist=(), + presub=_null, chdir=None, exitstatfunc=None, + **kw): + self.cmdstr = cmdstr + if strfunction is not _null: + if strfunction is None: + self.cmdstr = None + else: + self.strfunction = strfunction + self.varlist = varlist self.presub = presub self.chdir = chdir if not exitstatfunc: @@ -418,16 +478,16 @@ class _ActionAction(ActionBase): show=_null, execute=_null, chdir=_null): - if not SCons.Util.is_List(target): + if not is_List(target): target = [target] - if not SCons.Util.is_List(source): + if not is_List(source): source = [source] - if exitstatfunc is _null: exitstatfunc = self.exitstatfunc if presub is _null: presub = self.presub - if presub is _null: - presub = print_actions_presub + if presub is _null: + presub = print_actions_presub + if exitstatfunc is _null: exitstatfunc = self.exitstatfunc if show is _null: show = print_actions if execute is _null: execute = execute_actions if chdir is _null: chdir = self.chdir @@ -437,19 +497,19 @@ class _ActionAction(ActionBase): try: chdir = str(chdir.abspath) except AttributeError: - if not SCons.Util.is_String(chdir): + if not is_String(chdir): chdir = str(target[0].dir) if presub: t = string.join(map(str, target), ' and ') l = string.join(self.presub_lines(env), '\n ') out = "Building %s with action:\n %s\n" % (t, l) sys.stdout.write(out) - s = None + cmd = None if show and self.strfunction: - s = self.strfunction(target, source, env) - if s: + cmd = self.strfunction(target, source, env) + if cmd: if chdir: - s = ('os.chdir(%s)\n' % repr(chdir)) + s + cmd = ('os.chdir(%s)\n' % repr(chdir)) + cmd try: get = env.get except AttributeError: @@ -458,7 +518,7 @@ class _ActionAction(ActionBase): print_func = get('PRINT_CMD_LINE_FUNC') if not print_func: print_func = self.print_cmd_line - print_func(s, target, source, env) + print_func(cmd, target, source, env) stat = 0 if execute: if chdir: @@ -476,7 +536,7 @@ class _ActionAction(ActionBase): finally: if save_cwd: os.chdir(save_cwd) - if s and save_cwd: + if cmd and save_cwd: print_func('os.chdir(%s)' % repr(save_cwd), target, source, env) return stat @@ -492,47 +552,65 @@ def _string_from_cmd_list(cmd_list): cl.append(arg) return string.join(cl) -# this function is still in draft mode. We're going to need something like -# it in the long run as more and more places use it, but I'm sure it'll have -# to be tweaked to get the full desired functionality. +# A fiddlin' little function that has an 'import SCons.Environment' which +# can't be moved to the top level without creating an import loop. Since +# this import creates a local variable named 'SCons', it blocks access to +# the global variable, so we move it here to prevent complaints about local +# variables being used uninitialized. default_ENV = None -# one special arg, 'error', to tell what to do with exceptions. -def _subproc(env, cmd, error = 'ignore', **kw): - """Do setup for a subprocess.Popen() call""" - - # If the env has no ENV, get a default +def get_default_ENV(env): + global default_ENV try: - ENV = env['ENV'] + return env['ENV'] except KeyError: - global default_ENV - if default_ENV is None: - # Unbelievably expensive. What it really should do - # is run the platform setup to get the default ENV. - # Fortunately, it should almost never happen. - default_ENV = SCons.Environment.Environment(tools=[])['ENV'] - ENV = default_ENV - + if not default_ENV: + import SCons.Environment + # This is a hideously expensive way to get a default shell + # environment. What it really should do is run the platform + # setup to get the default ENV. Fortunately, it's incredibly + # rare for an Environment not to have a shell environment, so + # we're not going to worry about it overmuch. + default_ENV = SCons.Environment.Environment()['ENV'] + return default_ENV + +# This function is still in draft mode. We're going to need something like +# it in the long run as more and more places use subprocess, but I'm sure +# it'll have to be tweaked to get the full desired functionality. +# one special arg (so far?), 'error', to tell what to do with exceptions. +def _subproc(env, cmd, error = 'ignore', **kw): + """Do common setup for a subprocess.Popen() call""" + # allow std{in,out,err} to be "'devnull'" + io = kw.get('stdin') + if is_String(io) and io == 'devnull': + kw['stdin'] = open(os.devnull) + io = kw.get('stdout') + if is_String(io) and io == 'devnull': + kw['stdout'] = open(os.devnull, 'w') + io = kw.get('stderr') + if is_String(io) and io == 'devnull': + kw['stderr'] = open(os.devnull, 'w') + + # Figure out what shell environment to use + ENV = kw.get('env', None) + if ENV is None: ENV = get_default_ENV(env) + # Ensure that the ENV values are all strings: new_env = {} - # It's a string 99.44% of the time, so optimize this - is_String = SCons.Util.is_String for key, value in ENV.items(): - if is_String(value): - # Call str() even though it's a "string" because it might be - # a *Unicode* string, which makes subprocess.Popen() gag. - new_env[key] = str(value) - elif SCons.Util.is_List(value): - # If the value is a list, then we assume it is a - # path list, because that's a pretty common list-like - # value to stick in an environment variable: + if is_List(value): + # If the value is a list, then we assume it is a path list, + # because that's a pretty common list-like value to stick + # in an environment variable: value = SCons.Util.flatten_sequence(value) - ENV[key] = string.join(map(str, value), os.pathsep) + new_env[key] = string.join(map(str, value), os.pathsep) else: - # If it isn't a string or a list, then we just coerce - # it to a string, which is the proper way to handle - # Dir and File instances and will produce something - # reasonable for just about everything else: - ENV[key] = str(value) + # It's either a string or something else. If it's a string, + # we still want to call str() because it might be a *Unicode* + # string, which makes subprocess.Popen() gag. If it isn't a + # string or a list, then we just coerce it to a string, which + # is the proper way to handle Dir and File instances and will + # produce something reasonable for just about everything else: + new_env[key] = str(value) kw['env'] = new_env try: @@ -541,7 +619,7 @@ def _subproc(env, cmd, error = 'ignore', **kw): except EnvironmentError, e: if error == 'raise': raise # return a dummy Popen instance that only returns error - class popen: + class dummyPopen: def __init__(self, e): self.exception = e def communicate(self): return ('','') def wait(self): return -self.exception.errno @@ -550,11 +628,11 @@ def _subproc(env, cmd, error = 'ignore', **kw): def read(self): return '' def readline(self): return '' stdout = stderr = f() - return popen(e) + return dummyPopen(e) class CommandAction(_ActionAction): """Class for command-execution actions.""" - def __init__(self, cmd, cmdstr=None, *args, **kw): + def __init__(self, cmd, **kw): # Cmd can actually be a list or a single item; if it's a # single item it should be the command string to execute; if a # list then it should be the words of the command string to @@ -566,25 +644,16 @@ class CommandAction(_ActionAction): # variables. if __debug__: logInstanceCreation(self, 'Action.CommandAction') - if not cmdstr is None: - if callable(cmdstr): - args = (cmdstr,)+args - elif not SCons.Util.is_String(cmdstr): - raise SCons.Errors.UserError(\ - 'Invalid command display variable type. ' \ - 'You must either pass a string or a callback which ' \ - 'accepts (target, source, env) as parameters.') - - apply(_ActionAction.__init__, (self,)+args, kw) - if SCons.Util.is_List(cmd): - if filter(SCons.Util.is_List, cmd): + #TODO(1.5) _ActionAction.__init__(self, **kw) + apply(_ActionAction.__init__, (self,), kw) + if is_List(cmd): + if filter(is_List, cmd): raise TypeError, "CommandAction should be given only " \ "a single command" self.cmd_list = cmd - self.cmdstr = cmdstr def __str__(self): - if SCons.Util.is_List(self.cmd_list): + if is_List(self.cmd_list): return string.join(map(str, self.cmd_list), ' ') return str(self.cmd_list) @@ -607,7 +676,9 @@ class CommandAction(_ActionAction): return result, ignore, silent def strfunction(self, target, source, env): - if not self.cmdstr is None: + if self.cmdstr is None: + return None + if self.cmdstr is not _null: from SCons.Subst import SUBST_RAW c = env.subst(self.cmdstr, SUBST_RAW, target, source) if c: @@ -626,11 +697,8 @@ class CommandAction(_ActionAction): handle lists of commands, even though that's not how we use it externally. """ - from SCons.Subst import escape_list - import SCons.Util + escape_list = SCons.Subst.escape_list flatten_sequence = SCons.Util.flatten_sequence - is_String = SCons.Util.is_String - is_List = SCons.Util.is_List try: shell = env['SHELL'] @@ -647,14 +715,7 @@ class CommandAction(_ActionAction): escape = env.get('ESCAPE', lambda x: x) - try: - ENV = env['ENV'] - except KeyError: - global default_ENV - if not default_ENV: - import SCons.Environment - default_ENV = SCons.Environment.Environment()['ENV'] - ENV = default_ENV + ENV = get_default_ENV(env) # Ensure that the ENV values are all strings: for key, value in ENV.items(): @@ -687,7 +748,7 @@ class CommandAction(_ActionAction): command=cmd_line) return 0 - def get_contents(self, target, source, env): + def get_presig(self, target, source, env): """Return the signature contents of this action's command line. This strips $(-$) and everything in between the string, @@ -695,7 +756,7 @@ class CommandAction(_ActionAction): """ from SCons.Subst import SUBST_SIG cmd = self.cmd_list - if SCons.Util.is_List(cmd): + if is_List(cmd): cmd = string.join(map(str, cmd)) else: cmd = str(cmd) @@ -703,7 +764,7 @@ class CommandAction(_ActionAction): def get_implicit_deps(self, target, source, env): icd = env.get('IMPLICIT_COMMAND_DEPENDENCIES', True) - if SCons.Util.is_String(icd) and icd[:1] == '$': + if is_String(icd) and icd[:1] == '$': icd = env.subst(icd) if not icd or icd in ('0', 'None'): return [] @@ -719,20 +780,21 @@ class CommandAction(_ActionAction): class CommandGeneratorAction(ActionBase): """Class for command-generator actions.""" - def __init__(self, generator, *args, **kw): + def __init__(self, generator, kw): if __debug__: logInstanceCreation(self, 'Action.CommandGeneratorAction') self.generator = generator - self.gen_args = args self.gen_kw = kw + self.varlist = kw.get('varlist', ()) def _generate(self, target, source, env, for_signature): # ensure that target is a list, to make it easier to write # generator functions: - if not SCons.Util.is_List(target): + if not is_List(target): target = [target] ret = self.generator(target=target, source=source, env=env, for_signature=for_signature) - gen_cmd = apply(Action, (ret,)+self.gen_args, self.gen_kw) + #TODO(1.5) gen_cmd = Action(ret, **self.gen_kw) + gen_cmd = apply(Action, (ret,), self.gen_kw) if not gen_cmd: raise SCons.Errors.UserError("Object returned from command generator: %s cannot be used to create an Action." % repr(ret)) return gen_cmd @@ -756,13 +818,13 @@ class CommandGeneratorAction(ActionBase): return act(target, source, env, exitstatfunc, presub, show, execute, chdir) - def get_contents(self, target, source, env): + def get_presig(self, target, source, env): """Return the signature contents of this action's command line. This strips $(-$) and everything in between the string, since those parts don't affect signatures. """ - return self._generate(target, source, env, 1).get_contents(target, source, env) + return self._generate(target, source, env, 1).get_presig(target, source, env) def get_implicit_deps(self, target, source, env): return self._generate(target, source, env, 1).get_implicit_deps(target, source, env) @@ -788,22 +850,23 @@ class CommandGeneratorAction(ActionBase): class LazyAction(CommandGeneratorAction, CommandAction): - def __init__(self, var, *args, **kw): + def __init__(self, var, kw): if __debug__: logInstanceCreation(self, 'Action.LazyAction') - apply(CommandAction.__init__, (self, '$'+var)+args, kw) + #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw) + apply(CommandAction.__init__, (self, '${'+var+'}'), kw) self.var = SCons.Util.to_String(var) - self.gen_args = args self.gen_kw = kw def get_parent_class(self, env): c = env.get(self.var) - if SCons.Util.is_String(c) and not '\n' in c: + if is_String(c) and not '\n' in c: return CommandAction return CommandGeneratorAction def _generate_cache(self, env): c = env.get(self.var, '') - gen_cmd = apply(Action, (c,)+self.gen_args, self.gen_kw) + #TODO(1.5) gen_cmd = Action(c, **self.gen_kw) + gen_cmd = apply(Action, (c,), self.gen_kw) if not gen_cmd: raise SCons.Errors.UserError("$%s value %s cannot be used to create an Action." % (self.var, repr(c))) return gen_cmd @@ -814,29 +877,21 @@ class LazyAction(CommandGeneratorAction, CommandAction): def __call__(self, target, source, env, *args, **kw): args = (self, target, source, env) + args c = self.get_parent_class(env) + #TODO(1.5) return c.__call__(*args, **kw) return apply(c.__call__, args, kw) - def get_contents(self, target, source, env): + def get_presig(self, target, source, env): c = self.get_parent_class(env) - return c.get_contents(self, target, source, env) + return c.get_presig(self, target, source, env) class FunctionAction(_ActionAction): """Class for Python function actions.""" - def __init__(self, execfunction, cmdstr=_null, *args, **kw): + def __init__(self, execfunction, kw): if __debug__: logInstanceCreation(self, 'Action.FunctionAction') - if not cmdstr is _null: - if callable(cmdstr): - args = (cmdstr,)+args - elif not (cmdstr is None or SCons.Util.is_String(cmdstr)): - raise SCons.Errors.UserError(\ - 'Invalid function display variable type. ' \ - 'You must either pass a string or a callback which ' \ - 'accepts (target, source, env) as parameters.') - self.execfunction = execfunction try: self.funccontents = _callable_contents(execfunction) @@ -848,12 +903,8 @@ class FunctionAction(_ActionAction): # This is weird, just do the best we can. self.funccontents = _object_contents(execfunction) - apply(_ActionAction.__init__, (self,)+args, kw) - self.varlist = kw.get('varlist', []) - if SCons.Util.is_String(self.varlist): - # prevent varlist="FOO" from being interpreted as ['F', 'O', 'O'] - self.varlist=[self.varlist] - self.cmdstr = cmdstr + #TODO(1.5) _ActionAction.__init__(self, **kw) + apply(_ActionAction.__init__, (self,), kw) def function_name(self): try: @@ -867,7 +918,7 @@ class FunctionAction(_ActionAction): def strfunction(self, target, source, env): if self.cmdstr is None: return None - if not self.cmdstr is _null: + if self.cmdstr is not _null: from SCons.Subst import SUBST_RAW c = env.subst(self.cmdstr, SUBST_RAW, target, source) if c: @@ -903,44 +954,49 @@ class FunctionAction(_ActionAction): return "%s(target, source, env)" % name def execute(self, target, source, env): - rsources = map(rfile, source) + exc_info = (None,None,None) try: - result = self.execfunction(target=target, source=rsources, env=env) - except EnvironmentError, e: - # If an IOError/OSError happens, raise a BuildError. - # Report the name of the file or directory that caused the - # error, which might be different from the target being built - # (for example, failure to create the directory in which the - # target file will appear). - try: filename = e.filename - except AttributeError: filename = None - result = SCons.Errors.BuildError(node=target, - errstr=e.strerror, - status=1, - filename=filename, - action=self, - command=self.strfunction(target, source, env)) - else: - if result: - msg = "Error %s" % result - result = SCons.Errors.BuildError(errstr=msg, - status=result, - action=self, - command=self.strfunction(target, source, env)) - return result + rsources = map(rfile, source) + try: + result = self.execfunction(target=target, source=rsources, env=env) + except KeyboardInterrupt, e: + raise + except SystemExit, e: + raise + except Exception, e: + result = e + exc_info = sys.exc_info() - def get_contents(self, target, source, env): + if result: + result = SCons.Errors.convert_to_BuildError(result, exc_info) + result.node=target + result.action=self + result.command=self.strfunction(target, source, env) + + # FIXME: This maintains backward compatibility with respect to + # which type of exceptions were returned by raising an + # exception and which ones were returned by value. It would + # probably be best to always return them by value here, but + # some codes do not check the return value of Actions and I do + # not have the time to modify them at this point. + if (exc_info[1] and + not isinstance(exc_info[1],EnvironmentError)): + raise result + + return result + finally: + # Break the cycle between the traceback object and this + # function stack frame. See the sys.exc_info() doc info for + # more information about this issue. + del exc_info + + + def get_presig(self, target, source, env): """Return the signature contents of this callable action.""" try: - contents = self.gc(target, source, env) + return self.gc(target, source, env) except AttributeError: - contents = self.funccontents - - result = [contents] - for v in self.varlist: - result.append(env.subst('${'+v+'}')) - - return string.join(result, '') + return self.funccontents def get_implicit_deps(self, target, source, env): return [] @@ -954,6 +1010,9 @@ class ListAction(ActionBase): return x return Action(x) self.list = map(list_of_actions, list) + # our children will have had any varlist + # applied; we don't need to do it again + self.varlist = () def genstring(self, target, source, env): return string.join(map(lambda a, t=target, s=source, e=env: @@ -963,12 +1022,12 @@ class ListAction(ActionBase): def __str__(self): return string.join(map(str, self.list), '\n') - + def presub_lines(self, env): return SCons.Util.flatten_sequence( map(lambda a, env=env: a.presub_lines(env), self.list)) - def get_contents(self, target, source, env): + def get_presig(self, target, source, env): """Return the signature contents of this action list. Simple concatenation of the signatures of the elements. @@ -1006,6 +1065,7 @@ class ActionCaller: self.parent = parent self.args = args self.kw = kw + def get_contents(self, target, source, env): actfunc = self.parent.actfunc try: @@ -1021,10 +1081,11 @@ class ActionCaller: contents = str(actfunc) contents = remove_set_lineno_codes(contents) return contents + def subst(self, s, target, source, env): # If s is a list, recursively apply subst() # to every element in the list - if SCons.Util.is_List(s): + if is_List(s): result = [] for elem in s: result.append(self.subst(elem, target, source, env)) @@ -1035,27 +1096,35 @@ class ActionCaller: # was called by using this hard-coded value as a special return. if s == '$__env__': return env - elif SCons.Util.is_String(s): + elif is_String(s): return env.subst(s, 1, target, source) return self.parent.convert(s) + def subst_args(self, target, source, env): return map(lambda x, self=self, t=target, s=source, e=env: self.subst(x, t, s, e), self.args) + def subst_kw(self, target, source, env): kw = {} for key in self.kw.keys(): kw[key] = self.subst(self.kw[key], target, source, env) return kw + def __call__(self, target, source, env): args = self.subst_args(target, source, env) kw = self.subst_kw(target, source, env) + #TODO(1.5) return self.parent.actfunc(*args, **kw) return apply(self.parent.actfunc, args, kw) + def strfunction(self, target, source, env): args = self.subst_args(target, source, env) kw = self.subst_kw(target, source, env) + #TODO(1.5) return self.parent.strfunc(*args, **kw) return apply(self.parent.strfunc, args, kw) + def __str__(self): + #TODO(1.5) return self.parent.strfunc(*self.args, **self.kw) return apply(self.parent.strfunc, self.args, self.kw) class ActionFactory: @@ -1071,6 +1140,7 @@ class ActionFactory: self.actfunc = actfunc self.strfunc = strfunc self.convert = convert + def __call__(self, *args, **kw): ac = ActionCaller(self, args, kw) action = Action(ac, strfunction=ac.strfunction) diff --git a/third_party/scons/scons-local/SCons/Builder.py b/third_party/scons/scons-local/SCons/Builder.py index 141d9d9..97aabb4 100644 --- a/third_party/scons/scons-local/SCons/Builder.py +++ b/third_party/scons/scons-local/SCons/Builder.py @@ -98,7 +98,7 @@ There are the following methods for internal use within this module: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Builder.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Builder.py 3842 2008/12/20 22:59:52 scons" import UserDict import UserList @@ -232,7 +232,7 @@ def Builder(**kw): if kw.has_key('generator'): if kw.has_key('action'): raise UserError, "You must not specify both an action and a generator." - kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator']) + kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {}) del kw['generator'] elif kw.has_key('action'): source_ext_match = kw.get('source_ext_match', 1) @@ -240,7 +240,7 @@ def Builder(**kw): del kw['source_ext_match'] if SCons.Util.is_Dict(kw['action']): composite = DictCmdGenerator(kw['action'], source_ext_match) - kw['action'] = SCons.Action.CommandGeneratorAction(composite) + kw['action'] = SCons.Action.CommandGeneratorAction(composite, {}) kw['src_suffix'] = composite.src_suffixes() else: kw['action'] = SCons.Action.Action(kw['action']) diff --git a/third_party/scons/scons-local/SCons/CacheDir.py b/third_party/scons/scons-local/SCons/CacheDir.py index 24c8d69..6eb6f17 100644 --- a/third_party/scons/scons-local/SCons/CacheDir.py +++ b/third_party/scons/scons-local/SCons/CacheDir.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/CacheDir.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/CacheDir.py 3842 2008/12/20 22:59:52 scons" __doc__ = """ CacheDir support diff --git a/third_party/scons/scons-local/SCons/Debug.py b/third_party/scons/scons-local/SCons/Debug.py index e1eb7ef..c6485b6 100644 --- a/third_party/scons/scons-local/SCons/Debug.py +++ b/third_party/scons/scons-local/SCons/Debug.py @@ -29,7 +29,7 @@ needed by most users. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Debug.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Debug.py 3842 2008/12/20 22:59:52 scons" import os import string diff --git a/third_party/scons/scons-local/SCons/Defaults.py b/third_party/scons/scons-local/SCons/Defaults.py index 9967374..fc0ab26 100644 --- a/third_party/scons/scons-local/SCons/Defaults.py +++ b/third_party/scons/scons-local/SCons/Defaults.py @@ -32,7 +32,7 @@ from distutils.msvccompiler. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Defaults.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Defaults.py 3842 2008/12/20 22:59:52 scons" diff --git a/third_party/scons/scons-local/SCons/Environment.py b/third_party/scons/scons-local/SCons/Environment.py index 763fd8a..e1a8ec2 100644 --- a/third_party/scons/scons-local/SCons/Environment.py +++ b/third_party/scons/scons-local/SCons/Environment.py @@ -32,7 +32,7 @@ Environment # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Environment.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Environment.py 3842 2008/12/20 22:59:52 scons" import copy @@ -105,24 +105,40 @@ def apply_tools(env, tools, toolpath): else: env.Tool(tool) -# These names are controlled by SCons; users should never set or override -# them. This warning can optionally be turned off, but scons will still -# ignore the illegal variable names even if it's off. -reserved_construction_var_names = \ - ['TARGET', 'TARGETS', 'SOURCE', 'SOURCES'] +# These names are (or will be) controlled by SCons; users should never +# set or override them. This warning can optionally be turned off, +# but scons will still ignore the illegal variable names even if it's off. +reserved_construction_var_names = [ + 'SOURCE', + 'SOURCES', + 'TARGET', + 'TARGETS', +] + +future_reserved_construction_var_names = [ + 'CHANGED_SOURCES', + 'CHANGED_TARGETS', + 'UNCHANGED_SOURCES', + 'UNCHANGED_TARGETS', +] def copy_non_reserved_keywords(dict): result = semi_deepcopy(dict) for k in result.keys(): if k in reserved_construction_var_names: - SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, - "Ignoring attempt to set reserved variable `%s'" % k) + msg = "Ignoring attempt to set reserved variable `$%s'" + SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % k) del result[k] return result def _set_reserved(env, key, value): - msg = "Ignoring attempt to set reserved variable `%s'" % key - SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg) + msg = "Ignoring attempt to set reserved variable `$%s'" + SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % key) + +def _set_future_reserved(env, key, value): + env._dict[key] = value + msg = "`$%s' will be reserved in a future release and setting it will become ignored" + SCons.Warnings.warn(SCons.Warnings.FutureReservedVariableWarning, msg % key) def _set_BUILDERS(env, key, value): try: @@ -142,6 +158,24 @@ def _set_SCANNERS(env, key, value): env._dict[key] = value env.scanner_map_delete() +def _delete_duplicates(l, keep_last): + """Delete duplicates from a sequence, keeping the first or last.""" + seen={} + result=[] + if keep_last: # reverse in & out, then keep first + l.reverse() + for i in l: + try: + if not seen.has_key(i): + result.append(i) + seen[i]=1 + except TypeError: + # probably unhashable. Just keep it. + result.append(i) + if keep_last: + result.reverse() + return result + # The following is partly based on code in a comment added by Peter @@ -219,8 +253,7 @@ class BuilderWrapper(MethodWrapper): return apply(MethodWrapper.__call__, (self, target, source) + args, kw) def __repr__(self): - fmt = '<BuilderWrapper %s instance at 0x%08X>' - return fmt % (repr(self.name), id(self)) + return '<BuilderWrapper %s>' % repr(self.name) def __str__(self): return self.__repr__() @@ -347,6 +380,8 @@ class SubstitutionEnvironment: self._special_set = {} for key in reserved_construction_var_names: self._special_set[key] = _set_reserved + for key in future_reserved_construction_var_names: + self._special_set[key] = _set_future_reserved self._special_set['BUILDERS'] = _set_BUILDERS self._special_set['SCANNERS'] = _set_SCANNERS @@ -400,6 +435,9 @@ class SubstitutionEnvironment: def has_key(self, key): return self._dict.has_key(key) + def __contains__(self, key): + return self._dict.__contains__(key) + def items(self): return self._dict.items() @@ -528,7 +566,8 @@ class SubstitutionEnvironment: def backtick(self, command): import subprocess # common arguments - kw = { 'stdout' : subprocess.PIPE, + kw = { 'stdin' : 'devnull', + 'stdout' : subprocess.PIPE, 'stderr' : subprocess.PIPE, 'universal_newlines' : True, } @@ -1190,6 +1229,8 @@ class Base(SubstitutionEnvironment): """ kw = copy_non_reserved_keywords(kw) for key, val in kw.items(): + if SCons.Util.is_List(val): + val = _delete_duplicates(val, delete_existing) if not self._dict.has_key(key) or self._dict[key] in ('', None): self._dict[key] = val elif SCons.Util.is_Dict(self._dict[key]) and \ @@ -1543,6 +1584,8 @@ class Base(SubstitutionEnvironment): """ kw = copy_non_reserved_keywords(kw) for key, val in kw.items(): + if SCons.Util.is_List(val): + val = _delete_duplicates(val, not delete_existing) if not self._dict.has_key(key) or self._dict[key] in ('', None): self._dict[key] = val elif SCons.Util.is_Dict(self._dict[key]) and \ @@ -2169,6 +2212,10 @@ class OverrideEnvironment(Base): return 1 except KeyError: return self.__dict__['__subject'].has_key(key) + def __contains__(self, key): + if self.__dict__['overrides'].__contains__(key): + return 1 + return self.__dict__['__subject'].__contains__(key) def Dictionary(self): """Emulates the items() method of dictionaries.""" d = self.__dict__['__subject'].Dictionary().copy() diff --git a/third_party/scons/scons-local/SCons/Errors.py b/third_party/scons/scons-local/SCons/Errors.py index 74973dd..8369873 100644 --- a/third_party/scons/scons-local/SCons/Errors.py +++ b/third_party/scons/scons-local/SCons/Errors.py @@ -28,22 +28,90 @@ and user errors in SCons. """ -__revision__ = "src/engine/SCons/Errors.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Errors.py 3842 2008/12/20 22:59:52 scons" +import SCons.Util +import exceptions class BuildError(Exception): - def __init__(self, node=None, errstr="Unknown error", status=0, - filename=None, executor=None, action=None, command=None, - *args): - self.node = node + """ Errors occuring while building. + + BuildError have the following attributes: + + Information about the cause of the build error: + ----------------------------------------------- + + errstr : a description of the error message + + status : the return code of the action that caused the build + error. Must be set to a non-zero value even if the + build error is not due to an action returning a + non-zero returned code. + + exitstatus : SCons exit status due to this build error. + Must be nonzero unless due to an explicit Exit() + call. Not always the same as status, since + actions return a status code that should be + respected, but SCons typically exits with 2 + irrespective of the return value of the failed + action. + + filename : The name of the file or directory that caused the + build error. Set to None if no files are associated with + this error. This might be different from the target + being built. For example, failure to create the + directory in which the target file will appear. It + can be None if the error is not due to a particular + filename. + + exc_info : Info about exception that caused the build + error. Set to (None, None, None) if this build + error is not due to an exception. + + + Information about the cause of the location of the error: + --------------------------------------------------------- + + node : the error occured while building this target node(s) + + executor : the executor that caused the build to fail (might + be None if the build failures is not due to the + executor failing) + + action : the action that caused the build to fail (might be + None if the build failures is not due to the an + action failure) + + command : the command line for the action that caused the + build to fail (might be None if the build failures + is not due to the an action failure) + """ + + def __init__(self, + node=None, errstr="Unknown error", status=2, exitstatus=2, + filename=None, executor=None, action=None, command=None, + exc_info=(None, None, None)): + self.errstr = errstr self.status = status + self.exitstatus = exitstatus self.filename = filename + self.exc_info = exc_info + + self.node = node self.executor = executor self.action = action self.command = command - apply(Exception.__init__, (self,) + args) + + Exception.__init__(self, node, errstr, status, exitstatus, filename, + executor, action, command, exc_info) + + def __str__(self): + if self.filename: + return self.filename + ': ' + self.errstr + else: + return self.errstr class InternalError(Exception): pass @@ -61,11 +129,70 @@ class ExplicitExit(Exception): def __init__(self, node=None, status=None, *args): self.node = node self.status = status + self.exitstatus = status apply(Exception.__init__, (self,) + args) -class TaskmasterException(Exception): - def __init__(self, node=None, exc_info=(None, None, None), *args): - self.node = node - self.errstr = "Exception" - self.exc_info = exc_info - apply(Exception.__init__, (self,) + args) +def convert_to_BuildError(status, exc_info=None): + """ + Convert any return code a BuildError Exception. + + `status' can either be a return code or an Exception. + The buildError.status we set here will normally be + used as the exit status of the "scons" process. + """ + if not exc_info and isinstance(status, Exception): + exc_info = (status.__class__, status, None) + + if isinstance(status, BuildError): + buildError = status + buildError.exitstatus = 2 # always exit with 2 on build errors + elif isinstance(status, ExplicitExit): + status = status.status + errstr = 'Explicit exit, status %s' % status + buildError = BuildError( + errstr=errstr, + status=status, # might be 0, OK here + exitstatus=status, # might be 0, OK here + exc_info=exc_info) + # TODO(1.5): + #elif isinstance(status, (StopError, UserError)): + elif isinstance(status, StopError) or isinstance(status, UserError): + buildError = BuildError( + errstr=str(status), + status=2, + exitstatus=2, + exc_info=exc_info) + elif isinstance(status, exceptions.EnvironmentError): + # If an IOError/OSError happens, raise a BuildError. + # Report the name of the file or directory that caused the + # error, which might be different from the target being built + # (for example, failure to create the directory in which the + # target file will appear). + try: filename = status.filename + except AttributeError: filename = None + buildError = BuildError( + errstr=status.strerror, + status=status.errno, + exitstatus=2, + filename=filename, + exc_info=exc_info) + elif isinstance(status, Exception): + buildError = BuildError( + errstr='%s : %s' % (status.__class__.__name__, status), + status=2, + exitstatus=2, + exc_info=exc_info) + elif SCons.Util.is_String(status): + buildError = BuildError( + errstr=status, + status=2, + exitstatus=2) + else: + buildError = BuildError( + errstr="Error %s" % status, + status=status, + exitstatus=2) + + #import sys + #sys.stderr.write("convert_to_BuildError: status %s => (errstr %s, status %s)"%(status,buildError.errstr, buildError.status)) + return buildError diff --git a/third_party/scons/scons-local/SCons/Executor.py b/third_party/scons/scons-local/SCons/Executor.py index 43f02b2..a37da07 100644 --- a/third_party/scons/scons-local/SCons/Executor.py +++ b/third_party/scons/scons-local/SCons/Executor.py @@ -28,7 +28,7 @@ Nodes. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Executor.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Executor.py 3842 2008/12/20 22:59:52 scons" import string @@ -134,7 +134,11 @@ class Executor: raise status elif status: msg = "Error %s" % status - raise SCons.Errors.BuildError(errstr=msg, executor=self, action=act) + raise SCons.Errors.BuildError( + errstr=msg, + node=self.targets, + executor=self, + action=act) return status # use extra indirection because with new-style objects (Python 2.2 diff --git a/third_party/scons/scons-local/SCons/Job.py b/third_party/scons/scons-local/SCons/Job.py index 7e067a0..bcd3981 100644 --- a/third_party/scons/scons-local/SCons/Job.py +++ b/third_party/scons/scons-local/SCons/Job.py @@ -29,7 +29,7 @@ stop, and wait on jobs. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Job.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Job.py 3842 2008/12/20 22:59:52 scons" import os import signal @@ -243,7 +243,7 @@ else: while 1: task = self.requestQueue.get() - if not task: + if task is None: # The "None" value is used as a sentinel by # ThreadPool.cleanup(). This indicates that there # are no more tasks, so we should quit. @@ -284,8 +284,7 @@ else: e.args[0] SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) except ValueError, e: - msg = "Setting stack size failed:\n " + \ - e.message + msg = "Setting stack size failed:\n " + str(e) SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) # Create worker threads diff --git a/third_party/scons/scons-local/SCons/Memoize.py b/third_party/scons/scons-local/SCons/Memoize.py index 6a234fd..f79dd6b 100644 --- a/third_party/scons/scons-local/SCons/Memoize.py +++ b/third_party/scons/scons-local/SCons/Memoize.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Memoize.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Memoize.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Memoizer diff --git a/third_party/scons/scons-local/SCons/Node/Alias.py b/third_party/scons/scons-local/SCons/Node/Alias.py index 50aecbc..4ce9fff 100644 --- a/third_party/scons/scons-local/SCons/Node/Alias.py +++ b/third_party/scons/scons-local/SCons/Node/Alias.py @@ -30,7 +30,7 @@ This creates a hash of global Aliases (dummy targets). # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Node/Alias.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Node/Alias.py 3842 2008/12/20 22:59:52 scons" import string import UserDict diff --git a/third_party/scons/scons-local/SCons/Node/FS.py b/third_party/scons/scons-local/SCons/Node/FS.py index ec7fd5e..915f0cc 100644 --- a/third_party/scons/scons-local/SCons/Node/FS.py +++ b/third_party/scons/scons-local/SCons/Node/FS.py @@ -33,7 +33,7 @@ that can be used by scripts or modules looking for the canonical default. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Node/FS.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Node/FS.py 3842 2008/12/20 22:59:52 scons" import fnmatch from itertools import izip @@ -61,6 +61,23 @@ from SCons.Debug import Trace do_store_info = True + +class EntryProxyAttributeError(AttributeError): + """ + An AttributeError subclass for recording and displaying the name + of the underlying Entry involved in an AttributeError exception. + """ + def __init__(self, entry_proxy, attribute): + AttributeError.__init__(self) + self.entry_proxy = entry_proxy + self.attribute = attribute + def __str__(self): + entry = self.entry_proxy.get() + fmt = "%s instance %s has no attribute %s" + return fmt % (entry.__class__.__name__, + repr(entry.name), + repr(self.attribute)) + # The max_drift value: by default, use a cached signature value for # any file that's been untouched for more than two days. default_max_drift = 2*24*60*60 @@ -225,8 +242,6 @@ def LinkFunc(target, source, env): if func == Link_Funcs[-1]: # exception of the last link method (copy) are fatal raise - else: - pass return 0 Link = SCons.Action.Action(LinkFunc, None) @@ -485,16 +500,11 @@ class EntryProxy(SCons.Util.Proxy): except KeyError: try: attr = SCons.Util.Proxy.__getattr__(self, name) - except AttributeError: - entry = self.get() - classname = string.split(str(entry.__class__), '.')[-1] - if classname[-2:] == "'>": - # new-style classes report their name as: - # "<class 'something'>" - # instead of the classic classes: - # "something" - classname = classname[:-2] - raise AttributeError, "%s instance '%s' has no attribute '%s'" % (classname, entry.name, name) + except AttributeError, e: + # Raise our own AttributeError subclass with an + # overridden __str__() method that identifies the + # name of the entry that caused the exception. + raise EntryProxyAttributeError(self, name) return attr else: return attr_function(self) @@ -592,7 +602,7 @@ class Base(SCons.Node.Node): if self.duplicate or self.is_derived(): return self.get_path() srcnode = self.srcnode() - if srcnode.stat() is None and not self.stat() is None: + if srcnode.stat() is None and self.stat() is not None: result = self.get_path() else: result = srcnode.get_path() @@ -607,7 +617,7 @@ class Base(SCons.Node.Node): # values that the underlying stat() method saved. try: del self._memo['stat'] except KeyError: pass - if not self is srcnode: + if self is not srcnode: try: del srcnode._memo['stat'] except KeyError: pass return result @@ -625,7 +635,7 @@ class Base(SCons.Node.Node): return result def exists(self): - return not self.stat() is None + return self.stat() is not None def rexists(self): return self.rfile().exists() @@ -642,11 +652,11 @@ class Base(SCons.Node.Node): def isdir(self): st = self.stat() - return not st is None and stat.S_ISDIR(st[stat.ST_MODE]) + return st is not None and stat.S_ISDIR(st[stat.ST_MODE]) def isfile(self): st = self.stat() - return not st is None and stat.S_ISREG(st[stat.ST_MODE]) + return st is not None and stat.S_ISREG(st[stat.ST_MODE]) if hasattr(os, 'symlink'): def islink(self): @@ -886,7 +896,7 @@ class Entry(Base): def must_be_same(self, klass): """Called to make sure a Node is a Dir. Since we're an Entry, we can morph into one.""" - if not self.__class__ is klass: + if self.__class__ is not klass: self.__class__ = klass self._morph() self.clear() @@ -910,7 +920,7 @@ class Entry(Base): def rel_path(self, other): d = self.disambiguate() - if d.__class__ == Entry: + if d.__class__ is Entry: raise "rel_path() could not disambiguate File/Dir" return d.rel_path(other) @@ -1065,7 +1075,7 @@ class FS(LocalFS): """ curr=self._cwd try: - if not dir is None: + if dir is not None: self._cwd = dir if change_os_dir: os.chdir(dir.abspath) @@ -1171,7 +1181,7 @@ class FS(LocalFS): return root._lookup_abs(p, fsclass, create) def Entry(self, name, directory = None, create = 1): - """Lookup or create a generic Entry node with the specified name. + """Look up or create a generic Entry node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at @@ -1180,7 +1190,7 @@ class FS(LocalFS): return self._lookup(name, directory, Entry, create) def File(self, name, directory = None, create = 1): - """Lookup or create a File node with the specified name. If + """Look up or create a File node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction @@ -1192,7 +1202,7 @@ class FS(LocalFS): return self._lookup(name, directory, File, create) def Dir(self, name, directory = None, create = True): - """Lookup or create a Dir node with the specified name. If + """Look up or create a Dir node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction @@ -1348,7 +1358,7 @@ class Dir(Base): del node._srcreps except AttributeError: pass - if duplicate != None: + if duplicate is not None: node.duplicate=duplicate def __resetDuplicate(self, node): @@ -1367,8 +1377,7 @@ class Dir(Base): Looks up or creates a directory node named 'name' relative to this directory. """ - dir = self.fs.Dir(name, self, create) - return dir + return self.fs.Dir(name, self, create) def File(self, name): """ @@ -1451,15 +1460,15 @@ class Dir(Base): """Return a path to "other" relative to this directory. """ - # This complicated and expensive method, which constructs relative - # paths between arbitrary Node.FS objects, is no longer used - # by SCons itself. It was introduced to store dependency paths - # in .sconsign files relative to the target, but that ended up - # being significantly inefficient. + # This complicated and expensive method, which constructs relative + # paths between arbitrary Node.FS objects, is no longer used + # by SCons itself. It was introduced to store dependency paths + # in .sconsign files relative to the target, but that ended up + # being significantly inefficient. # - # We're continuing to support the method because some SConstruct - # files out there started using it when it was available, and - # we're all about backwards compatibility.. + # We're continuing to support the method because some SConstruct + # files out there started using it when it was available, and + # we're all about backwards compatibility.. try: memo_dict = self._memo['rel_path'] @@ -1473,11 +1482,9 @@ class Dir(Base): pass if self is other: - result = '.' elif not other in self.path_elements: - try: other_dir = other.get_dir() except AttributeError: @@ -1491,9 +1498,7 @@ class Dir(Base): result = other.name else: result = dir_rel_path + os.sep + other.name - else: - i = self.path_elements.index(other) + 1 path_elems = ['..'] * (len(self.path_elements) - i) \ @@ -1544,7 +1549,7 @@ class Dir(Base): def build(self, **kw): """A null "builder" for directories.""" global MkdirBuilder - if not self.builder is MkdirBuilder: + if self.builder is not MkdirBuilder: apply(SCons.Node.Node.build, [self,], kw) # @@ -1560,10 +1565,9 @@ class Dir(Base): if parent.exists(): break listDirs.append(parent) - p = parent.up() - if p is None: - raise SCons.Errors.StopError, parent.path - parent = p + parent = parent.up() + else: + raise SCons.Errors.StopError, parent.path listDirs.reverse() for dirnode in listDirs: try: @@ -1583,7 +1587,7 @@ class Dir(Base): def multiple_side_effect_has_builder(self): global MkdirBuilder - return not self.builder is MkdirBuilder and self.has_builder() + return self.builder is not MkdirBuilder and self.has_builder() def alter_targets(self): """Return any corresponding targets in a variant directory. @@ -1622,7 +1626,7 @@ class Dir(Base): def is_up_to_date(self): """If any child is not up-to-date, then this directory isn't, either.""" - if not self.builder is MkdirBuilder and not self.exists(): + if self.builder is not MkdirBuilder and not self.exists(): return 0 up_to_date = SCons.Node.up_to_date for kid in self.children(): @@ -1795,7 +1799,7 @@ class Dir(Base): except TypeError: pass node = self.srcdir_duplicate(name) if isinstance(node, Dir): - node = None + return None return node def walk(self, func, arg): @@ -1888,6 +1892,7 @@ class Dir(Base): for srcdir in self.srcdir_list(): search_dir_list.extend(srcdir.get_all_rdirs()) + selfEntry = self.Entry names = [] for dir in search_dir_list: # We use the .name attribute from the Node because the keys of @@ -1900,35 +1905,36 @@ class Dir(Base): if not strings: # Make sure the working directory (self) actually has # entries for all Nodes in repositories or variant dirs. - map(self.Entry, node_names) + map(selfEntry, node_names) if ondisk: try: disk_names = os.listdir(dir.abspath) except os.error: - pass - else: - names.extend(disk_names) - if not strings: - # We're going to return corresponding Nodes in - # the local directory, so we need to make sure - # those Nodes exist. We only want to create - # Nodes for the entries that will match the - # specified pattern, though, which means we - # need to filter the list here, even though - # the overall list will also be filtered later, - # after we exit this loop. - if pattern[0] != '.': - #disk_names = [ d for d in disk_names if d[0] != '.' ] - disk_names = filter(lambda x: x[0] != '.', disk_names) - disk_names = fnmatch.filter(disk_names, pattern) - rep_nodes = map(dir.Entry, disk_names) - #rep_nodes = [ n.disambiguate() for n in rep_nodes ] - rep_nodes = map(lambda n: n.disambiguate(), rep_nodes) - for node, name in izip(rep_nodes, disk_names): - n = self.Entry(name) - if n.__class__ != node.__class__: - n.__class__ = node.__class__ - n._morph() + continue + names.extend(disk_names) + if not strings: + # We're going to return corresponding Nodes in + # the local directory, so we need to make sure + # those Nodes exist. We only want to create + # Nodes for the entries that will match the + # specified pattern, though, which means we + # need to filter the list here, even though + # the overall list will also be filtered later, + # after we exit this loop. + if pattern[0] != '.': + #disk_names = [ d for d in disk_names if d[0] != '.' ] + disk_names = filter(lambda x: x[0] != '.', disk_names) + disk_names = fnmatch.filter(disk_names, pattern) + dirEntry = dir.Entry + for name in disk_names: + # Add './' before disk filename so that '#' at + # beginning of filename isn't interpreted. + name = './' + name + node = dirEntry(name).disambiguate() + n = selfEntry(name) + if n.__class__ != node.__class__: + n.__class__ = node.__class__ + n._morph() names = set(names) if pattern[0] != '.': @@ -2137,14 +2143,13 @@ class FileBuildInfo(SCons.Node.BuildInfoBase): strings = getattr(self, nattr) nodeinfos = getattr(self, sattr) except AttributeError: - pass - else: - nodes = [] - for s, ni in izip(strings, nodeinfos): - if not isinstance(s, SCons.Node.Node): - s = ni.str_to_node(s) - nodes.append(s) - setattr(self, nattr, nodes) + continue + nodes = [] + for s, ni in izip(strings, nodeinfos): + if not isinstance(s, SCons.Node.Node): + s = ni.str_to_node(s) + nodes.append(s) + setattr(self, nattr, nodes) def format(self, names=0): result = [] bkids = self.bsources + self.bdepends + self.bimplicit @@ -2177,26 +2182,25 @@ class File(Base): def Entry(self, name): """Create an entry node named 'name' relative to - the SConscript directory of this file.""" - cwd = self.cwd or self.fs._cwd - return cwd.Entry(name) + the directory of this file.""" + return self.dir.Entry(name) def Dir(self, name, create=True): """Create a directory node named 'name' relative to - the SConscript directory of this file.""" - cwd = self.cwd or self.fs._cwd - return cwd.Dir(name, create) + the directory of this file.""" + return self.dir.Dir(name, create=create) def Dirs(self, pathlist): """Create a list of directories relative to the SConscript directory of this file.""" + # TODO(1.5) + # return [self.Dir(p) for p in pathlist] return map(lambda p, s=self: s.Dir(p), pathlist) def File(self, name): """Create a file node named 'name' relative to - the SConscript directory of this file.""" - cwd = self.cwd or self.fs._cwd - return cwd.File(name) + the directory of this file.""" + return self.dir.File(name) #def generate_build_dict(self): # """Return an appropriate dictionary of values for building @@ -2390,26 +2394,24 @@ class File(Base): try: value = getattr(old_entry, attr) except AttributeError: - pass - else: - setattr(binfo, attr, value) - delattr(old_entry, attr) + continue + setattr(binfo, attr, value) + delattr(old_entry, attr) for attr in self.convert_sig_attrs: try: sig_list = getattr(old_entry, attr) except AttributeError: - pass - else: - value = [] - for sig in sig_list: - ninfo = self.new_ninfo() - if len(sig) == 32: - ninfo.csig = sig - else: - ninfo.timestamp = sig - value.append(ninfo) - setattr(binfo, attr, value) - delattr(old_entry, attr) + continue + value = [] + for sig in sig_list: + ninfo = self.new_ninfo() + if len(sig) == 32: + ninfo.csig = sig + else: + ninfo.timestamp = sig + value.append(ninfo) + setattr(binfo, attr, value) + delattr(old_entry, attr) return new_entry memoizer_counters.append(SCons.Memoize.CountValue('get_stored_info')) @@ -2473,6 +2475,7 @@ class File(Base): pass if scanner: + # result = [n.disambiguate() for n in scanner(self, env, path)] result = scanner(self, env, path) result = map(lambda N: N.disambiguate(), result) else: @@ -2576,7 +2579,7 @@ class File(Base): scb = self.sbuilder except AttributeError: scb = self.sbuilder = self.find_src_builder() - return not scb is None + return scb is not None def alter_targets(self): """Return any corresponding targets in a variant directory. @@ -2649,7 +2652,7 @@ class File(Base): # Duplicate from source path if we are set up to do this. if self.duplicate and not self.is_derived() and not self.linked: src = self.srcnode() - if not src is self: + if src is not self: # At this point, src is meant to be copied in a variant directory. src = src.rfile() if src.abspath != self.abspath: @@ -2683,23 +2686,22 @@ class File(Base): old = self.get_stored_info() mtime = self.get_timestamp() - csig = None max_drift = self.fs.max_drift if max_drift > 0: if (time.time() - mtime) > max_drift: try: n = old.ninfo if n.timestamp and n.csig and n.timestamp == mtime: - csig = n.csig + return n.csig except AttributeError: pass elif max_drift == 0: try: - csig = old.ninfo.csig + return old.ninfo.csig except AttributeError: pass - return csig + return None def get_csig(self): """ @@ -2754,7 +2756,7 @@ class File(Base): return 1 def changed_state(self, target, prev_ni): - return (self.state != SCons.Node.up_to_date) + return self.state != SCons.Node.up_to_date def changed_timestamp_then_content(self, target, prev_ni): if not self.changed_timestamp_match(target, prev_ni): @@ -2875,13 +2877,14 @@ class File(Base): # Add the path to the cache signature, because multiple # targets built by the same action will all have the same # build signature, and we have to differentiate them somehow. - children = self.children() - sigs = map(lambda n: n.get_cachedir_csig(), children) + children = self.children() executor = self.get_executor() + # sigs = [n.get_cachedir_csig() for n in children] + sigs = map(lambda n: n.get_cachedir_csig(), children) sigs.append(SCons.Util.MD5signature(executor.get_contents())) sigs.append(self.path) - self.cachesig = SCons.Util.MD5collect(sigs) - return self.cachesig + result = self.cachesig = SCons.Util.MD5collect(sigs) + return result default_fs = None @@ -2971,14 +2974,11 @@ class FileFinder: except KeyError: pass - if verbose: + if verbose and not callable(verbose): if not SCons.Util.is_String(verbose): verbose = "find_file" - if not callable(verbose): - verbose = ' %s: ' % verbose - verbose = lambda s, v=verbose: sys.stdout.write(v + s) - else: - verbose = lambda x: x + verbose = ' %s: ' % verbose + verbose = lambda s, v=verbose: sys.stdout.write(v + s) filedir, filename = os.path.split(filename) if filedir: @@ -3017,10 +3017,12 @@ class FileFinder: result = None for dir in paths: - verbose("looking for '%s' in '%s' ...\n" % (filename, dir)) + if verbose: + verbose("looking for '%s' in '%s' ...\n" % (filename, dir)) node, d = dir.srcdir_find_file(filename) if node: - verbose("... FOUND '%s' in '%s'\n" % (filename, d)) + if verbose: + verbose("... FOUND '%s' in '%s'\n" % (filename, d)) result = node break @@ -3048,12 +3050,11 @@ def invalidate_node_memos(targets): # affected. XXX The way to check if Execute() is in the stacktrace # is a very dirty hack and should be replaced by a more sensible # solution. - must_invalidate = 0 - tb = extract_stack() - for f in tb: + for f in extract_stack(): if f[2] == 'Execute' and f[0][-14:] == 'Environment.py': - must_invalidate = 1 - if not must_invalidate: + break + else: + # Dont have to invalidate, so return return if not SCons.Util.is_List(targets): diff --git a/third_party/scons/scons-local/SCons/Node/Python.py b/third_party/scons/scons-local/SCons/Node/Python.py index 36388ae..21fbb15 100644 --- a/third_party/scons/scons-local/SCons/Node/Python.py +++ b/third_party/scons/scons-local/SCons/Node/Python.py @@ -27,7 +27,7 @@ Python nodes. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Node/Python.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Node/Python.py 3842 2008/12/20 22:59:52 scons" import SCons.Node diff --git a/third_party/scons/scons-local/SCons/Node/__init__.py b/third_party/scons/scons-local/SCons/Node/__init__.py index 322a18d..8ea6719 100644 --- a/third_party/scons/scons-local/SCons/Node/__init__.py +++ b/third_party/scons/scons-local/SCons/Node/__init__.py @@ -42,7 +42,7 @@ be able to depend on any other type of "thing." # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Node/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Node/__init__.py 3842 2008/12/20 22:59:52 scons" import copy from itertools import chain, izip @@ -1104,7 +1104,10 @@ class Node: env = self.get_build_env() for s in self.sources: scanner = self.get_source_scanner(s) - path = self.get_build_scanner_path(scanner) + if scanner: + path = self.get_build_scanner_path(scanner) + else: + path = None def f(node, env=env, scanner=scanner, path=path): return node.get_found_includes(env, scanner, path) return SCons.Util.render_tree(s, f, 1) diff --git a/third_party/scons/scons-local/SCons/Options/BoolOption.py b/third_party/scons/scons-local/SCons/Options/BoolOption.py index 893030f..c5fed0a 100644 --- a/third_party/scons/scons-local/SCons/Options/BoolOption.py +++ b/third_party/scons/scons-local/SCons/Options/BoolOption.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/BoolOption.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/BoolOption.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,5 +31,14 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings -BoolOption = SCons.Variables.BoolVariable +warned = False + +def BoolOption(*args, **kw): + global warned + if not warned: + msg = "The BoolOption() function is deprecated; use the BoolVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return apply(SCons.Variables.BoolVariable, args, kw) diff --git a/third_party/scons/scons-local/SCons/Options/EnumOption.py b/third_party/scons/scons-local/SCons/Options/EnumOption.py index 2d7d032..4f50d01 100644 --- a/third_party/scons/scons-local/SCons/Options/EnumOption.py +++ b/third_party/scons/scons-local/SCons/Options/EnumOption.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/EnumOption.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/EnumOption.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,5 +31,14 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings -EnumOption = SCons.Variables.EnumVariable +warned = False + +def EnumOption(*args, **kw): + global warned + if not warned: + msg = "The EnumOption() function is deprecated; use the EnumVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return apply(SCons.Variables.EnumVariable, args, kw) diff --git a/third_party/scons/scons-local/SCons/Options/ListOption.py b/third_party/scons/scons-local/SCons/Options/ListOption.py index 03fffc2..b4cd923 100644 --- a/third_party/scons/scons-local/SCons/Options/ListOption.py +++ b/third_party/scons/scons-local/SCons/Options/ListOption.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/ListOption.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/ListOption.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,5 +31,14 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings -ListOption = SCons.Variables.ListVariable +warned = False + +def ListOption(*args, **kw): + global warned + if not warned: + msg = "The ListOption() function is deprecated; use the ListVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return apply(SCons.Variables.ListVariable, args, kw) diff --git a/third_party/scons/scons-local/SCons/Options/PackageOption.py b/third_party/scons/scons-local/SCons/Options/PackageOption.py index dd143f5..7fcbe5f1 100644 --- a/third_party/scons/scons-local/SCons/Options/PackageOption.py +++ b/third_party/scons/scons-local/SCons/Options/PackageOption.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/PackageOption.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/PackageOption.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,5 +31,14 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings -PackageOption = SCons.Variables.PackageVariable +warned = False + +def PackageOption(*args, **kw): + global warned + if not warned: + msg = "The PackageOption() function is deprecated; use the PackageVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + return apply(SCons.Variables.PackageVariable, args, kw) diff --git a/third_party/scons/scons-local/SCons/Options/PathOption.py b/third_party/scons/scons-local/SCons/Options/PathOption.py index 7c58674..649fc45 100644 --- a/third_party/scons/scons-local/SCons/Options/PathOption.py +++ b/third_party/scons/scons-local/SCons/Options/PathOption.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/PathOption.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/PathOption.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,5 +31,40 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings -PathOption = SCons.Variables.PathVariable +warned = False + +class _PathOptionClass: + def warn(self): + global warned + if not warned: + msg = "The PathOption() function is deprecated; use the PathVariable() function instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + + def __call__(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable, args, kw) + + def PathAccept(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable.PathAccept, args, kw) + + def PathIsDir(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable.PathIsDir, args, kw) + + def PathIsDirCreate(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable.PathIsDirCreate, args, kw) + + def PathIsFile(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable.PathIsFile, args, kw) + + def PathExists(self, *args, **kw): + self.warn() + return apply(SCons.Variables.PathVariable.PathExists, args, kw) + +PathOption = _PathOptionClass() diff --git a/third_party/scons/scons-local/SCons/Options/__init__.py b/third_party/scons/scons-local/SCons/Options/__init__.py index 9ba4291..3e41b8d 100644 --- a/third_party/scons/scons-local/SCons/Options/__init__.py +++ b/third_party/scons/scons-local/SCons/Options/__init__.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Options/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Options/__init__.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Options module hierarchy @@ -31,6 +31,7 @@ and will then be removed entirely (some day). """ import SCons.Variables +import SCons.Warnings from BoolOption import BoolOption # okay from EnumOption import EnumOption # okay @@ -38,7 +39,18 @@ from ListOption import ListOption # naja from PackageOption import PackageOption # naja from PathOption import PathOption # okay +warned = False + class Options(SCons.Variables.Variables): + def __init__(self, *args, **kw): + global warned + if not warned: + msg = "The Options class is deprecated; use the Variables class instead." + SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) + warned = True + apply(SCons.Variables.Variables.__init__, + (self,) + args, + kw) def AddOptions(self, *args, **kw): return apply(SCons.Variables.Variables.AddVariables, diff --git a/third_party/scons/scons-local/SCons/PathList.py b/third_party/scons/scons-local/SCons/PathList.py index 5278096..8b877fa 100644 --- a/third_party/scons/scons-local/SCons/PathList.py +++ b/third_party/scons/scons-local/SCons/PathList.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/PathList.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/PathList.py 3842 2008/12/20 22:59:52 scons" __doc__ = """SCons.PathList diff --git a/third_party/scons/scons-local/SCons/Platform/__init__.py b/third_party/scons/scons-local/SCons/Platform/__init__.py index d61f848..1215865 100644 --- a/third_party/scons/scons-local/SCons/Platform/__init__.py +++ b/third_party/scons/scons-local/SCons/Platform/__init__.py @@ -42,7 +42,7 @@ their own platform definition. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/__init__.py 3842 2008/12/20 22:59:52 scons" import imp import os diff --git a/third_party/scons/scons-local/SCons/Platform/aix.py b/third_party/scons/scons-local/SCons/Platform/aix.py index 7fd8e81..c8cb7e8 100644 --- a/third_party/scons/scons-local/SCons/Platform/aix.py +++ b/third_party/scons/scons-local/SCons/Platform/aix.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/aix.py 3842 2008/12/20 22:59:52 scons" import os import string diff --git a/third_party/scons/scons-local/SCons/Platform/cygwin.py b/third_party/scons/scons-local/SCons/Platform/cygwin.py index 06448aa..f51eeb1 100644 --- a/third_party/scons/scons-local/SCons/Platform/cygwin.py +++ b/third_party/scons/scons-local/SCons/Platform/cygwin.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/cygwin.py 3842 2008/12/20 22:59:52 scons" import posix from SCons.Platform import TempFileMunge diff --git a/third_party/scons/scons-local/SCons/Platform/darwin.py b/third_party/scons/scons-local/SCons/Platform/darwin.py index 84b2711..9436546 100644 --- a/third_party/scons/scons-local/SCons/Platform/darwin.py +++ b/third_party/scons/scons-local/SCons/Platform/darwin.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/darwin.py 3842 2008/12/20 22:59:52 scons" import posix diff --git a/third_party/scons/scons-local/SCons/Platform/hpux.py b/third_party/scons/scons-local/SCons/Platform/hpux.py index b51a885..2bd468b 100644 --- a/third_party/scons/scons-local/SCons/Platform/hpux.py +++ b/third_party/scons/scons-local/SCons/Platform/hpux.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/hpux.py 3842 2008/12/20 22:59:52 scons" import posix diff --git a/third_party/scons/scons-local/SCons/Platform/irix.py b/third_party/scons/scons-local/SCons/Platform/irix.py index c6e3bca..b70481d 100644 --- a/third_party/scons/scons-local/SCons/Platform/irix.py +++ b/third_party/scons/scons-local/SCons/Platform/irix.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/irix.py 3842 2008/12/20 22:59:52 scons" import posix diff --git a/third_party/scons/scons-local/SCons/Platform/os2.py b/third_party/scons/scons-local/SCons/Platform/os2.py index eb7bf74..803d890 100644 --- a/third_party/scons/scons-local/SCons/Platform/os2.py +++ b/third_party/scons/scons-local/SCons/Platform/os2.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/os2.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/os2.py 3842 2008/12/20 22:59:52 scons" def generate(env): if not env.has_key('ENV'): diff --git a/third_party/scons/scons-local/SCons/Platform/posix.py b/third_party/scons/scons-local/SCons/Platform/posix.py index 48605ec..6d0b074 100644 --- a/third_party/scons/scons-local/SCons/Platform/posix.py +++ b/third_party/scons/scons-local/SCons/Platform/posix.py @@ -30,13 +30,13 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/posix.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/posix.py 3842 2008/12/20 22:59:52 scons" import errno import os import os.path -import popen2 import string +import subprocess import sys import select @@ -131,8 +131,10 @@ def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr): raise def exec_popen3(l, env, stdout, stderr): - proc = popen2.Popen3(string.join(l), 1) - process_cmd_output(proc.fromchild, proc.childerr, stdout, stderr) + proc = subprocess.Popen(string.join(l), + stdout=stdout, + stderr=stderr, + shell=True) stat = proc.wait() if stat & 0xff: return stat | 0x80 diff --git a/third_party/scons/scons-local/SCons/Platform/sunos.py b/third_party/scons/scons-local/SCons/Platform/sunos.py index 9edf3aa..03435c6 100644 --- a/third_party/scons/scons-local/SCons/Platform/sunos.py +++ b/third_party/scons/scons-local/SCons/Platform/sunos.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/sunos.py 3842 2008/12/20 22:59:52 scons" import posix diff --git a/third_party/scons/scons-local/SCons/Platform/win32.py b/third_party/scons/scons-local/SCons/Platform/win32.py index 333c347..3ec0a52 100644 --- a/third_party/scons/scons-local/SCons/Platform/win32.py +++ b/third_party/scons/scons-local/SCons/Platform/win32.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Platform/win32.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/SConf.py b/third_party/scons/scons-local/SCons/SConf.py index 1249226..ec80fe9 100644 --- a/third_party/scons/scons-local/SCons/SConf.py +++ b/third_party/scons/scons-local/SCons/SConf.py @@ -26,7 +26,7 @@ Autoconf-like configuration support. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/SConf.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/SConf.py 3842 2008/12/20 22:59:52 scons" import os import re diff --git a/third_party/scons/scons-local/SCons/SConsign.py b/third_party/scons/scons-local/SCons/SConsign.py index 6607f12..8e4c30c 100644 --- a/third_party/scons/scons-local/SCons/SConsign.py +++ b/third_party/scons/scons-local/SCons/SConsign.py @@ -27,7 +27,7 @@ Writing and reading information to the .sconsign file or files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/SConsign.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/SConsign.py 3842 2008/12/20 22:59:52 scons" import cPickle import os diff --git a/third_party/scons/scons-local/SCons/Scanner/C.py b/third_party/scons/scons-local/SCons/Scanner/C.py index a097089..926493e 100644 --- a/third_party/scons/scons-local/SCons/Scanner/C.py +++ b/third_party/scons/scons-local/SCons/Scanner/C.py @@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/C.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/C.py 3842 2008/12/20 22:59:52 scons" import SCons.Node.FS import SCons.Scanner diff --git a/third_party/scons/scons-local/SCons/Scanner/D.py b/third_party/scons/scons-local/SCons/Scanner/D.py index b997e30..97ece3a 100644 --- a/third_party/scons/scons-local/SCons/Scanner/D.py +++ b/third_party/scons/scons-local/SCons/Scanner/D.py @@ -30,7 +30,7 @@ Coded by Andy Friesen # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/D.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/D.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Scanner/Dir.py b/third_party/scons/scons-local/SCons/Scanner/Dir.py index dbb282a..35d5008 100644 --- a/third_party/scons/scons-local/SCons/Scanner/Dir.py +++ b/third_party/scons/scons-local/SCons/Scanner/Dir.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/Dir.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/Dir.py 3842 2008/12/20 22:59:52 scons" import SCons.Node.FS import SCons.Scanner diff --git a/third_party/scons/scons-local/SCons/Scanner/Fortran.py b/third_party/scons/scons-local/SCons/Scanner/Fortran.py index 3d963ca..e629b80 100644 --- a/third_party/scons/scons-local/SCons/Scanner/Fortran.py +++ b/third_party/scons/scons-local/SCons/Scanner/Fortran.py @@ -27,7 +27,7 @@ This module implements the dependency scanner for Fortran code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/Fortran.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/Fortran.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Scanner/IDL.py b/third_party/scons/scons-local/SCons/Scanner/IDL.py index e47a41f..9bd1728 100644 --- a/third_party/scons/scons-local/SCons/Scanner/IDL.py +++ b/third_party/scons/scons-local/SCons/Scanner/IDL.py @@ -28,7 +28,7 @@ Definition Language) files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/IDL.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/IDL.py 3842 2008/12/20 22:59:52 scons" import SCons.Node.FS import SCons.Scanner diff --git a/third_party/scons/scons-local/SCons/Scanner/LaTeX.py b/third_party/scons/scons-local/SCons/Scanner/LaTeX.py index fefeb14..3e17e25 100644 --- a/third_party/scons/scons-local/SCons/Scanner/LaTeX.py +++ b/third_party/scons/scons-local/SCons/Scanner/LaTeX.py @@ -27,13 +27,77 @@ This module implements the dependency scanner for LaTeX code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/LaTeX.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/LaTeX.py 3842 2008/12/20 22:59:52 scons" import os.path import string import re import SCons.Scanner +import SCons.Util + +# list of graphics file extensions for TeX and LaTeX +TexGraphics = ['.eps', '.ps'] +LatexGraphics = ['.pdf', '.png', '.jpg', '.gif', '.tif'] + +# Used as a return value of modify_env_var if the variable is not set. +class _Null: + pass +_null = _Null + +# The user specifies the paths in env[variable], similar to other builders. +# They may be relative and must be converted to absolute, as expected +# by LaTeX and Co. The environment may already have some paths in +# env['ENV'][var]. These paths are honored, but the env[var] paths have +# higher precedence. All changes are un-done on exit. +def modify_env_var(env, var, abspath): + try: + save = env['ENV'][var] + except KeyError: + save = _null + env.PrependENVPath(var, abspath) + try: + if SCons.Util.is_List(env[var]): + #TODO(1.5) + #env.PrependENVPath(var, [os.path.abspath(str(p)) for p in env[var]]) + env.PrependENVPath(var, map(lambda p: os.path.abspath(str(p)), env[var])) + else: + # Split at os.pathsep to convert into absolute path + #TODO(1.5) env.PrependENVPath(var, [os.path.abspath(p) for p in str(env[var]).split(os.pathsep)]) + env.PrependENVPath(var, map(lambda p: os.path.abspath(p), string.split(str(env[var]), os.pathsep))) + except KeyError: + pass + + # Convert into a string explicitly to append ":" (without which it won't search system + # paths as well). The problem is that env.AppendENVPath(var, ":") + # does not work, refuses to append ":" (os.pathsep). + + if SCons.Util.is_List(env['ENV'][var]): + # TODO(1.5) + #env['ENV'][var] = os.pathsep.join(env['ENV'][var]) + env['ENV'][var] = string.join(env['ENV'][var], os.pathsep) + # Append the trailing os.pathsep character here to catch the case with no env[var] + env['ENV'][var] = env['ENV'][var] + os.pathsep + + return save + +class FindENVPathDirs: + """A class to bind a specific *PATH variable name to a function that + will return all of the *path directories.""" + def __init__(self, variable): + self.variable = variable + def __call__(self, env, dir=None, target=None, source=None, argument=None): + import SCons.PathList + try: + path = env['ENV'][self.variable] + except KeyError: + return () + + dir = dir or env.fs._cwd + path = SCons.PathList.PathList(path).subst_path(env, target, source) + return tuple(dir.Rfindalldirs(path)) + + def LaTeXScanner(): """Return a prototype Scanner instance for scanning LaTeX source files @@ -42,7 +106,7 @@ def LaTeXScanner(): ds = LaTeX(name = "LaTeXScanner", suffixes = '$LATEXSUFFIXES', # in the search order, see below in LaTeX class docstring - graphics_extensions = ['.eps', '.ps'], + graphics_extensions = TexGraphics, recursive = 0) return ds @@ -53,7 +117,7 @@ def PDFLaTeXScanner(): ds = LaTeX(name = "PDFLaTeXScanner", suffixes = '$LATEXSUFFIXES', # in the search order, see below in LaTeX class docstring - graphics_extensions = ['.pdf', '.png', '.jpg', '.gif', '.tif'], + graphics_extensions = LatexGraphics, recursive = 0) return ds @@ -132,14 +196,17 @@ class LaTeX(SCons.Scanner.Base): def __init__(self, dictionary): self.dictionary = {} for k,n in dictionary.items(): - self.dictionary[k] = SCons.Scanner.FindPathDirs(n) + self.dictionary[k] = ( SCons.Scanner.FindPathDirs(n), + FindENVPathDirs(n) ) def __call__(self, env, dir=None, target=None, source=None, argument=None): di = {} - for k,c in self.dictionary.items(): - di[k] = c(env, dir=None, target=None, source=None, - argument=None) + for k,(c,cENV) in self.dictionary.items(): + di[k] = ( c(env, dir=None, target=None, source=None, + argument=None) , + cENV(env, dir=None, target=None, source=None, + argument=None) ) # To prevent "dict is not hashable error" return tuple(di.items()) @@ -197,7 +264,12 @@ class LaTeX(SCons.Scanner.Base): sub_path = () try_names = self._latex_names(include) for n in try_names: - i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path) + # see if we find it using the path in env[var] + i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[0]) + if i: + return i, include + # see if we find it using the path in env['ENV'][var] + i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[1]) if i: return i, include return i, include diff --git a/third_party/scons/scons-local/SCons/Scanner/Prog.py b/third_party/scons/scons-local/SCons/Scanner/Prog.py index 048266a..ad71ba4 100644 --- a/third_party/scons/scons-local/SCons/Scanner/Prog.py +++ b/third_party/scons/scons-local/SCons/Scanner/Prog.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/Prog.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/Prog.py 3842 2008/12/20 22:59:52 scons" import string diff --git a/third_party/scons/scons-local/SCons/Scanner/RC.py b/third_party/scons/scons-local/SCons/Scanner/RC.py index 051eb3d..ecbc572 100644 --- a/third_party/scons/scons-local/SCons/Scanner/RC.py +++ b/third_party/scons/scons-local/SCons/Scanner/RC.py @@ -28,7 +28,7 @@ Definition Language) files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/RC.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/RC.py 3842 2008/12/20 22:59:52 scons" import SCons.Node.FS import SCons.Scanner diff --git a/third_party/scons/scons-local/SCons/Scanner/__init__.py b/third_party/scons/scons-local/SCons/Scanner/__init__.py index 2df41c1..e18f0fe 100644 --- a/third_party/scons/scons-local/SCons/Scanner/__init__.py +++ b/third_party/scons/scons-local/SCons/Scanner/__init__.py @@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Scanner/__init__.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Script/Interactive.py b/third_party/scons/scons-local/SCons/Script/Interactive.py index 4618920..13cc414 100644 --- a/third_party/scons/scons-local/SCons/Script/Interactive.py +++ b/third_party/scons/scons-local/SCons/Script/Interactive.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/Interactive.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Script/Interactive.py 3842 2008/12/20 22:59:52 scons" __doc__ = """ SCons interactive mode @@ -259,6 +259,12 @@ class SConsInteractiveCmd(cmd.Cmd): node.set_state(SCons.Node.no_state) node.implicit = None + # Debug: Uncomment to verify that all Taskmaster reference + # counts have been reset to zero. + #if node.ref_count != 0: + # from SCons.Debug import Trace + # Trace('node %s, ref_count %s !!!\n' % (node, node.ref_count)) + SCons.SConsign.Reset() SCons.Script.Main.progress_display("scons: done clearing node information.") diff --git a/third_party/scons/scons-local/SCons/Script/Main.py b/third_party/scons/scons-local/SCons/Script/Main.py index 05063aa..5624038 100644 --- a/third_party/scons/scons-local/SCons/Script/Main.py +++ b/third_party/scons/scons-local/SCons/Script/Main.py @@ -34,7 +34,7 @@ it goes here. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/Main.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Script/Main.py 3842 2008/12/20 22:59:52 scons" import os import os.path @@ -216,6 +216,8 @@ class BuildTask(SCons.Taskmaster.Task): sys.stderr.write("\n") try: raise SCons.Errors.BuildError(t, errstr) + except KeyboardInterrupt: + raise except: self.exception_set() self.do_failed() @@ -229,54 +231,55 @@ class BuildTask(SCons.Taskmaster.Task): # Handle the failure of a build task. The primary purpose here # is to display the various types of Errors and Exceptions # appropriately. - status = 2 exc_info = self.exc_info() try: t, e, tb = exc_info except ValueError: t, e = exc_info tb = None + if t is None: # The Taskmaster didn't record an exception for this Task; # see if the sys module has one. - t, e = sys.exc_info()[:2] - - def nodestring(n): - if not SCons.Util.is_List(n): - n = [ n ] - return string.join(map(str, n), ', ') + try: + t, e, tb = sys.exc_info()[:] + except ValueError: + t, e = exc_info + tb = None + + # Deprecated string exceptions will have their string stored + # in the first entry of the tuple. + if e is None: + e = t + + buildError = SCons.Errors.convert_to_BuildError(e) + if not buildError.node: + buildError.node = self.node + + node = buildError.node + if not SCons.Util.is_List(node): + node = [ node ] + nodename = string.join(map(str, node), ', ') errfmt = "scons: *** [%s] %s\n" - - if t == SCons.Errors.BuildError: - tname = nodestring(e.node) - errstr = e.errstr - if e.filename: - errstr = e.filename + ': ' + errstr - sys.stderr.write(errfmt % (tname, errstr)) - elif t == SCons.Errors.TaskmasterException: - tname = nodestring(e.node) - sys.stderr.write(errfmt % (tname, e.errstr)) - type, value, trace = e.exc_info + sys.stderr.write(errfmt % (nodename, buildError)) + + if (buildError.exc_info[2] and buildError.exc_info[1] and + # TODO(1.5) + #not isinstance( + # buildError.exc_info[1], + # (EnvironmentError, SCons.Errors.StopError, SCons.Errors.UserError))): + not isinstance(buildError.exc_info[1], EnvironmentError) and + not isinstance(buildError.exc_info[1], SCons.Errors.StopError) and + not isinstance(buildError.exc_info[1], SCons.Errors.UserError)): + type, value, trace = buildError.exc_info traceback.print_exception(type, value, trace) - elif t == SCons.Errors.ExplicitExit: - status = e.status - tname = nodestring(e.node) - errstr = 'Explicit exit, status %s' % status - sys.stderr.write(errfmt % (tname, errstr)) - else: - if e is None: - e = t - s = str(e) - if t == SCons.Errors.StopError and not self.options.keep_going: - s = s + ' Stop.' - sys.stderr.write("scons: *** %s\n" % s) - - if tb and print_stacktrace: - sys.stderr.write("scons: internal stack trace:\n") - traceback.print_tb(tb, file=sys.stderr) + elif tb and print_stacktrace: + sys.stderr.write("scons: internal stack trace:\n") + traceback.print_tb(tb, file=sys.stderr) - self.do_failed(status) + self.exception = (e, buildError, tb) # type, value, traceback + self.do_failed(buildError.exitstatus) self.exc_clear() @@ -598,12 +601,14 @@ def _scons_internal_error(): traceback.print_exc() sys.exit(2) -def _SConstruct_exists(dirname='', repositories=[]): +def _SConstruct_exists(dirname='', repositories=[], filelist=None): """This function checks that an SConstruct file exists in a directory. If so, it returns the path of the file. By default, it checks the current directory. """ - for file in ['SConstruct', 'Sconstruct', 'sconstruct']: + if not filelist: + filelist = ['SConstruct', 'Sconstruct', 'sconstruct'] + for file in filelist: sfile = os.path.join(dirname, file) if os.path.isfile(sfile): return sfile @@ -732,6 +737,7 @@ def _main(parser): default_warnings = [ SCons.Warnings.CorruptSConsignWarning, SCons.Warnings.DeprecatedWarning, SCons.Warnings.DuplicateEnvironmentWarning, + SCons.Warnings.FutureReservedVariableWarning, SCons.Warnings.LinkWarning, SCons.Warnings.MissingSConscriptWarning, SCons.Warnings.NoMD5ModuleWarning, @@ -739,7 +745,9 @@ def _main(parser): SCons.Warnings.NoObjectCountWarning, SCons.Warnings.NoParallelSupportWarning, SCons.Warnings.MisleadingKeywordsWarning, - SCons.Warnings.StackSizeWarning, ] + SCons.Warnings.ReservedVariableWarning, + SCons.Warnings.StackSizeWarning, + ] for warning in default_warnings: SCons.Warnings.enableWarningClass(warning) @@ -777,13 +785,15 @@ def _main(parser): if options.climb_up: target_top = '.' # directory to prepend to targets script_dir = os.getcwd() # location of script - while script_dir and not _SConstruct_exists(script_dir, options.repository): + while script_dir and not _SConstruct_exists(script_dir, + options.repository, + options.file): script_dir, last_part = os.path.split(script_dir) if last_part: target_top = os.path.join(last_part, target_top) else: script_dir = '' - if script_dir: + if script_dir and script_dir != os.getcwd(): display("scons: Entering directory `%s'" % script_dir) os.chdir(script_dir) @@ -802,7 +812,8 @@ def _main(parser): if options.file: scripts.extend(options.file) if not scripts: - sfile = _SConstruct_exists(repositories=options.repository) + sfile = _SConstruct_exists(repositories=options.repository, + filelist=options.file) if sfile: scripts.append(sfile) @@ -1266,6 +1277,8 @@ def main(): except SConsPrintHelpException: parser.print_help() exit_status = 0 + except SCons.Errors.BuildError, e: + exit_status = e.exitstatus except: # An exception here is likely a builtin Python exception Python # code in an SConscript file. Show them precisely what the diff --git a/third_party/scons/scons-local/SCons/Script/SConsOptions.py b/third_party/scons/scons-local/SCons/Script/SConsOptions.py index 40e811a..636fd20 100644 --- a/third_party/scons/scons-local/SCons/Script/SConsOptions.py +++ b/third_party/scons/scons-local/SCons/Script/SConsOptions.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/SConsOptions.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Script/SConsOptions.py 3842 2008/12/20 22:59:52 scons" import optparse import re diff --git a/third_party/scons/scons-local/SCons/Script/SConscript.py b/third_party/scons/scons-local/SCons/Script/SConscript.py index 87cc8cf..c52c979 100644 --- a/third_party/scons/scons-local/SCons/Script/SConscript.py +++ b/third_party/scons/scons-local/SCons/Script/SConscript.py @@ -28,7 +28,7 @@ files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/SConscript.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Script/SConscript.py 3842 2008/12/20 22:59:52 scons" import SCons import SCons.Action @@ -279,7 +279,20 @@ def _SConscript(fs, *files, **kw): fs.chdir(frame.prev_dir, change_os_dir=0) rdir = frame.prev_dir.rdir() rdir._create() # Make sure there's a directory there. - os.chdir(rdir.get_abspath()) + try: + os.chdir(rdir.get_abspath()) + except OSError, e: + # We still couldn't chdir there, so raise the error, + # but only if actions are being executed. + # + # If the -n option was used, the directory would *not* + # have been created and we should just carry on and + # let things muddle through. This isn't guaranteed + # to work if the SConscript files are reading things + # from disk (for example), but it should work well + # enough for most configurations. + if SCons.Action.execute_actions: + raise e results.append(frame.retval) diff --git a/third_party/scons/scons-local/SCons/Script/__init__.py b/third_party/scons/scons-local/SCons/Script/__init__.py index 76c4cd3..ad99991 100644 --- a/third_party/scons/scons-local/SCons/Script/__init__.py +++ b/third_party/scons/scons-local/SCons/Script/__init__.py @@ -34,7 +34,7 @@ it goes here. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Script/__init__.py 3842 2008/12/20 22:59:52 scons" import time start_time = time.time() diff --git a/third_party/scons/scons-local/SCons/Sig.py b/third_party/scons/scons-local/SCons/Sig.py index 62f9b07..2e50308 100644 --- a/third_party/scons/scons-local/SCons/Sig.py +++ b/third_party/scons/scons-local/SCons/Sig.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Sig.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Sig.py 3842 2008/12/20 22:59:52 scons" __doc__ = """Place-holder for the old SCons.Sig module hierarchy diff --git a/third_party/scons/scons-local/SCons/Subst.py b/third_party/scons/scons-local/SCons/Subst.py index df3942f..afebca4 100644 --- a/third_party/scons/scons-local/SCons/Subst.py +++ b/third_party/scons/scons-local/SCons/Subst.py @@ -27,7 +27,7 @@ SCons string substitution. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Subst.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Subst.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Taskmaster.py b/third_party/scons/scons-local/SCons/Taskmaster.py index e8810a8..354fcca 100644 --- a/third_party/scons/scons-local/SCons/Taskmaster.py +++ b/third_party/scons/scons-local/SCons/Taskmaster.py @@ -48,7 +48,7 @@ interface and the SCons build engine. There are two key classes here: target(s) that it decides need to be evaluated and/or built. """ -__revision__ = "src/engine/SCons/Taskmaster.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Taskmaster.py 3842 2008/12/20 22:59:52 scons" from itertools import chain import operator @@ -138,6 +138,10 @@ class Task: self.node = node self.exc_clear() + def trace_message(self, method, node, description='node'): + fmt = '%-20s %s %s\n' + return fmt % (method + ':', description, self.tm.trace_node(node)) + def display(self, message): """ Hook to allow the calling interface to display a message. @@ -159,6 +163,8 @@ class Task: unlink underlying files and make all necessary directories before the Action is actually called to build the targets. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.prepare()', self.node)) # Now that it's the appropriate time, give the TaskMaster a # chance to raise any exceptions it encountered while preparing @@ -209,6 +215,8 @@ class Task: so only do thread safe stuff here. Do thread unsafe stuff in prepare(), executed() or failed(). """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.execute()', self.node)) try: everything_was_cached = 1 @@ -225,9 +233,11 @@ class Task: raise except SCons.Errors.BuildError: raise - except: - raise SCons.Errors.TaskmasterException(self.targets[0], - sys.exc_info()) + except Exception, e: + buildError = SCons.Errors.convert_to_BuildError(e) + buildError.node = self.targets[0] + buildError.exc_info = sys.exc_info() + raise buildError def executed_without_callbacks(self): """ @@ -235,6 +245,10 @@ class Task: and the Taskmaster instance doesn't want to call the Node's callback methods. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.executed_without_callbacks()', + self.node)) + for t in self.targets: if t.get_state() == NODE_EXECUTING: for side_effect in t.side_effects: @@ -254,6 +268,10 @@ class Task: post-visit actions that must take place regardless of whether or not the target was an actual built target or a source Node. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.executed_with_callbacks()', + self.node)) + for t in self.targets: if t.get_state() == NODE_EXECUTING: for side_effect in t.side_effects: @@ -267,17 +285,30 @@ class Task: def failed(self): """ Default action when a task fails: stop the build. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). """ self.fail_stop() def fail_stop(self): """ Explicit stop-the-build failure. + + This sets failure status on the target nodes and all of + their dependent parent nodes. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). """ - + T = self.tm.trace + if T: T.write(self.trace_message('Task.failed_stop()', self.node)) + # Invoke will_not_build() to clean-up the pending children # list. - self.tm.will_not_build(self.targets) + self.tm.will_not_build(self.targets, lambda n: n.set_state(NODE_FAILED)) # Tell the taskmaster to not start any new tasks self.tm.stop() @@ -294,9 +325,16 @@ class Task: This sets failure status on the target nodes and all of their dependent parent nodes. + + Note: Although this function is normally invoked on nodes in + the executing state, it might also be invoked on up-to-date + nodes when using Configure(). """ - self.tm.will_not_build(self.targets) - + T = self.tm.trace + if T: T.write(self.trace_message('Task.failed_continue()', self.node)) + + self.tm.will_not_build(self.targets, lambda n: n.set_state(NODE_FAILED)) + def make_ready_all(self): """ Marks all targets in a task ready for execution. @@ -304,6 +342,9 @@ class Task: This is used when the interface needs every target Node to be visited--the canonical example being the "scons -c" option. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.make_ready_all()', self.node)) + self.out_of_date = self.targets[:] for t in self.targets: t.disambiguate().set_state(NODE_EXECUTING) @@ -317,6 +358,10 @@ class Task: This is the default behavior for building only what's necessary. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.make_ready_current()', + self.node)) + self.out_of_date = [] needs_executing = False for t in self.targets: @@ -336,7 +381,7 @@ class Task: t.set_state(NODE_EXECUTING) for s in t.side_effects: s.set_state(NODE_EXECUTING) - else: + else: for t in self.targets: # We must invoke visited() to ensure that the node # information has been computed before allowing the @@ -357,6 +402,8 @@ class Task: waiting parent Nodes, or Nodes waiting on a common side effect, that can be put back on the candidates list. """ + T = self.tm.trace + if T: T.write(self.trace_message('Task.postprocess()', self.node)) # We may have built multiple targets, some of which may have # common parents waiting for this build. Count up how many @@ -367,8 +414,16 @@ class Task: targets = set(self.targets) + pending_children = self.tm.pending_children parents = {} for t in targets: + # A node can only be in the pending_children set if it has + # some waiting_parents. + if t.waiting_parents: + if T: T.write(self.trace_message('Task.postprocess()', + t, + 'removing')) + pending_children.discard(t) for p in t.waiting_parents: parents[p] = parents.get(p, 0) + 1 @@ -381,13 +436,14 @@ class Task: for p in s.waiting_s_e: if p.ref_count == 0: self.tm.candidates.append(p) - self.tm.pending_children.discard(p) for p, subtract in parents.items(): p.ref_count = p.ref_count - subtract + if T: T.write(self.trace_message('Task.postprocess()', + p, + 'adjusted parent ref count')) if p.ref_count == 0: self.tm.candidates.append(p) - self.tm.pending_children.discard(p) for t in targets: t.postprocess() @@ -479,7 +535,6 @@ class Taskmaster: self.next_candidate = self.find_next_candidate self.pending_children = set() - def find_next_candidate(self): """ Returns the next candidate Node for (potential) evaluation. @@ -519,7 +574,7 @@ class Taskmaster: def no_next_candidate(self): """ Stops Taskmaster processing by not returning a next candidate. - + Note that we have to clean-up the Taskmaster candidate list because the cycle detection depends on the fact all nodes have been processed somehow. @@ -527,9 +582,96 @@ class Taskmaster: while self.candidates: candidates = self.candidates self.candidates = [] - self.will_not_build(candidates, lambda n: n.state < NODE_UP_TO_DATE) + self.will_not_build(candidates) return None + def _validate_pending_children(self): + """ + Validate the content of the pending_children set. Assert if an + internal error is found. + + This function is used strictly for debugging the taskmaster by + checking that no invariants are violated. It is not used in + normal operation. + + The pending_children set is used to detect cycles in the + dependency graph. We call a "pending child" a child that is + found in the "pending" state when checking the dependencies of + its parent node. + + A pending child can occur when the Taskmaster completes a loop + through a cycle. For example, lets imagine a graph made of + three node (A, B and C) making a cycle. The evaluation starts + at node A. The taskmaster first consider whether node A's + child B is up-to-date. Then, recursively, node B needs to + check whether node C is up-to-date. This leaves us with a + dependency graph looking like: + + Next candidate \ + \ + Node A (Pending) --> Node B(Pending) --> Node C (NoState) + ^ | + | | + +-------------------------------------+ + + Now, when the Taskmaster examines the Node C's child Node A, + it finds that Node A is in the "pending" state. Therefore, + Node A is a pending child of node C. + + Pending children indicate that the Taskmaster has potentially + loop back through a cycle. We say potentially because it could + also occur when a DAG is evaluated in parallel. For example, + consider the following graph: + + + Node A (Pending) --> Node B(Pending) --> Node C (Pending) --> ... + | ^ + | | + +----------> Node D (NoState) --------+ + / + Next candidate / + + The Taskmaster first evaluates the nodes A, B, and C and + starts building some children of node C. Assuming, that the + maximum parallel level has not been reached, the Taskmaster + will examine Node D. It will find that Node C is a pending + child of Node D. + + In summary, evaluating a graph with a cycle will always + involve a pending child at one point. A pending child might + indicate either a cycle or a diamond-shaped DAG. Only a + fraction of the nodes ends-up being a "pending child" of + another node. This keeps the pending_children set small in + practice. + + We can differentiate between the two cases if we wait until + the end of the build. At this point, all the pending children + nodes due to a diamond-shaped DAG will have been properly + built (or will have failed to build). But, the pending + children involved in a cycle will still be in the pending + state. + + The taskmaster removes nodes from the pending_children set as + soon as a pending_children node moves out of the pending + state. This also helps to keep the pending_children set small. + """ + + for n in self.pending_children: + assert n.state in (NODE_PENDING, NODE_EXECUTING), \ + (str(n), StateString[n.state]) + assert len(n.waiting_parents) != 0, (str(n), len(n.waiting_parents)) + for p in n.waiting_parents: + assert p.ref_count > 0, (str(n), str(p), p.ref_count) + + + def trace_message(self, message): + return 'Taskmaster: %s\n' % message + + def trace_node(self, node): + return '<%-10s %-3s %s>' % (StateString[node.get_state()], + node.ref_count, + repr(str(node))) + def _find_next_ready_node(self): """ Finds the next node that is ready to be built. @@ -555,17 +697,25 @@ class Taskmaster: self.ready_exc = None T = self.trace - if T: T.write('\nTaskmaster: Looking for a node to evaluate\n') + if T: T.write('\n' + self.trace_message('Looking for a node to evaluate')) while 1: node = self.next_candidate() if node is None: - if T: T.write('Taskmaster: No candidate anymore.\n\n') + if T: T.write(self.trace_message('No candidate anymore.') + '\n') return None node = node.disambiguate() state = node.get_state() + # For debugging only: + # + # try: + # self._validate_pending_children() + # except: + # self.ready_exc = sys.exc_info() + # return node + if CollectStats: if not hasattr(node, 'stats'): node.stats = Stats() @@ -575,8 +725,7 @@ class Taskmaster: else: S = None - if T: T.write('Taskmaster: Considering node <%-10s %-3s %s> and its children:\n' % - (StateString[node.get_state()], node.ref_count, repr(str(node)))) + if T: T.write(self.trace_message(' Considering node %s and its children:' % self.trace_node(node))) if state == NODE_NO_STATE: # Mark this node as being on the execution stack: @@ -584,7 +733,7 @@ class Taskmaster: elif state > NODE_PENDING: # Skip this node if it has already been evaluated: if S: S.already_handled = S.already_handled + 1 - if T: T.write('Taskmaster: already handled (executed)\n') + if T: T.write(self.trace_message(' already handled (executed)')) continue try: @@ -593,7 +742,7 @@ class Taskmaster: exc_value = sys.exc_info()[1] e = SCons.Errors.ExplicitExit(node, exc_value.code) self.ready_exc = (SCons.Errors.ExplicitExit, e) - if T: T.write('Taskmaster: SystemExit\n') + if T: T.write(self.trace_message(' SystemExit')) return node except Exception, e: # We had a problem just trying to figure out the @@ -602,7 +751,7 @@ class Taskmaster: # raise the exception when the Task is "executed." self.ready_exc = sys.exc_info() if S: S.problem = S.problem + 1 - if T: T.write('Taskmaster: exception %s while scanning children.\n'%s) + if T: T.write(self.trace_message(' exception %s while scanning children.\n' % e)) return node children_not_visited = [] @@ -613,8 +762,7 @@ class Taskmaster: for child in chain(children,node.prerequisites): childstate = child.get_state() - if T: T.write('Taskmaster: <%-10s %-3s %s>\n' % - (StateString[childstate], child.ref_count, repr(str(child)))) + if T: T.write(self.trace_message(' ' + self.trace_node(child))) if childstate == NODE_NO_STATE: children_not_visited.append(child) @@ -633,8 +781,8 @@ class Taskmaster: children_not_visited.reverse() self.candidates.extend(self.order(children_not_visited)) #if T and children_not_visited: - # T.write('Taskmaster: adding to candidates: %s\n' % map(str, children_not_visited)) - # T.write('Taskmaster: candidates now: %s\n' % map(str, self.candidates)) + # T.write(self.trace_message(' adding to candidates: %s' % map(str, children_not_visited))) + # T.write(self.trace_message(' candidates now: %s\n' % map(str, self.candidates))) # Skip this node if any of its children have failed. # @@ -658,8 +806,7 @@ class Taskmaster: node.set_state(NODE_FAILED) if S: S.child_failed = S.child_failed + 1 - if T: T.write('Taskmaster:****** <%-10s %-3s %s>\n' % - (StateString[node.get_state()], node.ref_count, repr(str(node)))) + if T: T.write(self.trace_message('****** %s\n' % self.trace_node(node))) continue if children_not_ready: @@ -673,11 +820,15 @@ class Taskmaster: # count so we can be put back on the list for # re-evaluation when they've all finished. node.ref_count = node.ref_count + child.add_to_waiting_parents(node) - if T: T.write('Taskmaster: adjusting ref count: <%-10s %-3s %s>\n' % - (StateString[node.get_state()], node.ref_count, repr(str(node)))) + if T: T.write(self.trace_message(' adjusted ref count: %s, child %s' % + (self.trace_node(node), repr(str(child))))) + if T: + for pc in children_pending: + T.write(self.trace_message(' adding %s to the pending children set\n' % + self.trace_node(pc))) self.pending_children = self.pending_children | children_pending - + continue # Skip this node if it has side-effects that are @@ -695,8 +846,17 @@ class Taskmaster: # The default when we've gotten through all of the checks above: # this node is ready to be built. if S: S.build = S.build + 1 - if T: T.write('Taskmaster: Evaluating <%-10s %-3s %s>\n' % - (StateString[node.get_state()], node.ref_count, repr(str(node)))) + if T: T.write(self.trace_message('Evaluating %s\n' % + self.trace_node(node))) + + # For debugging only: + # + # try: + # self._validate_pending_children() + # except: + # self.ready_exc = sys.exc_info() + # return node + return node return None @@ -732,23 +892,24 @@ class Taskmaster: return task - def will_not_build(self, nodes, mark_fail=lambda n: n.state != NODE_FAILED): + def will_not_build(self, nodes, node_func=lambda n: None): """ - Perform clean-up about nodes that will never be built. + Perform clean-up about nodes that will never be built. Invokes + a user defined function on all of these nodes (including all + of their parents). """ + T = self.trace + pending_children = self.pending_children - to_visit = set() - for node in nodes: - # Set failure state on all of the parents that were dependent - # on this failed build. - if mark_fail(node): - node.set_state(NODE_FAILED) - parents = node.waiting_parents - to_visit = to_visit | parents - pending_children = pending_children - parents + to_visit = set(nodes) + pending_children = pending_children - to_visit + if T: + for n in nodes: + T.write(self.trace_message(' removing node %s from the pending children set\n' % + self.trace_node(n))) try: while 1: try: @@ -760,11 +921,21 @@ class Taskmaster: to_visit.remove(node) else: break - if mark_fail(node): - node.set_state(NODE_FAILED) - parents = node.waiting_parents - to_visit = to_visit | parents - pending_children = pending_children - parents + + node_func(node) + + # Prune recursion by flushing the waiting children + # list immediately. + parents = node.waiting_parents + node.waiting_parents = set() + + to_visit = to_visit | parents + pending_children = pending_children - parents + + for p in parents: + p.ref_count = p.ref_count - 1 + if T: T.write(self.trace_message(' removing parent %s from the pending children set\n' % + self.trace_node(p))) except KeyError: # The container to_visit has been emptied. pass @@ -784,15 +955,31 @@ class Taskmaster: """ Check for dependency cycles. """ - if self.pending_children: - desc = 'Found dependency cycle(s):\n' - for node in self.pending_children: - cycle = find_cycle([node], set()) - if cycle: - desc = desc + " " + string.join(map(str, cycle), " -> ") + "\n" - else: - desc = desc + \ - " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ - (node, repr(node), StateString[node.get_state()]) - - raise SCons.Errors.UserError, desc + if not self.pending_children: + return + + # TODO(1.5) + #nclist = [ (n, find_cycle([n], set())) for n in self.pending_children ] + nclist = map(lambda n: (n, find_cycle([n], set())), self.pending_children) + + # TODO(1.5) + #genuine_cycles = [ + # node for node, cycle in nclist + # if cycle or node.get_state() != NODE_EXECUTED + #] + genuine_cycles = filter(lambda t: t[1] or t[0].get_state() != NODE_EXECUTED, nclist) + if not genuine_cycles: + # All of the "cycles" found were single nodes in EXECUTED state, + # which is to say, they really weren't cycles. Just return. + return + + desc = 'Found dependency cycle(s):\n' + for node, cycle in nclist: + if cycle: + desc = desc + " " + string.join(map(str, cycle), " -> ") + "\n" + else: + desc = desc + \ + " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ + (node, repr(node), StateString[node.get_state()]) + + raise SCons.Errors.UserError, desc diff --git a/third_party/scons/scons-local/SCons/Tool/386asm.py b/third_party/scons/scons-local/SCons/Tool/386asm.py index 850d909..fc5c500 100644 --- a/third_party/scons/scons-local/SCons/Tool/386asm.py +++ b/third_party/scons/scons-local/SCons/Tool/386asm.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/386asm.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/386asm.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.PharLapCommon import addPharLapPaths import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/BitKeeper.py b/third_party/scons/scons-local/SCons/Tool/BitKeeper.py index ce3a5da..15d1f0a 100644 --- a/third_party/scons/scons-local/SCons/Tool/BitKeeper.py +++ b/third_party/scons/scons-local/SCons/Tool/BitKeeper.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/BitKeeper.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/BitKeeper.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/CVS.py b/third_party/scons/scons-local/SCons/Tool/CVS.py index 76a696f..e1cc04d 100644 --- a/third_party/scons/scons-local/SCons/Tool/CVS.py +++ b/third_party/scons/scons-local/SCons/Tool/CVS.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/CVS.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/CVS.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/FortranCommon.py b/third_party/scons/scons-local/SCons/Tool/FortranCommon.py index 3773197..8d3204f 100644 --- a/third_party/scons/scons-local/SCons/Tool/FortranCommon.py +++ b/third_party/scons/scons-local/SCons/Tool/FortranCommon.py @@ -27,7 +27,7 @@ Stuff for processing Fortran, common to all fortran dialects. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/FortranCommon.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/FortranCommon.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Tool/JavaCommon.py b/third_party/scons/scons-local/SCons/Tool/JavaCommon.py index 495610f..12c31f3 100644 --- a/third_party/scons/scons-local/SCons/Tool/JavaCommon.py +++ b/third_party/scons/scons-local/SCons/Tool/JavaCommon.py @@ -27,7 +27,7 @@ Stuff for processing Java. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/JavaCommon.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/JavaCommon.py 3842 2008/12/20 22:59:52 scons" import os import os.path @@ -75,6 +75,7 @@ if java_parsing: self.stackBrackets = [] self.brackets = 0 self.nextAnon = 1 + self.localClasses = [] self.stackAnonClassBrackets = [] self.anonStacksStack = [[0]] self.package = None @@ -126,6 +127,7 @@ if java_parsing: if len(self.stackBrackets) and \ self.brackets == self.stackBrackets[-1]: self.listOutputs.append(string.join(self.listClasses, '$')) + self.localClasses.pop() self.listClasses.pop() self.anonStacksStack.pop() self.stackBrackets.pop() @@ -240,6 +242,20 @@ if java_parsing: # the next non-whitespace token should be the name of the class if token == '\n': return self + # If that's an inner class which is declared in a method, it + # requires an index prepended to the class-name, e.g. + # 'Foo$1Inner' (Tigris Issue 2087) + if self.outer_state.localClasses and \ + self.outer_state.stackBrackets[-1] > \ + self.outer_state.stackBrackets[-2]+1: + locals = self.outer_state.localClasses[-1] + try: + idx = locals[token] + locals[token] = locals[token]+1 + except KeyError: + locals[token] = 1 + token = str(locals[token]) + token + self.outer_state.localClasses.append({}) self.outer_state.listClasses.append(token) self.outer_state.anonStacksStack.append([0]) return self.outer_state diff --git a/third_party/scons/scons-local/SCons/Tool/Perforce.py b/third_party/scons/scons-local/SCons/Tool/Perforce.py index d93bbe0..97049f6 100644 --- a/third_party/scons/scons-local/SCons/Tool/Perforce.py +++ b/third_party/scons/scons-local/SCons/Tool/Perforce.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/Perforce.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/Perforce.py 3842 2008/12/20 22:59:52 scons" import os diff --git a/third_party/scons/scons-local/SCons/Tool/PharLapCommon.py b/third_party/scons/scons-local/SCons/Tool/PharLapCommon.py index 0ac3d14..76a566a 100644 --- a/third_party/scons/scons-local/SCons/Tool/PharLapCommon.py +++ b/third_party/scons/scons-local/SCons/Tool/PharLapCommon.py @@ -29,7 +29,7 @@ Phar Lap ETS tool chain. Right now, this is linkloc and # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/RCS.py b/third_party/scons/scons-local/SCons/Tool/RCS.py index 5872d0d..6d47060 100644 --- a/third_party/scons/scons-local/SCons/Tool/RCS.py +++ b/third_party/scons/scons-local/SCons/Tool/RCS.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/RCS.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/RCS.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/SCCS.py b/third_party/scons/scons-local/SCons/Tool/SCCS.py index 1a73c74..842db13 100644 --- a/third_party/scons/scons-local/SCons/Tool/SCCS.py +++ b/third_party/scons/scons-local/SCons/Tool/SCCS.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/SCCS.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/SCCS.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/Subversion.py b/third_party/scons/scons-local/SCons/Tool/Subversion.py index cd4bb09..a593c6a 100644 --- a/third_party/scons/scons-local/SCons/Tool/Subversion.py +++ b/third_party/scons/scons-local/SCons/Tool/Subversion.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/Subversion.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/Subversion.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/__init__.py b/third_party/scons/scons-local/SCons/Tool/__init__.py index 9baaccc..0b03282 100644 --- a/third_party/scons/scons-local/SCons/Tool/__init__.py +++ b/third_party/scons/scons-local/SCons/Tool/__init__.py @@ -36,7 +36,7 @@ tool definition. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/__init__.py 3842 2008/12/20 22:59:52 scons" import imp import sys @@ -142,7 +142,7 @@ class Tool: file.close() return module except ImportError, e: - if e!="No module named %s"%self.name: + if str(e)!="No module named %s"%self.name: raise SCons.Errors.EnvironmentError, e try: import zipimport diff --git a/third_party/scons/scons-local/SCons/Tool/aixc++.py b/third_party/scons/scons-local/SCons/Tool/aixc++.py index 1ccbc54..5db91f7 100644 --- a/third_party/scons/scons-local/SCons/Tool/aixc++.py +++ b/third_party/scons/scons-local/SCons/Tool/aixc++.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/aixc++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/aixc++.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/aixcc.py b/third_party/scons/scons-local/SCons/Tool/aixcc.py index f16700a..3c0b9d7 100644 --- a/third_party/scons/scons-local/SCons/Tool/aixcc.py +++ b/third_party/scons/scons-local/SCons/Tool/aixcc.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/aixcc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/aixcc.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/aixf77.py b/third_party/scons/scons-local/SCons/Tool/aixf77.py index d09e12c..794f7e2 100644 --- a/third_party/scons/scons-local/SCons/Tool/aixf77.py +++ b/third_party/scons/scons-local/SCons/Tool/aixf77.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/aixf77.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/aixf77.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/aixlink.py b/third_party/scons/scons-local/SCons/Tool/aixlink.py index 1c252e1d..3a1182a 100644 --- a/third_party/scons/scons-local/SCons/Tool/aixlink.py +++ b/third_party/scons/scons-local/SCons/Tool/aixlink.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/aixlink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/aixlink.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/applelink.py b/third_party/scons/scons-local/SCons/Tool/applelink.py index ee22a9a..eb8df8c 100644 --- a/third_party/scons/scons-local/SCons/Tool/applelink.py +++ b/third_party/scons/scons-local/SCons/Tool/applelink.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/applelink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/applelink.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/ar.py b/third_party/scons/scons-local/SCons/Tool/ar.py index 60af86e..7812fb3 100644 --- a/third_party/scons/scons-local/SCons/Tool/ar.py +++ b/third_party/scons/scons-local/SCons/Tool/ar.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ar.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/ar.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/as.py b/third_party/scons/scons-local/SCons/Tool/as.py index 120ba64..623c8d7 100644 --- a/third_party/scons/scons-local/SCons/Tool/as.py +++ b/third_party/scons/scons-local/SCons/Tool/as.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/as.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/as.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/bcc32.py b/third_party/scons/scons-local/SCons/Tool/bcc32.py index 996e580..0488ba7 100644 --- a/third_party/scons/scons-local/SCons/Tool/bcc32.py +++ b/third_party/scons/scons-local/SCons/Tool/bcc32.py @@ -27,7 +27,7 @@ XXX # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/bcc32.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/bcc32.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/c++.py b/third_party/scons/scons-local/SCons/Tool/c++.py index b529ea6..9798149 100644 --- a/third_party/scons/scons-local/SCons/Tool/c++.py +++ b/third_party/scons/scons-local/SCons/Tool/c++.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/c++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/c++.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/cc.py b/third_party/scons/scons-local/SCons/Tool/cc.py index 3966ee4..ef1249d 100644 --- a/third_party/scons/scons-local/SCons/Tool/cc.py +++ b/third_party/scons/scons-local/SCons/Tool/cc.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/cc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/cc.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool import SCons.Defaults diff --git a/third_party/scons/scons-local/SCons/Tool/cvf.py b/third_party/scons/scons-local/SCons/Tool/cvf.py index 4f479e3..203d9e4 100644 --- a/third_party/scons/scons-local/SCons/Tool/cvf.py +++ b/third_party/scons/scons-local/SCons/Tool/cvf.py @@ -27,7 +27,7 @@ Tool-specific initialization for the Compaq Visual Fortran compiler. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/cvf.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/cvf.py 3842 2008/12/20 22:59:52 scons" import fortran diff --git a/third_party/scons/scons-local/SCons/Tool/default.py b/third_party/scons/scons-local/SCons/Tool/default.py index 286f11e..a105f7f 100644 --- a/third_party/scons/scons-local/SCons/Tool/default.py +++ b/third_party/scons/scons-local/SCons/Tool/default.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/default.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/default.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/dmd.py b/third_party/scons/scons-local/SCons/Tool/dmd.py index a1260ab..88bff8a 100644 --- a/third_party/scons/scons-local/SCons/Tool/dmd.py +++ b/third_party/scons/scons-local/SCons/Tool/dmd.py @@ -54,7 +54,7 @@ Lib tool variables: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/dmd.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/dmd.py 3842 2008/12/20 22:59:52 scons" import os import string diff --git a/third_party/scons/scons-local/SCons/Tool/dvi.py b/third_party/scons/scons-local/SCons/Tool/dvi.py index 9613d52..af65671 100644 --- a/third_party/scons/scons-local/SCons/Tool/dvi.py +++ b/third_party/scons/scons-local/SCons/Tool/dvi.py @@ -27,7 +27,7 @@ Common DVI Builder definition for various other Tool modules that use it. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/dvi.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/dvi.py 3842 2008/12/20 22:59:52 scons" import SCons.Builder import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/dvipdf.py b/third_party/scons/scons-local/SCons/Tool/dvipdf.py index 5c5d35c..821d125 100644 --- a/third_party/scons/scons-local/SCons/Tool/dvipdf.py +++ b/third_party/scons/scons-local/SCons/Tool/dvipdf.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/dvipdf.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/dvipdf.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Defaults @@ -39,7 +39,7 @@ import SCons.Tool.pdf import SCons.Tool.tex import SCons.Util -_null = SCons.Tool.tex._Null +_null = SCons.Scanner.LaTeX._null def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None): """A builder for DVI files that sets the TEXPICTS environment @@ -50,18 +50,17 @@ def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None): except AttributeError : abspath = '' - saved_env = {} - saved_env['TEXPICTS'] = SCons.Tool.tex.modify_env_var(env, 'TEXPICTS', abspath) + saved_env = SCons.Scanner.LaTeX.modify_env_var(env, 'TEXPICTS', abspath) result = XXXDviAction(target, source, env) - if saved_env['TEXPICTS'] is _null: + if saved_env is _null: try: del env['ENV']['TEXPICTS'] except KeyError: pass # was never set else: - env['ENV']['TEXPICTS'] = saved_env['TEXPICTS'] + env['ENV']['TEXPICTS'] = saved_env return result diff --git a/third_party/scons/scons-local/SCons/Tool/dvips.py b/third_party/scons/scons-local/SCons/Tool/dvips.py index 74820ab..db763f1 100644 --- a/third_party/scons/scons-local/SCons/Tool/dvips.py +++ b/third_party/scons/scons-local/SCons/Tool/dvips.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/dvips.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/dvips.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder @@ -71,7 +71,8 @@ def generate(env): prefix = '$PSPREFIX', suffix = '$PSSUFFIX', src_suffix = '.dvi', - src_builder = 'DVI') + src_builder = 'DVI', + single_source=True) env['BUILDERS']['PostScript'] = PSBuilder diff --git a/third_party/scons/scons-local/SCons/Tool/f77.py b/third_party/scons/scons-local/SCons/Tool/f77.py index 6fe0c3e..21ab6d8 100644 --- a/third_party/scons/scons-local/SCons/Tool/f77.py +++ b/third_party/scons/scons-local/SCons/Tool/f77.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/f77.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/f77.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Scanner.Fortran diff --git a/third_party/scons/scons-local/SCons/Tool/f90.py b/third_party/scons/scons-local/SCons/Tool/f90.py index c7f54b3..1078d2c 100644 --- a/third_party/scons/scons-local/SCons/Tool/f90.py +++ b/third_party/scons/scons-local/SCons/Tool/f90.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/f90.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/f90.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Scanner.Fortran diff --git a/third_party/scons/scons-local/SCons/Tool/f95.py b/third_party/scons/scons-local/SCons/Tool/f95.py index b562b7e..012930c 100644 --- a/third_party/scons/scons-local/SCons/Tool/f95.py +++ b/third_party/scons/scons-local/SCons/Tool/f95.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/f95.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/f95.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/filesystem.py b/third_party/scons/scons-local/SCons/Tool/filesystem.py index 2e921b3..dbab562 100644 --- a/third_party/scons/scons-local/SCons/Tool/filesystem.py +++ b/third_party/scons/scons-local/SCons/Tool/filesystem.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/filesystem.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/filesystem.py 3842 2008/12/20 22:59:52 scons" import SCons from SCons.Tool.install import copyFunc diff --git a/third_party/scons/scons-local/SCons/Tool/fortran.py b/third_party/scons/scons-local/SCons/Tool/fortran.py index ef6be0a..aa53cf6 100644 --- a/third_party/scons/scons-local/SCons/Tool/fortran.py +++ b/third_party/scons/scons-local/SCons/Tool/fortran.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/fortran.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/fortran.py 3842 2008/12/20 22:59:52 scons" import re import string diff --git a/third_party/scons/scons-local/SCons/Tool/g++.py b/third_party/scons/scons-local/SCons/Tool/g++.py index 47c8477..feb3951 100644 --- a/third_party/scons/scons-local/SCons/Tool/g++.py +++ b/third_party/scons/scons-local/SCons/Tool/g++.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/g++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/g++.py 3842 2008/12/20 22:59:52 scons" import os.path import re @@ -65,7 +65,8 @@ def generate(env): if env['CXX']: #pipe = SCons.Action._subproc(env, [env['CXX'], '-dumpversion'], pipe = SCons.Action._subproc(env, [env['CXX'], '--version'], - stderr = subprocess.PIPE, + stdin = 'devnull', + stderr = 'devnull', stdout = subprocess.PIPE) if pipe.wait() != 0: return # -dumpversion was added in GCC 3.0. As long as we're supporting diff --git a/third_party/scons/scons-local/SCons/Tool/g77.py b/third_party/scons/scons-local/SCons/Tool/g77.py index 8c1d245..effc9fc 100644 --- a/third_party/scons/scons-local/SCons/Tool/g77.py +++ b/third_party/scons/scons-local/SCons/Tool/g77.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/g77.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/g77.py 3842 2008/12/20 22:59:52 scons" import SCons.Util from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env diff --git a/third_party/scons/scons-local/SCons/Tool/gas.py b/third_party/scons/scons-local/SCons/Tool/gas.py index 0545e19..5595e9e 100644 --- a/third_party/scons/scons-local/SCons/Tool/gas.py +++ b/third_party/scons/scons-local/SCons/Tool/gas.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gas.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/gas.py 3842 2008/12/20 22:59:52 scons" as_module = __import__('as', globals(), locals(), []) diff --git a/third_party/scons/scons-local/SCons/Tool/gcc.py b/third_party/scons/scons-local/SCons/Tool/gcc.py index 3ec277f..db07575 100644 --- a/third_party/scons/scons-local/SCons/Tool/gcc.py +++ b/third_party/scons/scons-local/SCons/Tool/gcc.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gcc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/gcc.py 3842 2008/12/20 22:59:52 scons" import cc import os @@ -55,7 +55,8 @@ def generate(env): if env['CC']: #pipe = SCons.Action._subproc(env, [env['CC'], '-dumpversion'], pipe = SCons.Action._subproc(env, [env['CC'], '--version'], - stderr = subprocess.PIPE, + stdin = 'devnull', + stderr = 'devnull', stdout = subprocess.PIPE) if pipe.wait() != 0: return # -dumpversion was added in GCC 3.0. As long as we're supporting diff --git a/third_party/scons/scons-local/SCons/Tool/gfortran.py b/third_party/scons/scons-local/SCons/Tool/gfortran.py index b9f5bc74..7da19e4 100644 --- a/third_party/scons/scons-local/SCons/Tool/gfortran.py +++ b/third_party/scons/scons-local/SCons/Tool/gfortran.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gfortran.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/gfortran.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/gnulink.py b/third_party/scons/scons-local/SCons/Tool/gnulink.py index eb3c6bd..de95ee1 100644 --- a/third_party/scons/scons-local/SCons/Tool/gnulink.py +++ b/third_party/scons/scons-local/SCons/Tool/gnulink.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gnulink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/gnulink.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/gs.py b/third_party/scons/scons-local/SCons/Tool/gs.py index 24f985f..c52440a 100644 --- a/third_party/scons/scons-local/SCons/Tool/gs.py +++ b/third_party/scons/scons-local/SCons/Tool/gs.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gs.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/gs.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Platform diff --git a/third_party/scons/scons-local/SCons/Tool/hpc++.py b/third_party/scons/scons-local/SCons/Tool/hpc++.py index 7ec3b58..299c701 100644 --- a/third_party/scons/scons-local/SCons/Tool/hpc++.py +++ b/third_party/scons/scons-local/SCons/Tool/hpc++.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/hpc++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/hpc++.py 3842 2008/12/20 22:59:52 scons" import os.path import string diff --git a/third_party/scons/scons-local/SCons/Tool/hpcc.py b/third_party/scons/scons-local/SCons/Tool/hpcc.py index 8a5364f..a4da956 100644 --- a/third_party/scons/scons-local/SCons/Tool/hpcc.py +++ b/third_party/scons/scons-local/SCons/Tool/hpcc.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/hpcc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/hpcc.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/hplink.py b/third_party/scons/scons-local/SCons/Tool/hplink.py index 84317e0..0eb5b0a 100644 --- a/third_party/scons/scons-local/SCons/Tool/hplink.py +++ b/third_party/scons/scons-local/SCons/Tool/hplink.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/hplink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/hplink.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/icc.py b/third_party/scons/scons-local/SCons/Tool/icc.py index bfebd7a..ac6d6aa 100644 --- a/third_party/scons/scons-local/SCons/Tool/icc.py +++ b/third_party/scons/scons-local/SCons/Tool/icc.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/icc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/icc.py 3842 2008/12/20 22:59:52 scons" import cc diff --git a/third_party/scons/scons-local/SCons/Tool/icl.py b/third_party/scons/scons-local/SCons/Tool/icl.py index df3c182..322de79 100644 --- a/third_party/scons/scons-local/SCons/Tool/icl.py +++ b/third_party/scons/scons-local/SCons/Tool/icl.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/icl.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/icl.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool.intelc diff --git a/third_party/scons/scons-local/SCons/Tool/ifl.py b/third_party/scons/scons-local/SCons/Tool/ifl.py index 56f1dc2..bfb157e 100644 --- a/third_party/scons/scons-local/SCons/Tool/ifl.py +++ b/third_party/scons/scons-local/SCons/Tool/ifl.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ifl.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/ifl.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults from SCons.Scanner.Fortran import FortranScan diff --git a/third_party/scons/scons-local/SCons/Tool/ifort.py b/third_party/scons/scons-local/SCons/Tool/ifort.py index 2268b9a..17b7bf7 100644 --- a/third_party/scons/scons-local/SCons/Tool/ifort.py +++ b/third_party/scons/scons-local/SCons/Tool/ifort.py @@ -1,7 +1,7 @@ """SCons.Tool.ifort Tool-specific initialization for newer versions of the Intel Fortran Compiler -for Linux. +for Linux/Windows (and possibly Mac OS X). There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ifort.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/ifort.py 3842 2008/12/20 22:59:52 scons" import string @@ -47,7 +47,7 @@ def generate(env): fscan = FortranScan("FORTRANPATH") SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan) - + if not env.has_key('FORTRANFILESUFFIXES'): env['FORTRANFILESUFFIXES'] = ['.i'] else: @@ -75,6 +75,9 @@ def generate(env): for var in ['%sCOM' % dialect, '%sPPCOM' % dialect, 'SH%sCOM' % dialect, 'SH%sPPCOM' % dialect]: env[var] = string.replace(env[var], '-o $TARGET', '-object:$TARGET') + env['FORTRANMODDIRPREFIX'] = "/module:" + else: + env['FORTRANMODDIRPREFIX'] = "-module " def exists(env): return env.Detect('ifort') diff --git a/third_party/scons/scons-local/SCons/Tool/ilink.py b/third_party/scons/scons-local/SCons/Tool/ilink.py index b01b52e..b443a6b 100644 --- a/third_party/scons/scons-local/SCons/Tool/ilink.py +++ b/third_party/scons/scons-local/SCons/Tool/ilink.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ilink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/ilink.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/ilink32.py b/third_party/scons/scons-local/SCons/Tool/ilink32.py index 9b514ca..f357bec 100644 --- a/third_party/scons/scons-local/SCons/Tool/ilink32.py +++ b/third_party/scons/scons-local/SCons/Tool/ilink32.py @@ -27,7 +27,7 @@ XXX # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/ilink32.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/ilink32.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool import SCons.Tool.bcc32 diff --git a/third_party/scons/scons-local/SCons/Tool/install.py b/third_party/scons/scons-local/SCons/Tool/install.py index f9dd046..be36be0 100644 --- a/third_party/scons/scons-local/SCons/Tool/install.py +++ b/third_party/scons/scons-local/SCons/Tool/install.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/install.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/install.py 3842 2008/12/20 22:59:52 scons" import os import shutil diff --git a/third_party/scons/scons-local/SCons/Tool/intelc.py b/third_party/scons/scons-local/SCons/Tool/intelc.py index 18255f7..dfdedc4 100644 --- a/third_party/scons/scons-local/SCons/Tool/intelc.py +++ b/third_party/scons/scons-local/SCons/Tool/intelc.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/intelc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/intelc.py 3842 2008/12/20 22:59:52 scons" import math, sys, os.path, glob, string, re diff --git a/third_party/scons/scons-local/SCons/Tool/jar.py b/third_party/scons/scons-local/SCons/Tool/jar.py index b5dbe83..be50b01 100644 --- a/third_party/scons/scons-local/SCons/Tool/jar.py +++ b/third_party/scons/scons-local/SCons/Tool/jar.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/jar.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/jar.py 3842 2008/12/20 22:59:52 scons" import SCons.Subst import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/javac.py b/third_party/scons/scons-local/SCons/Tool/javac.py index 088bcd7..b8cabe8 100644 --- a/third_party/scons/scons-local/SCons/Tool/javac.py +++ b/third_party/scons/scons-local/SCons/Tool/javac.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/javac.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/javac.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/javah.py b/third_party/scons/scons-local/SCons/Tool/javah.py index d5c889f..3a39aeb 100644 --- a/third_party/scons/scons-local/SCons/Tool/javah.py +++ b/third_party/scons/scons-local/SCons/Tool/javah.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/javah.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/javah.py 3842 2008/12/20 22:59:52 scons" import os.path import string diff --git a/third_party/scons/scons-local/SCons/Tool/latex.py b/third_party/scons/scons-local/SCons/Tool/latex.py index 2e11e13..549f6d3 100644 --- a/third_party/scons/scons-local/SCons/Tool/latex.py +++ b/third_party/scons/scons-local/SCons/Tool/latex.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/latex.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/latex.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Defaults @@ -64,8 +64,8 @@ def generate(env): bld = env['BUILDERS']['DVI'] bld.add_action('.ltx', LaTeXAuxAction) bld.add_action('.latex', LaTeXAuxAction) - bld.add_emitter('.ltx', SCons.Tool.tex.tex_emitter) - bld.add_emitter('.latex', SCons.Tool.tex.tex_emitter) + bld.add_emitter('.ltx', SCons.Tool.tex.tex_eps_emitter) + bld.add_emitter('.latex', SCons.Tool.tex.tex_eps_emitter) env['LATEX'] = 'latex' env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') diff --git a/third_party/scons/scons-local/SCons/Tool/lex.py b/third_party/scons/scons-local/SCons/Tool/lex.py index e854eac..f2e0e85 100644 --- a/third_party/scons/scons-local/SCons/Tool/lex.py +++ b/third_party/scons/scons-local/SCons/Tool/lex.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/lex.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/lex.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/link.py b/third_party/scons/scons-local/SCons/Tool/link.py index 636acbc..d02bb25 100644 --- a/third_party/scons/scons-local/SCons/Tool/link.py +++ b/third_party/scons/scons-local/SCons/Tool/link.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/link.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/link.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/linkloc.py b/third_party/scons/scons-local/SCons/Tool/linkloc.py index 9a055e9..b0550c6 100644 --- a/third_party/scons/scons-local/SCons/Tool/linkloc.py +++ b/third_party/scons/scons-local/SCons/Tool/linkloc.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/linkloc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/linkloc.py 3842 2008/12/20 22:59:52 scons" import os.path import re diff --git a/third_party/scons/scons-local/SCons/Tool/m4.py b/third_party/scons/scons-local/SCons/Tool/m4.py index 0c06d22..0d81d71 100644 --- a/third_party/scons/scons-local/SCons/Tool/m4.py +++ b/third_party/scons/scons-local/SCons/Tool/m4.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/m4.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/m4.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/masm.py b/third_party/scons/scons-local/SCons/Tool/masm.py index 814316ab..8508900 100644 --- a/third_party/scons/scons-local/SCons/Tool/masm.py +++ b/third_party/scons/scons-local/SCons/Tool/masm.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/masm.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/masm.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/midl.py b/third_party/scons/scons-local/SCons/Tool/midl.py index 7414326..df1bf9a 100644 --- a/third_party/scons/scons-local/SCons/Tool/midl.py +++ b/third_party/scons/scons-local/SCons/Tool/midl.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/midl.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/midl.py 3842 2008/12/20 22:59:52 scons" import string diff --git a/third_party/scons/scons-local/SCons/Tool/mingw.py b/third_party/scons/scons-local/SCons/Tool/mingw.py index f9cd9d8..faec2e9 100644 --- a/third_party/scons/scons-local/SCons/Tool/mingw.py +++ b/third_party/scons/scons-local/SCons/Tool/mingw.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mingw.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/mingw.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/mslib.py b/third_party/scons/scons-local/SCons/Tool/mslib.py index 88bca89..340f992 100644 --- a/third_party/scons/scons-local/SCons/Tool/mslib.py +++ b/third_party/scons/scons-local/SCons/Tool/mslib.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mslib.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/mslib.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/mslink.py b/third_party/scons/scons-local/SCons/Tool/mslink.py index f4fecbf..298ae7c 100644 --- a/third_party/scons/scons-local/SCons/Tool/mslink.py +++ b/third_party/scons/scons-local/SCons/Tool/mslink.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mslink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/mslink.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/msvc.py b/third_party/scons/scons-local/SCons/Tool/msvc.py index e253528..5b7874a 100644 --- a/third_party/scons/scons-local/SCons/Tool/msvc.py +++ b/third_party/scons/scons-local/SCons/Tool/msvc.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/msvc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/msvc.py 3842 2008/12/20 22:59:52 scons" import os.path import re diff --git a/third_party/scons/scons-local/SCons/Tool/msvs.py b/third_party/scons/scons-local/SCons/Tool/msvs.py index 6550c9d..f8a20ea 100644 --- a/third_party/scons/scons-local/SCons/Tool/msvs.py +++ b/third_party/scons/scons-local/SCons/Tool/msvs.py @@ -31,10 +31,10 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/msvs.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/msvs.py 3842 2008/12/20 22:59:52 scons" import base64 -import md5 +import hashlib import os.path import pickle import re @@ -79,9 +79,11 @@ def _generateGUID(slnfile, name): based on the MD5 signatures of the sln filename plus the name of the project. It basically just needs to be unique, and not change with each invocation.""" + m = hashlib.md5() + m.update(str(slnfile) + str(name)) # TODO(1.5) - #solution = _hexdigest(md5.new(str(slnfile)+str(name)).digest()).upper() - solution = string.upper(_hexdigest(md5.new(str(slnfile)+str(name)).digest())) + #solution = m.hexdigest().upper() + solution = string.upper(_hexdigest(m.digest())) # convert most of the signature to GUID form (discard the rest) solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}" return solution diff --git a/third_party/scons/scons-local/SCons/Tool/mwcc.py b/third_party/scons/scons-local/SCons/Tool/mwcc.py index 066ca73..4a6eaaa 100644 --- a/third_party/scons/scons-local/SCons/Tool/mwcc.py +++ b/third_party/scons/scons-local/SCons/Tool/mwcc.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mwcc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/mwcc.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/mwld.py b/third_party/scons/scons-local/SCons/Tool/mwld.py index 95db28c..890b6d0 100644 --- a/third_party/scons/scons-local/SCons/Tool/mwld.py +++ b/third_party/scons/scons-local/SCons/Tool/mwld.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mwld.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/mwld.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/nasm.py b/third_party/scons/scons-local/SCons/Tool/nasm.py index c6d5818..db5c107 100644 --- a/third_party/scons/scons-local/SCons/Tool/nasm.py +++ b/third_party/scons/scons-local/SCons/Tool/nasm.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/nasm.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/nasm.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/__init__.py b/third_party/scons/scons-local/SCons/Tool/packaging/__init__.py index 1014888..f5e313c 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/__init__.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/__init__.py @@ -26,7 +26,7 @@ SCons Packaging Tool. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/__init__.py 3842 2008/12/20 22:59:52 scons" import SCons.Environment from SCons.Variables import * diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/ipk.py b/third_party/scons/scons-local/SCons/Tool/packaging/ipk.py index cf468fe..0a9c6b9 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/ipk.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/ipk.py @@ -24,7 +24,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 3842 2008/12/20 22:59:52 scons" import SCons.Builder import SCons.Node.FS diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/msi.py b/third_party/scons/scons-local/SCons/Tool/packaging/msi.py index 24efad1..4929f81 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/msi.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/msi.py @@ -26,7 +26,7 @@ The msi packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/msi.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/msi.py 3842 2008/12/20 22:59:52 scons" import os import SCons diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/rpm.py b/third_party/scons/scons-local/SCons/Tool/packaging/rpm.py index 617011d..9841559 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/rpm.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/rpm.py @@ -26,7 +26,7 @@ The rpm packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/rpm.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/rpm.py 3842 2008/12/20 22:59:52 scons" import os import string diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/src_tarbz2.py b/third_party/scons/scons-local/SCons/Tool/packaging/src_tarbz2.py index ac7f15f..7dafa31 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/src_tarbz2.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/src_tarbz2.py @@ -26,7 +26,7 @@ The tarbz2 SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/src_targz.py b/third_party/scons/scons-local/SCons/Tool/packaging/src_targz.py index 365e67f..b60ceee 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/src_targz.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/src_targz.py @@ -26,7 +26,7 @@ The targz SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/src_zip.py b/third_party/scons/scons-local/SCons/Tool/packaging/src_zip.py index 53971ce..d76f24d 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/src_zip.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/src_zip.py @@ -26,7 +26,7 @@ The zip SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/tarbz2.py b/third_party/scons/scons-local/SCons/Tool/packaging/tarbz2.py index c54e5ae..69e9737 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/tarbz2.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/tarbz2.py @@ -26,7 +26,7 @@ The tarbz2 SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/targz.py b/third_party/scons/scons-local/SCons/Tool/packaging/targz.py index db1684c..37a8bfe 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/targz.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/targz.py @@ -26,7 +26,7 @@ The targz SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/targz.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/targz.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/packaging/zip.py b/third_party/scons/scons-local/SCons/Tool/packaging/zip.py index 6387cb1..3cd4dd8 100644 --- a/third_party/scons/scons-local/SCons/Tool/packaging/zip.py +++ b/third_party/scons/scons-local/SCons/Tool/packaging/zip.py @@ -26,7 +26,7 @@ The zip SRC packager. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/packaging/zip.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/packaging/zip.py 3842 2008/12/20 22:59:52 scons" from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot diff --git a/third_party/scons/scons-local/SCons/Tool/pdf.py b/third_party/scons/scons-local/SCons/Tool/pdf.py index 4a459f0..bf6a83e 100644 --- a/third_party/scons/scons-local/SCons/Tool/pdf.py +++ b/third_party/scons/scons-local/SCons/Tool/pdf.py @@ -1,6 +1,7 @@ """SCons.Tool.pdf Common PDF Builder definition for various other Tool modules that use it. +Add an explicit action to run epstopdf to convert .eps files to .pdf """ @@ -27,13 +28,15 @@ Common PDF Builder definition for various other Tool modules that use it. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/pdf.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/pdf.py 3842 2008/12/20 22:59:52 scons" import SCons.Builder import SCons.Tool PDFBuilder = None +EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR') + def generate(env): try: env['BUILDERS']['PDF'] @@ -45,12 +48,24 @@ def generate(env): prefix = '$PDFPREFIX', suffix = '$PDFSUFFIX', emitter = {}, - source_ext_match = None) + source_ext_match = None, + single_source=True) env['BUILDERS']['PDF'] = PDFBuilder env['PDFPREFIX'] = '' env['PDFSUFFIX'] = '.pdf' +# put the epstopdf builder in this routine so we can add it after +# the pdftex builder so that one is the default for no source suffix +def generate2(env): + bld = env['BUILDERS']['PDF'] + #bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py + bld.add_action('.eps', EpsPdfAction) + + env['EPSTOPDF'] = 'epstopdf' + env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('') + env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} -o ${TARGET}' + def exists(env): # This only puts a skeleton Builder in place, so if someone # references this Tool directly, it's always "available." diff --git a/third_party/scons/scons-local/SCons/Tool/pdflatex.py b/third_party/scons/scons-local/SCons/Tool/pdflatex.py index 1c296ae..5ffb9cb 100644 --- a/third_party/scons/scons-local/SCons/Tool/pdflatex.py +++ b/third_party/scons/scons-local/SCons/Tool/pdflatex.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/pdflatex.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/pdflatex.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Util @@ -63,8 +63,8 @@ def generate(env): bld = env['BUILDERS']['PDF'] bld.add_action('.ltx', PDFLaTeXAuxAction) bld.add_action('.latex', PDFLaTeXAuxAction) - bld.add_emitter('.ltx', SCons.Tool.tex.tex_emitter) - bld.add_emitter('.latex', SCons.Tool.tex.tex_emitter) + bld.add_emitter('.ltx', SCons.Tool.tex.tex_pdf_emitter) + bld.add_emitter('.latex', SCons.Tool.tex.tex_pdf_emitter) env['PDFLATEX'] = 'pdflatex' env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') diff --git a/third_party/scons/scons-local/SCons/Tool/pdftex.py b/third_party/scons/scons-local/SCons/Tool/pdftex.py index 7196a91..2a5bfcc 100644 --- a/third_party/scons/scons-local/SCons/Tool/pdftex.py +++ b/third_party/scons/scons-local/SCons/Tool/pdftex.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/pdftex.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/pdftex.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Util @@ -79,7 +79,11 @@ def generate(env): bld = env['BUILDERS']['PDF'] bld.add_action('.tex', PDFTeXLaTeXAction) - bld.add_emitter('.tex', SCons.Tool.tex.tex_emitter) + bld.add_emitter('.tex', SCons.Tool.tex.tex_pdf_emitter) + + # Add the epstopdf builder after the pdftex builder + # so pdftex is the default for no source suffix + pdf.generate2(env) env['PDFTEX'] = 'pdftex' env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') diff --git a/third_party/scons/scons-local/SCons/Tool/qt.py b/third_party/scons/scons-local/SCons/Tool/qt.py index 3b88439..c4e5ca7 100644 --- a/third_party/scons/scons-local/SCons/Tool/qt.py +++ b/third_party/scons/scons-local/SCons/Tool/qt.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/qt.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/qt.py 3842 2008/12/20 22:59:52 scons" import os.path import re diff --git a/third_party/scons/scons-local/SCons/Tool/rmic.py b/third_party/scons/scons-local/SCons/Tool/rmic.py index 3282b0d..03a228c 100644 --- a/third_party/scons/scons-local/SCons/Tool/rmic.py +++ b/third_party/scons/scons-local/SCons/Tool/rmic.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/rmic.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/rmic.py 3842 2008/12/20 22:59:52 scons" import os.path import string diff --git a/third_party/scons/scons-local/SCons/Tool/rpcgen.py b/third_party/scons/scons-local/SCons/Tool/rpcgen.py index f2793b5..a70a6d1 100644 --- a/third_party/scons/scons-local/SCons/Tool/rpcgen.py +++ b/third_party/scons/scons-local/SCons/Tool/rpcgen.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/rpcgen.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/rpcgen.py 3842 2008/12/20 22:59:52 scons" from SCons.Builder import Builder import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/rpm.py b/third_party/scons/scons-local/SCons/Tool/rpm.py index 6760641..6aadc94 100644 --- a/third_party/scons/scons-local/SCons/Tool/rpm.py +++ b/third_party/scons/scons-local/SCons/Tool/rpm.py @@ -33,12 +33,12 @@ tar.gz consisting of the source file and a specfile. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/rpm.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/rpm.py 3842 2008/12/20 22:59:52 scons" import os import re import shutil -import popen2 +import subprocess import SCons.Builder import SCons.Node.FS @@ -67,11 +67,12 @@ def build_rpm(target, source, env): env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir ) # now call rpmbuild to create the rpm package. - handle = popen2.Popen3( get_cmd(source, env), capturestderr=1 ) - output = handle.fromchild.read() - #output += handle.childerr.read() - output = output + handle.childerr.read() - status = handle.wait() + handle = subprocess.Popen(get_cmd(source, env), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=True) + output = handle.stdout.read() + status = handle.wait() if status: raise SCons.Errors.BuildError( node=target[0], diff --git a/third_party/scons/scons-local/SCons/Tool/sgiar.py b/third_party/scons/scons-local/SCons/Tool/sgiar.py index b747dab..0be6780 100644 --- a/third_party/scons/scons-local/SCons/Tool/sgiar.py +++ b/third_party/scons/scons-local/SCons/Tool/sgiar.py @@ -33,7 +33,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sgiar.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sgiar.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/sgic++.py b/third_party/scons/scons-local/SCons/Tool/sgic++.py index 053ad37..da0efb6 100644 --- a/third_party/scons/scons-local/SCons/Tool/sgic++.py +++ b/third_party/scons/scons-local/SCons/Tool/sgic++.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sgic++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sgic++.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sgicc.py b/third_party/scons/scons-local/SCons/Tool/sgicc.py index 79c6604..5711569 100644 --- a/third_party/scons/scons-local/SCons/Tool/sgicc.py +++ b/third_party/scons/scons-local/SCons/Tool/sgicc.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sgicc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sgicc.py 3842 2008/12/20 22:59:52 scons" import cc diff --git a/third_party/scons/scons-local/SCons/Tool/sgilink.py b/third_party/scons/scons-local/SCons/Tool/sgilink.py index b978418..0036e26 100644 --- a/third_party/scons/scons-local/SCons/Tool/sgilink.py +++ b/third_party/scons/scons-local/SCons/Tool/sgilink.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sgilink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sgilink.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sunar.py b/third_party/scons/scons-local/SCons/Tool/sunar.py index 968d103..90dd156 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunar.py +++ b/third_party/scons/scons-local/SCons/Tool/sunar.py @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunar.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunar.py 3842 2008/12/20 22:59:52 scons" import SCons.Defaults import SCons.Tool diff --git a/third_party/scons/scons-local/SCons/Tool/sunc++.py b/third_party/scons/scons-local/SCons/Tool/sunc++.py index c0267f9..91c0efb 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunc++.py +++ b/third_party/scons/scons-local/SCons/Tool/sunc++.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunc++.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunc++.py 3842 2008/12/20 22:59:52 scons" import SCons diff --git a/third_party/scons/scons-local/SCons/Tool/suncc.py b/third_party/scons/scons-local/SCons/Tool/suncc.py index 13c2a1e..be16238 100644 --- a/third_party/scons/scons-local/SCons/Tool/suncc.py +++ b/third_party/scons/scons-local/SCons/Tool/suncc.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/suncc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/suncc.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sunf77.py b/third_party/scons/scons-local/SCons/Tool/sunf77.py index e7f4187..f8be781 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunf77.py +++ b/third_party/scons/scons-local/SCons/Tool/sunf77.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunf77.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunf77.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sunf90.py b/third_party/scons/scons-local/SCons/Tool/sunf90.py index ec6f69f..152e22d 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunf90.py +++ b/third_party/scons/scons-local/SCons/Tool/sunf90.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunf90.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunf90.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sunf95.py b/third_party/scons/scons-local/SCons/Tool/sunf95.py index 6f924ae..74ea2da 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunf95.py +++ b/third_party/scons/scons-local/SCons/Tool/sunf95.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunf95.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunf95.py 3842 2008/12/20 22:59:52 scons" import SCons.Util diff --git a/third_party/scons/scons-local/SCons/Tool/sunlink.py b/third_party/scons/scons-local/SCons/Tool/sunlink.py index aad8bc3..7efa96f 100644 --- a/third_party/scons/scons-local/SCons/Tool/sunlink.py +++ b/third_party/scons/scons-local/SCons/Tool/sunlink.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/sunlink.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/sunlink.py 3842 2008/12/20 22:59:52 scons" import os import os.path diff --git a/third_party/scons/scons-local/SCons/Tool/swig.py b/third_party/scons/scons-local/SCons/Tool/swig.py index 702fea4..000b80e 100644 --- a/third_party/scons/scons-local/SCons/Tool/swig.py +++ b/third_party/scons/scons-local/SCons/Tool/swig.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/swig.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/swig.py 3842 2008/12/20 22:59:52 scons" import os.path import re diff --git a/third_party/scons/scons-local/SCons/Tool/tar.py b/third_party/scons/scons-local/SCons/Tool/tar.py index 9c38410..7d527ee 100644 --- a/third_party/scons/scons-local/SCons/Tool/tar.py +++ b/third_party/scons/scons-local/SCons/Tool/tar.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/tar.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/tar.py 3842 2008/12/20 22:59:52 scons" import SCons.Action import SCons.Builder diff --git a/third_party/scons/scons-local/SCons/Tool/tex.py b/third_party/scons/scons-local/SCons/Tool/tex.py index 3cd18e0..5a664ef 100644 --- a/third_party/scons/scons-local/SCons/Tool/tex.py +++ b/third_party/scons/scons-local/SCons/Tool/tex.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/tex.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/tex.py 3842 2008/12/20 22:59:52 scons" import os.path import re @@ -42,6 +42,7 @@ import SCons.Action import SCons.Node import SCons.Node.FS import SCons.Util +import SCons.Scanner.LaTeX Verbose = False @@ -78,19 +79,29 @@ undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) # used by the emitter auxfile_re = re.compile(r".", re.MULTILINE) -tableofcontents_re = re.compile(r"^[^%]*\\tableofcontents", re.MULTILINE) -makeindex_re = re.compile(r"^[^%]*\\makeindex", re.MULTILINE) -bibliography_re = re.compile(r"^[^%]*\\bibliography", re.MULTILINE) -listoffigures_re = re.compile(r"^[^%]*\\listoffigures", re.MULTILINE) -listoftables_re = re.compile(r"^[^%]*\\listoftables", re.MULTILINE) -hyperref_re = re.compile(r"^[^%]*\\usepackage.*\{hyperref\}", re.MULTILINE) -makenomenclature_re = re.compile(r"^[^%]*\\makenomenclature", re.MULTILINE) -makeglossary_re = re.compile(r"^[^%]*\\makeglossary", re.MULTILINE) -beamer_re = re.compile(r"^[^%]*\\documentclass\{beamer\}", re.MULTILINE) +tableofcontents_re = re.compile(r"^[^%\n]*\\tableofcontents", re.MULTILINE) +makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE) +bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE) +listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE) +listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE) +hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE) +makenomenclature_re = re.compile(r"^[^%\n]*\\makenomenclature", re.MULTILINE) +makeglossary_re = re.compile(r"^[^%\n]*\\makeglossary", re.MULTILINE) +beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE) + +# search to find all files included by Latex +include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE) + +# search to find all graphics files included by Latex +includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE) # search to find all files opened by Latex (recorded in .log file) openout_re = re.compile(r"\\openout.*`(.*)'") +# list of graphics file extensions for TeX and LaTeX +TexGraphics = SCons.Scanner.LaTeX.TexGraphics +LatexGraphics = SCons.Scanner.LaTeX.LatexGraphics + # An Action sufficient to build any generic tex file. TeXAction = None @@ -111,39 +122,42 @@ MakeNclAction = None MakeGlossaryAction = None # Used as a return value of modify_env_var if the variable is not set. -class _Null: - pass -_null = _Null - -# The user specifies the paths in env[variable], similar to other builders. -# They may be relative and must be converted to absolute, as expected -# by LaTeX and Co. The environment may already have some paths in -# env['ENV'][var]. These paths are honored, but the env[var] paths have -# higher precedence. All changes are un-done on exit. -def modify_env_var(env, var, abspath): - try: - save = env['ENV'][var] - except KeyError: - save = _null - env.PrependENVPath(var, abspath) - try: - if SCons.Util.is_List(env[var]): - #TODO(1.5) env.PrependENVPath(var, [os.path.abspath(str(p)) for p in env[var]]) - env.PrependENVPath(var, map(lambda p: os.path.abspath(str(p)), env[var])) +_null = SCons.Scanner.LaTeX._null + +modify_env_var = SCons.Scanner.LaTeX.modify_env_var + +def FindFile(name,suffixes,paths,env,requireExt=False): + if requireExt: + name = SCons.Util.splitext(name)[0] + if Verbose: + print " searching for '%s' with extensions: " % name,suffixes + + for path in paths: + testName = os.path.join(path,name) + if Verbose: + print " look for '%s'" % testName + if os.path.exists(testName): + if Verbose: + print " found '%s'" % testName + return env.fs.File(testName) else: - # Split at os.pathsep to convert into absolute path - #TODO(1.5) env.PrependENVPath(var, [os.path.abspath(p) for p in str(env[var]).split(os.pathsep)]) - env.PrependENVPath(var, map(lambda p: os.path.abspath(p), str(env[var]).split(os.pathsep))) - except KeyError: - pass - # Convert into a string explicitly to append ":" (without which it won't search system - # paths as well). The problem is that env.AppendENVPath(var, ":") - # does not work, refuses to append ":" (os.pathsep). - if SCons.Util.is_List(env['ENV'][var]): - env['ENV'][var] = os.pathsep.join(env['ENV'][var]) - # Append the trailing os.pathsep character here to catch the case with no env[var] - env['ENV'][var] = env['ENV'][var] + os.pathsep - return save + name_ext = SCons.Util.splitext(testName)[1] + if name_ext: + continue + + # if no suffix try adding those passed in + for suffix in suffixes: + testNameExt = testName + suffix + if Verbose: + print " look for '%s'" % testNameExt + + if os.path.exists(testNameExt): + if Verbose: + print " found '%s'" % testNameExt + return env.fs.File(testNameExt) + if Verbose: + print " did not find '%s'" % name + return None def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None): """A builder for LaTeX files that checks the output in the aux file @@ -171,7 +185,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None for var in SCons.Scanner.LaTeX.LaTeX.env_variables: saved_env[var] = modify_env_var(env, var, abspath) - # Create a base file names with the target directory since the auxiliary files + # Create base file names with the target directory since the auxiliary files # will be made there. That's because the *COM variables have the cd # command in the prolog. We check # for the existence of files before opening them--even ones like the @@ -205,7 +219,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None # # routine to update MD5 hash and compare # - def check_MD5(filenode, suffix, saved_hashes=saved_hashes): + # TODO(1.5): nested scopes + def check_MD5(filenode, suffix, saved_hashes=saved_hashes, targetbase=targetbase): global must_rerun_latex # two calls to clear old csig filenode.clear_memoized_values() @@ -386,7 +401,77 @@ def TeXLaTeXStrFunction(target = None, source= None, env=None): result = '' return result -def tex_emitter(target, source, env): +def tex_eps_emitter(target, source, env): + """An emitter for TeX and LaTeX sources when + executing tex or latex. It will accept .ps and .eps + graphics files + """ + (target, source) = tex_emitter_core(target, source, env, TexGraphics) + + return (target, source) + +def tex_pdf_emitter(target, source, env): + """An emitter for TeX and LaTeX sources when + executing pdftex or pdflatex. It will accept graphics + files of types .pdf, .jpg, .png, .gif, and .tif + """ + (target, source) = tex_emitter_core(target, source, env, LatexGraphics) + + return (target, source) + +def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir): + # for theFile (a Node) update any file_tests and search for graphics files + # then find all included files and call ScanFiles for each of them + content = theFile.get_contents() + if Verbose: + print " scanning ",str(theFile) + + for i in range(len(file_tests_search)): + if file_tests[i][0] == None: + file_tests[i][0] = file_tests_search[i].search(content) + + # For each file see if any graphics files are included + # and set up target to create ,pdf graphic + # is this is in pdflatex toolchain + graphic_files = includegraphics_re.findall(content) + if Verbose: + print "graphics files in '%s': "%str(theFile),graphic_files + for graphFile in graphic_files: + graphicNode = FindFile(graphFile,graphics_extensions,paths,env,requireExt=True) + # if building with pdflatex see if we need to build the .pdf version of the graphic file + # I should probably come up with a better way to tell which builder we are using. + if graphics_extensions == LatexGraphics: + # see if we can build this graphics file by epstopdf + graphicSrc = FindFile(graphFile,TexGraphics,paths,env,requireExt=True) + # it seems that FindFile checks with no extension added + # so if the extension is included in the name then both searches find it + # we don't want to try to build a .pdf from a .pdf so make sure src!=file wanted + if (graphicSrc != None) and (graphicSrc != graphicNode): + if Verbose: + if graphicNode == None: + print "need to build '%s' by epstopdf %s -o %s" % (graphFile,graphicSrc,graphFile) + else: + print "no need to build '%s', but source file %s exists" % (graphicNode,graphicSrc) + graphicNode = env.PDF(graphicSrc) + env.Depends(target[0],graphicNode) + + # recursively call this on each of the included files + inc_files = [ ] + inc_files.extend( include_re.findall(content) ) + if Verbose: + print "files included by '%s': "%str(theFile),inc_files + # inc_files is list of file names as given. need to find them + # using TEXINPUTS paths. + + for src in inc_files: + srcNode = srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) + if srcNode != None: + file_test = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir) + if Verbose: + print " done scanning ",str(theFile) + return file_tests + +def tex_emitter_core(target, source, env, graphics_extensions): """An emitter for TeX and LaTeX sources. For LaTeX sources we try and find the common created files that are needed on subsequent runs of latex to finish tables of contents, @@ -395,8 +480,9 @@ def tex_emitter(target, source, env): targetbase = SCons.Util.splitext(str(target[0]))[0] basename = SCons.Util.splitext(str(source[0]))[0] basefile = os.path.split(str(basename))[1] - + basedir = os.path.split(str(source[0]))[0] + targetdir = os.path.split(str(target[0]))[0] abspath = os.path.abspath(basedir) target[0].attributes.path = abspath @@ -413,27 +499,67 @@ def tex_emitter(target, source, env): env.Clean(target[0],logfilename) content = source[0].get_contents() + idx_exists = os.path.exists(targetbase + '.idx') nlo_exists = os.path.exists(targetbase + '.nlo') glo_exists = os.path.exists(targetbase + '.glo') - file_tests = [(auxfile_re.search(content),['.aux']), - (makeindex_re.search(content) or idx_exists,['.idx', '.ind', '.ilg']), - (bibliography_re.search(content),['.bbl', '.blg']), - (tableofcontents_re.search(content),['.toc']), - (listoffigures_re.search(content),['.lof']), - (listoftables_re.search(content),['.lot']), - (hyperref_re.search(content),['.out']), - (makenomenclature_re.search(content) or nlo_exists,['.nlo', '.nls', '.nlg']), - (makeglossary_re.search(content) or glo_exists,['.glo', '.gls', '.glg']), - (beamer_re.search(content),['.nav', '.snm', '.out', '.toc']) ] - # Note we add the various makeindex files if the file produced by latex exists (.idx, .glo, .nlo) - # This covers the case where the \makeindex, \makenomenclature, or \makeglossary - # is not in the main file but we want to clean the files and those made by makeindex + # set up list with the regular expressions + # we use to find features used + file_tests_search = [auxfile_re, + makeindex_re, + bibliography_re, + tableofcontents_re, + listoffigures_re, + listoftables_re, + hyperref_re, + makenomenclature_re, + makeglossary_re, + beamer_re ] + # set up list with the file suffixes that need emitting + # when a feature is found + file_tests_suff = [['.aux'], + ['.idx', '.ind', '.ilg'], + ['.bbl', '.blg'], + ['.toc'], + ['.lof'], + ['.lot'], + ['.out'], + ['.nlo', '.nls', '.nlg'], + ['.glo', '.gls', '.glg'], + ['.nav', '.snm', '.out', '.toc'] ] + # build the list of lists + file_tests = [] + for i in range(len(file_tests_search)): + file_tests.append( [None, file_tests_suff[i]] ) # TO-DO: need to add a way for the user to extend this list for whatever # auxiliary files they create in other (or their own) packages + # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] + savedpath = modify_env_var(env, 'TEXINPUTS', abspath) + paths = env['ENV']['TEXINPUTS'] + if SCons.Util.is_List(paths): + pass + else: + # Split at os.pathsep to convert into absolute path + # TODO(1.5) + #paths = paths.split(os.pathsep) + paths = string.split(paths, os.pathsep) + + # now that we have the path list restore the env + if savedpath is _null: + try: + del env['ENV']['TEXINPUTS'] + except KeyError: + pass # was never set + else: + env['ENV']['TEXINPUTS'] = savedpath + if Verbose: + print "search path ",paths + + file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir) + for (theSearch,suffix_list) in file_tests: if theSearch: for suffix in suffix_list: @@ -496,7 +622,7 @@ def generate(env): bld = env['BUILDERS']['DVI'] bld.add_action('.tex', TeXLaTeXAction) - bld.add_emitter('.tex', tex_emitter) + bld.add_emitter('.tex', tex_eps_emitter) env['TEX'] = 'tex' env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') diff --git a/third_party/scons/scons-local/SCons/Tool/tlib.py b/third_party/scons/scons-local/SCons/Tool/tlib.py index c41e23c..03fa99c 100644 --- a/third_party/scons/scons-local/SCons/Tool/tlib.py +++ b/third_party/scons/scons-local/SCons/Tool/tlib.py @@ -27,7 +27,7 @@ XXX # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/tlib.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/tlib.py 3842 2008/12/20 22:59:52 scons" import SCons.Tool import SCons.Tool.bcc32 diff --git a/third_party/scons/scons-local/SCons/Tool/wix.py b/third_party/scons/scons-local/SCons/Tool/wix.py index 5802bdb..16725e1 100644 --- a/third_party/scons/scons-local/SCons/Tool/wix.py +++ b/third_party/scons/scons-local/SCons/Tool/wix.py @@ -30,7 +30,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/wix.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/wix.py 3842 2008/12/20 22:59:52 scons" import SCons.Builder import SCons.Action diff --git a/third_party/scons/scons-local/SCons/Tool/yacc.py b/third_party/scons/scons-local/SCons/Tool/yacc.py index c1ae31c..e06c477 100644 --- a/third_party/scons/scons-local/SCons/Tool/yacc.py +++ b/third_party/scons/scons-local/SCons/Tool/yacc.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/yacc.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/yacc.py 3842 2008/12/20 22:59:52 scons" import os.path import string diff --git a/third_party/scons/scons-local/SCons/Tool/zip.py b/third_party/scons/scons-local/SCons/Tool/zip.py index b57b331..5765fef 100644 --- a/third_party/scons/scons-local/SCons/Tool/zip.py +++ b/third_party/scons/scons-local/SCons/Tool/zip.py @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/zip.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Tool/zip.py 3842 2008/12/20 22:59:52 scons" import os.path diff --git a/third_party/scons/scons-local/SCons/Util.py b/third_party/scons/scons-local/SCons/Util.py index ead3c2d..1f33f97 100644 --- a/third_party/scons/scons-local/SCons/Util.py +++ b/third_party/scons/scons-local/SCons/Util.py @@ -27,7 +27,7 @@ Various utility functions go here. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Util.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Util.py 3842 2008/12/20 22:59:52 scons" import copy import os @@ -1022,6 +1022,10 @@ class CLVar(UserList): """ def __init__(self, seq = []): UserList.__init__(self, Split(seq)) + def __add__(self, other): + return UserList.__add__(self, CLVar(other)) + def __radd__(self, other): + return UserList.__radd__(self, CLVar(other)) def __coerce__(self, other): return (self, CLVar(other)) def __str__(self): diff --git a/third_party/scons/scons-local/SCons/Variables/BoolVariable.py b/third_party/scons/scons-local/SCons/Variables/BoolVariable.py index dd11f55..3aaf694 100644 --- a/third_party/scons/scons-local/SCons/Variables/BoolVariable.py +++ b/third_party/scons/scons-local/SCons/Variables/BoolVariable.py @@ -34,7 +34,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/BoolVariable.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/BoolVariable.py 3842 2008/12/20 22:59:52 scons" __all__ = ['BoolVariable',] diff --git a/third_party/scons/scons-local/SCons/Variables/EnumVariable.py b/third_party/scons/scons-local/SCons/Variables/EnumVariable.py index d7ad21b..6d2252d 100644 --- a/third_party/scons/scons-local/SCons/Variables/EnumVariable.py +++ b/third_party/scons/scons-local/SCons/Variables/EnumVariable.py @@ -37,7 +37,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/EnumVariable.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/EnumVariable.py 3842 2008/12/20 22:59:52 scons" __all__ = ['EnumVariable',] diff --git a/third_party/scons/scons-local/SCons/Variables/ListVariable.py b/third_party/scons/scons-local/SCons/Variables/ListVariable.py index 4dcaa1c9..72e6fec 100644 --- a/third_party/scons/scons-local/SCons/Variables/ListVariable.py +++ b/third_party/scons/scons-local/SCons/Variables/ListVariable.py @@ -47,7 +47,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/ListVariable.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/ListVariable.py 3842 2008/12/20 22:59:52 scons" # Know Bug: This should behave like a Set-Type, but does not really, # since elements can occur twice. diff --git a/third_party/scons/scons-local/SCons/Variables/PackageVariable.py b/third_party/scons/scons-local/SCons/Variables/PackageVariable.py index e0da2e6..5823bf5 100644 --- a/third_party/scons/scons-local/SCons/Variables/PackageVariable.py +++ b/third_party/scons/scons-local/SCons/Variables/PackageVariable.py @@ -50,7 +50,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/PackageVariable.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/PackageVariable.py 3842 2008/12/20 22:59:52 scons" __all__ = ['PackageVariable',] diff --git a/third_party/scons/scons-local/SCons/Variables/PathVariable.py b/third_party/scons/scons-local/SCons/Variables/PathVariable.py index 298eadf..752e347 100644 --- a/third_party/scons/scons-local/SCons/Variables/PathVariable.py +++ b/third_party/scons/scons-local/SCons/Variables/PathVariable.py @@ -68,7 +68,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/PathVariable.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/PathVariable.py 3842 2008/12/20 22:59:52 scons" __all__ = ['PathVariable',] diff --git a/third_party/scons/scons-local/SCons/Variables/__init__.py b/third_party/scons/scons-local/SCons/Variables/__init__.py index c16cb07..5d73e10 100644 --- a/third_party/scons/scons-local/SCons/Variables/__init__.py +++ b/third_party/scons/scons-local/SCons/Variables/__init__.py @@ -27,7 +27,7 @@ customizable variables to an SCons build. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Variables/__init__.py 3842 2008/12/20 22:59:52 scons" import os.path import string diff --git a/third_party/scons/scons-local/SCons/Warnings.py b/third_party/scons/scons-local/SCons/Warnings.py index f052b0ea..296d6d3 100644 --- a/third_party/scons/scons-local/SCons/Warnings.py +++ b/third_party/scons/scons-local/SCons/Warnings.py @@ -27,7 +27,7 @@ This file implements the warnings framework for SCons. """ -__revision__ = "src/engine/SCons/Warnings.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/Warnings.py 3842 2008/12/20 22:59:52 scons" import string import sys @@ -55,6 +55,9 @@ class DeprecatedWarning(Warning): class DeprecatedCopyWarning(DeprecatedWarning): pass +class DeprecatedOptionsWarning(DeprecatedWarning): + pass + class DeprecatedSourceSignaturesWarning(DeprecatedWarning): pass @@ -64,6 +67,9 @@ class DeprecatedTargetSignaturesWarning(DeprecatedWarning): class DuplicateEnvironmentWarning(Warning): pass +class FutureReservedVariableWarning(Warning): + pass + class LinkWarning(Warning): pass diff --git a/third_party/scons/scons-local/SCons/__init__.py b/third_party/scons/scons-local/SCons/__init__.py index 96142d2..c006699 100644 --- a/third_party/scons/scons-local/SCons/__init__.py +++ b/third_party/scons/scons-local/SCons/__init__.py @@ -27,15 +27,15 @@ The main package for the SCons software construction utility. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/__init__.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/__init__.py 3842 2008/12/20 22:59:52 scons" -__version__ = "1.1.0" +__version__ = "1.2.0" -__build__ = "r3603" +__build__ = "r3842" __buildsys__ = "scons-dev" -__date__ = "2008/10/10 05:46:45" +__date__ = "2008/12/20 22:59:52" __developer__ = "scons" diff --git a/third_party/scons/scons-local/SCons/compat/__init__.py b/third_party/scons/scons-local/SCons/compat/__init__.py index 17a0b10..c285db3 100644 --- a/third_party/scons/scons-local/SCons/compat/__init__.py +++ b/third_party/scons/scons-local/SCons/compat/__init__.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/compat/__init__.py 3842 2008/12/20 22:59:52 scons" def import_as(module, name): """ @@ -155,6 +155,19 @@ except ImportError: # Pre-2.3 Python has no optparse module. import_as('_scons_optparse', 'optparse') +import os +try: + os.devnull +except AttributeError: + # Pre-2.4 Python has no os.devnull attribute + import sys + _names = sys.builtin_module_names + if 'posix' in _names: + os.devnull = '/dev/null' + elif 'nt' in _names: + os.devnull = 'nul' + os.path.devnull = os.devnull + import shlex try: shlex.split diff --git a/third_party/scons/scons-local/SCons/compat/_scons_UserString.py b/third_party/scons/scons-local/SCons/compat/_scons_UserString.py index 0ff1cad..cde813d9 100644 --- a/third_party/scons/scons-local/SCons/compat/_scons_UserString.py +++ b/third_party/scons/scons-local/SCons/compat/_scons_UserString.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/compat/_scons_UserString.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_UserString.py 3842 2008/12/20 22:59:52 scons" __doc__ = """ A user-defined wrapper around string objects diff --git a/third_party/scons/scons-local/SCons/compat/_scons_hashlib.py b/third_party/scons/scons-local/SCons/compat/_scons_hashlib.py index cd2f756..97bf8d9 100644 --- a/third_party/scons/scons-local/SCons/compat/_scons_hashlib.py +++ b/third_party/scons/scons-local/SCons/compat/_scons_hashlib.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_hashlib.py 3842 2008/12/20 22:59:52 scons" import md5 import string diff --git a/third_party/scons/scons-local/SCons/compat/_scons_itertools.py b/third_party/scons/scons-local/SCons/compat/_scons_itertools.py index a0e6c94..145a7f9 100644 --- a/third_party/scons/scons-local/SCons/compat/_scons_itertools.py +++ b/third_party/scons/scons-local/SCons/compat/_scons_itertools.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/compat/_scons_itertools.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/compat/_scons_itertools.py 3842 2008/12/20 22:59:52 scons" __doc__ = """ Implementations of itertools functions for Python versions that don't diff --git a/third_party/scons/scons-local/SCons/compat/_scons_subprocess.py b/third_party/scons/scons-local/SCons/compat/_scons_subprocess.py index 4cb9e30..68d0e4c 100644 --- a/third_party/scons/scons-local/SCons/compat/_scons_subprocess.py +++ b/third_party/scons/scons-local/SCons/compat/_scons_subprocess.py @@ -394,7 +394,11 @@ if mswindows: STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 else: - from _subprocess import * + # 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 diff --git a/third_party/scons/scons-local/SCons/compat/builtins.py b/third_party/scons/scons-local/SCons/compat/builtins.py index 5cf21e2..8ae38b6 100644 --- a/third_party/scons/scons-local/SCons/compat/builtins.py +++ b/third_party/scons/scons-local/SCons/compat/builtins.py @@ -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 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/compat/builtins.py 3842 2008/12/20 22:59:52 scons" import __builtin__ diff --git a/third_party/scons/scons-local/SCons/cpp.py b/third_party/scons/scons-local/SCons/cpp.py index 9b5b5b1..1980956 100644 --- a/third_party/scons/scons-local/SCons/cpp.py +++ b/third_party/scons/scons-local/SCons/cpp.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/cpp.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/cpp.py 3842 2008/12/20 22:59:52 scons" __doc__ = """ SCons C Pre-Processor module diff --git a/third_party/scons/scons-local/SCons/exitfuncs.py b/third_party/scons/scons-local/SCons/exitfuncs.py index db4f40f..2feb86c 100644 --- a/third_party/scons/scons-local/SCons/exitfuncs.py +++ b/third_party/scons/scons-local/SCons/exitfuncs.py @@ -27,7 +27,7 @@ Register functions which are executed when SCons exits for any reason. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/exitfuncs.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/engine/SCons/exitfuncs.py 3842 2008/12/20 22:59:52 scons" diff --git a/third_party/scons/scons-time.py b/third_party/scons/scons-time.py index 5de27ff..67b6643 100644 --- a/third_party/scons/scons-time.py +++ b/third_party/scons/scons-time.py @@ -33,7 +33,7 @@ from __future__ import nested_scopes -__revision__ = "src/script/scons-time.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/script/scons-time.py 3842 2008/12/20 22:59:52 scons" import getopt import glob @@ -166,13 +166,13 @@ class Gnuplotter(Plotter): result = [] for line in self.lines: result.extend(line.get_x_values()) - return filter(None, result) + return filter(lambda r: not r is None, result) def get_all_y_values(self): result = [] for line in self.lines: result.extend(line.get_y_values()) - return filter(None, result) + return filter(lambda r: not r is None, result) def get_min_x(self): try: diff --git a/third_party/scons/scons.py b/third_party/scons/scons.py index ef1198d..88276a4 100755 --- a/third_party/scons/scons.py +++ b/third_party/scons/scons.py @@ -24,15 +24,15 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/script/scons.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/script/scons.py 3842 2008/12/20 22:59:52 scons" -__version__ = "1.1.0" +__version__ = "1.2.0" -__build__ = "r3603" +__build__ = "r3842" __buildsys__ = "scons-dev" -__date__ = "2008/10/10 05:46:45" +__date__ = "2008/12/20 22:59:52" __developer__ = "scons" @@ -160,4 +160,6 @@ sys.path = libs + sys.path if __name__ == "__main__": import SCons.Script + # this does all the work, and calls sys.exit + # with the proper exit status when done. SCons.Script.main() diff --git a/third_party/scons/sconsign.py b/third_party/scons/sconsign.py index 3532175..a33b7b4 100644 --- a/third_party/scons/sconsign.py +++ b/third_party/scons/sconsign.py @@ -24,15 +24,15 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/script/sconsign.py 3603 2008/10/10 05:46:45 scons" +__revision__ = "src/script/sconsign.py 3842 2008/12/20 22:59:52 scons" -__version__ = "1.1.0" +__version__ = "1.2.0" -__build__ = "r3603" +__build__ = "r3842" __buildsys__ = "scons-dev" -__date__ = "2008/10/10 05:46:45" +__date__ = "2008/12/20 22:59:52" __developer__ = "scons" |