diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-01 13:15:47 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-01 13:15:47 +0200 |
commit | b0c36cefa1e0a4bf99681aade9e26ac6aa1ef903 (patch) | |
tree | d63dc2036a39e716daf18e3c915fafb2fcba6674 /src/engine/SCons/Builder.py | |
parent | 6be31f5d140b81227911cabfc61d3802c76c1b61 (diff) | |
parent | a5d26f7b62414ed38e1815a49a864b15df2e9694 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/engine/SCons/Builder.py')
-rw-r--r-- | src/engine/SCons/Builder.py | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 6bc5c92..9cb0f86 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -1,4 +1,5 @@ -"""SCons.Builder +""" +SCons.Builder Builder object subsystem. @@ -31,7 +32,7 @@ There is also a proxy that looks like a Builder: Builders and their proxies have the following public interface methods used by other modules: - __call__() + - __call__() THE public interface. Calling a Builder object (with the use of internal helper methods) sets up the target and source dependencies, appropriate mapping to a specific action, and the @@ -39,12 +40,12 @@ used by other modules: variable. This also takes care of warning about possible mistakes in keyword arguments. - add_emitter() + - add_emitter() Adds an emitter for a specific file suffix, used by some Tool modules to specify that (for example) a yacc invocation on a .y can create a .h *and* a .c file. - add_action() + - add_action() Adds an action for a specific file suffix, heavily used by Tool modules to add their specific action(s) for turning a source file into an object file to the global static @@ -52,23 +53,23 @@ used by other modules: There are the following methods for internal use within this module: - _execute() + - _execute() The internal method that handles the heavily lifting when a Builder is called. This is used so that the __call__() methods can set up warning about possible mistakes in keyword-argument overrides, and *then* execute all of the steps necessary so that the warnings only occur once. - get_name() + - get_name() Returns the Builder's name within a specific Environment, primarily used to try to return helpful information in error messages. - adjust_suffix() - get_prefix() - get_suffix() - get_src_suffix() - set_src_suffix() + - adjust_suffix() + - get_prefix() + - get_suffix() + - get_src_suffix() + - set_src_suffix() Miscellaneous stuff for handling the prefix and suffix manipulation we use in turning source file names into target file names. @@ -76,7 +77,7 @@ There are the following methods for internal use within this module: """ # -# Copyright (c) 2001 - 2016 The SCons Foundation +# Copyright (c) 2001 - 2017 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -97,7 +98,7 @@ There are the following methods for internal use within this module: # 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/Builder.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Builder.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" import collections @@ -166,7 +167,7 @@ class DictCmdGenerator(SCons.Util.Selector): try: ret = SCons.Util.Selector.__call__(self, env, source, ext) - except KeyError, e: + except KeyError as e: raise UserError("Ambiguous suffixes after environment substitution: %s == %s == %s" % (e.args[0], e.args[1], e.args[2])) if ret is None: raise UserError("While building `%s' from `%s': Don't know how to build from a source file with suffix `%s'. Expected a suffix in this list: %s." % \ @@ -229,7 +230,7 @@ class OverrideWarner(collections.UserDict): def warn(self): if self.already_warned: return - for k in self.keys(): + for k in list(self.keys()): if k in misleading_keywords: alt = misleading_keywords[k] msg = "Did you mean to use `%s' instead of `%s'?" % (alt, k) @@ -299,7 +300,7 @@ def _node_errors(builder, env, tlist, slist): msg = "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s" % (t, action.genstring(tlist, slist, t.env)) SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning, msg) else: - msg = "Two environments with different actions were specified for the same target: %s\n(action 1: %s)\n(action 2: %s)" % (t,t_contents,contents) + msg = "Two environments with different actions were specified for the same target: %s\n(action 1: %s)\n(action 2: %s)" % (t,t_contents.decode('utf-8'),contents.decode('utf-8')) raise UserError(msg) if builder.multi: if t.builder != builder: @@ -344,8 +345,11 @@ class EmitterProxy(object): return (target, source) - def __cmp__(self, other): - return cmp(self.var, other.var) + def __eq__(self, other): + return self.var == other.var + + def __lt__(self, other): + return self.var < other.var class BuilderBase(object): """Base class for Builders, objects that create output @@ -423,6 +427,9 @@ class BuilderBase(object): def __nonzero__(self): raise InternalError("Do not test for the Node.builder attribute directly; use Node.has_builder() instead") + def __bool__(self): + return self.__nonzero__() + def get_name(self, env): """Attempts to get the name of the Builder. @@ -440,8 +447,8 @@ class BuilderBase(object): except AttributeError: return str(self.__class__) - def __cmp__(self, other): - return cmp(self.__dict__, other.__dict__) + def __eq__(self, other): + return self.__dict__ == other.__dict__ def splitext(self, path, env=None): if not env: @@ -604,6 +611,8 @@ class BuilderBase(object): else: ekw = self.executor_kw.copy() ekw['chdir'] = chdir + if 'chdir' in ekw and SCons.Util.is_String(ekw['chdir']): + ekw['chdir'] = env.subst(ekw['chdir']) if kw: if 'srcdir' in kw: def prependDirIfRelative(f, srcdir=kw['srcdir']): |