From 7511301b4ec23b6b54647ae55368aee2e136518a Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 3 Jan 2002 00:21:31 +0000 Subject: Refactor CompositeBuilder initialization. --- src/CHANGES.txt | 3 +++ src/engine/SCons/Builder.py | 19 +++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index dfcf395..45e5f2b 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 eceb66a..27d93e9 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) -- cgit v0.12