[Scons-dev] Possible minor bug + how to get (or assign) a builder to a file node?
Left Right
olegsivokon at gmail.com
Thu Oct 4 09:31:00 EDT 2012
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?
Thanks.
Oleg
More information about the Scons-dev
mailing list