From: stevenknight Date: Thu, 3 Jan 2002 00:21:31 +0000 (+0000) Subject: Refactor CompositeBuilder initialization. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be6317987cdea861f633b66b6f6b42134880d9b7;p=scons.git Refactor CompositeBuilder initialization. git-svn-id: http://scons.tigris.org/svn/scons/trunk@187 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index dfcf3958..45e5f2bf 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -19,6 +19,9 @@ RELEASE 0.03 - as separate file names, allowing prefixes and suffixes to be appended to each individually. + - Refactor to move CompositeBuilder initialization logic from the + factory wrapper to the __init__() method. + From Anthony Roach: - Add a "duplicate" keyword argument to BuildDir() that can be set diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index eceb66a1..27d93e94 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -126,15 +126,6 @@ def Builder(**kw): return apply(MultiStepBuilder, (), kw) elif kw.has_key('action') and (type(kw['action']) is types.DictType or isinstance(kw['action'], UserDict)): - action_dict = kw['action'] - builders = [] - for suffix, action in action_dict.items(): - bld_kw = kw.copy() - bld_kw['action'] = action - bld_kw['src_suffix'] = suffix - builders.append(apply(BuilderBase, (), bld_kw)) - del kw['action'] - kw['builders'] = builders return apply(CompositeBuilder, (), kw) else: return apply(BuilderBase, (), kw) @@ -279,14 +270,14 @@ class CompositeBuilder(BuilderBase): def __init__(self, name = None, prefix='', suffix='', - builders=[]): + action = {}): BuilderBase.__init__(self, name=name, prefix=prefix, suffix=suffix) self.builder_dict = {} - for bld in builders: - if not bld.src_suffix: - raise InternalError, "All builders supplied to CompositeBuilder class must have a src_suffix." - self.builder_dict[bld.src_suffix] = bld + for suff, act in action.items(): + self.builder_dict[suff] = BuilderBase(name = name, + action = act, + src_suffix = suff) def __call__(self, env, target = None, source = None): ret = BuilderBase.__call__(self, env, target=target, source=source)