OLD | NEW |
1 """SCons.Builder | 1 """SCons.Builder |
2 | 2 |
3 Builder object subsystem. | 3 Builder object subsystem. |
4 | 4 |
5 A Builder object is a callable that encapsulates information about how | 5 A Builder object is a callable that encapsulates information about how |
6 to execute actions to create a target Node (file) from source Nodes | 6 to execute actions to create a target Node (file) from source Nodes |
7 (files), and how to create those dependencies for tracking. | 7 (files), and how to create those dependencies for tracking. |
8 | 8 |
9 The main entry point here is the Builder() factory method. This provides | 9 The main entry point here is the Builder() factory method. This provides |
10 a procedural interface that creates the right underlying Builder object | 10 a procedural interface that creates the right underlying Builder object |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 # | 91 # |
92 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 92 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
93 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 93 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
94 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 94 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
95 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 95 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
96 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 96 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
97 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 97 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
98 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 98 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
99 # | 99 # |
100 | 100 |
101 __revision__ = "src/engine/SCons/Builder.py 3603 2008/10/10 05:46:45 scons" | 101 __revision__ = "src/engine/SCons/Builder.py 3842 2008/12/20 22:59:52 scons" |
102 | 102 |
103 import UserDict | 103 import UserDict |
104 import UserList | 104 import UserList |
105 | 105 |
106 import SCons.Action | 106 import SCons.Action |
107 from SCons.Debug import logInstanceCreation | 107 from SCons.Debug import logInstanceCreation |
108 from SCons.Errors import InternalError, UserError | 108 from SCons.Errors import InternalError, UserError |
109 import SCons.Executor | 109 import SCons.Executor |
110 import SCons.Memoize | 110 import SCons.Memoize |
111 import SCons.Node | 111 import SCons.Node |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 msg = "Did you mean to use `%s' instead of `%s'?" % (alt, k) | 225 msg = "Did you mean to use `%s' instead of `%s'?" % (alt, k) |
226 SCons.Warnings.warn(SCons.Warnings.MisleadingKeywordsWarning, ms
g) | 226 SCons.Warnings.warn(SCons.Warnings.MisleadingKeywordsWarning, ms
g) |
227 self.already_warned = 1 | 227 self.already_warned = 1 |
228 | 228 |
229 def Builder(**kw): | 229 def Builder(**kw): |
230 """A factory for builder objects.""" | 230 """A factory for builder objects.""" |
231 composite = None | 231 composite = None |
232 if kw.has_key('generator'): | 232 if kw.has_key('generator'): |
233 if kw.has_key('action'): | 233 if kw.has_key('action'): |
234 raise UserError, "You must not specify both an action and a generato
r." | 234 raise UserError, "You must not specify both an action and a generato
r." |
235 kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator']) | 235 kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {}) |
236 del kw['generator'] | 236 del kw['generator'] |
237 elif kw.has_key('action'): | 237 elif kw.has_key('action'): |
238 source_ext_match = kw.get('source_ext_match', 1) | 238 source_ext_match = kw.get('source_ext_match', 1) |
239 if kw.has_key('source_ext_match'): | 239 if kw.has_key('source_ext_match'): |
240 del kw['source_ext_match'] | 240 del kw['source_ext_match'] |
241 if SCons.Util.is_Dict(kw['action']): | 241 if SCons.Util.is_Dict(kw['action']): |
242 composite = DictCmdGenerator(kw['action'], source_ext_match) | 242 composite = DictCmdGenerator(kw['action'], source_ext_match) |
243 kw['action'] = SCons.Action.CommandGeneratorAction(composite) | 243 kw['action'] = SCons.Action.CommandGeneratorAction(composite, {}) |
244 kw['src_suffix'] = composite.src_suffixes() | 244 kw['src_suffix'] = composite.src_suffixes() |
245 else: | 245 else: |
246 kw['action'] = SCons.Action.Action(kw['action']) | 246 kw['action'] = SCons.Action.Action(kw['action']) |
247 | 247 |
248 if kw.has_key('emitter'): | 248 if kw.has_key('emitter'): |
249 emitter = kw['emitter'] | 249 emitter = kw['emitter'] |
250 if SCons.Util.is_String(emitter): | 250 if SCons.Util.is_String(emitter): |
251 # This allows users to pass in an Environment | 251 # This allows users to pass in an Environment |
252 # variable reference (like "$FOO") as an emitter. | 252 # variable reference (like "$FOO") as an emitter. |
253 # We will look in that Environment variable for | 253 # We will look in that Environment variable for |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder') | 835 if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder') |
836 SCons.Util.Proxy.__init__(self, builder) | 836 SCons.Util.Proxy.__init__(self, builder) |
837 | 837 |
838 # cmdgen should always be an instance of DictCmdGenerator. | 838 # cmdgen should always be an instance of DictCmdGenerator. |
839 self.cmdgen = cmdgen | 839 self.cmdgen = cmdgen |
840 self.builder = builder | 840 self.builder = builder |
841 | 841 |
842 def add_action(self, suffix, action): | 842 def add_action(self, suffix, action): |
843 self.cmdgen.add_action(suffix, action) | 843 self.cmdgen.add_action(suffix, action) |
844 self.set_src_suffix(self.cmdgen.src_suffixes()) | 844 self.set_src_suffix(self.cmdgen.src_suffixes()) |
OLD | NEW |