On Thu, Oct 4, 2012 at 9:31 AM, Left Right <olegsivo...@gmail.com> wrote: > Builder.py:537 > > def _execute(self, env, target, source, overwarn={}, executor_kw={}): > # We now assume that target and source are lists or None. > if self.src_builder: > source = self.src_builder_sources(env, source, overwarn) > > Hi. I've ran into this (what seems to be a bug) while trying to find > the builder of a created file node. > > It looks like for you this test is never true. Because if the > src_builder was a builder object, it would be implementing a > __nonzero__ method, which throws: > InternalError: Do not test for the Node.builder attribute directly; > use Node.has_builder() instead > > I ran into this eventually by trying to assign to src_builder property > of a builder (this is something where I'm blur, but can't find any > other way to link a file node to its builder). So that when I call > _execute, self.src_builder exists, but can't be used inside condition. > :| > > I'm most certain I don't quite understand yet how exactly to do what I > need (so, I probably shouldn't even get there), just stumbled over > this thing by accident. > > > ==================== > > The question: suppose I have a generator function like this: > > def asGenerator(source, target, env, for_signature): > print "source: %s" % source[0].get_path() > print "abs dir: %s" % source[0].src_builder > > Suppose I have created a file node (which is source[0].get_path()) like so: > > class FlashBuilderBase(BuilderBase): > """ > An extension needed to run Flash() target with no arguments > """ > def __init__(self, # long list of arguments... > **overrides): > self.fb_project_settings = None > self.fd_project_settings = None > return super(FlashBuilderBase, self).__init__(# same arguments > once again... > **overrides) > > def _execute(self, env, target, source, overwarn={}, executor_kw={}): > # ... > self.fb_project = # some info I need about the project file ... > if not target: > target = # some code to find the target ... > > if not source: > source = target # this is the file, which later becomes > the source[0] in asGenerator > > return super(FlashBuilderBase, self)._execute( > env, target, source, overwarn, executor_kw) > > Now, I have to get reference this builder (FlashBuilderBase) from > source[0] in asGenerator - how'd I do that?
You seem to be very confused, if you're that deep into the internals and undocumented methods. :-) Can you back up a few steps and say what you're trying to do? (Note that you say you're creating a File Node, but the code you show is for a subclass of Builder, which is pretty odd.) Have you been through Chapter 18 of the User's Guide? http://www.scons.org/doc/production/HTML/scons-user/c3621.html -- Gary _______________________________________________ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev