[Scons-users] Feedback request: an AsciiDoc tool
Marc Joliet
marcec at gmx.de
Mon Nov 26 03:02:23 EST 2012
Answering this now since I couldn't sleep (hey, I'm a student).
Am Mon, 26 Nov 2012 03:56:09 +0100
schrieb Dirk Bächle <tshortik at gmx.de>:
> Hi Marc,
Hi Dirk,
> thanks a lot for contributing to the SCons project with your asciidoc
> Builder/Tool. Looks like you really did your homework... ;)
Glad to do it! I really appreciate it when other people do this, and it feels
good giving back in turn :) .
> Following my comments to your questions:
For the record: I use SCons 2.2.0 with Python 2.7 on Gentoo Linux.
> On 26.11.2012 01:12, Marc Joliet wrote:
> > Hi all!
> >
> > [....]
> > I do have some questions, though:
> >
> > 1.) Exactly what calls exists(env) and why? I've wondered about this before,
> > and I tried unconditionally returning False, with no change in build system
> > behavior. So what is the effect of this function supposed to be? The best
> > google gave me was an old blog post where somebody was trying out SCons
> > and wondered the same thing (the person liked SCons, BTW).
>
> The exists() method can be called by you in your SConscripts, if you
> want. SCons only calls exists() when it checks for the default Tools
> like "gcc", "link", "ar" and so on. That's why you don't see any obvious
> change when returning False in your add-on Tool.
Ah, thats good to know. It looks like the way to call it would be by using the
Tool() function:
t = Tool(name)
if t.exists(env):
t(env)
I suppose this is the proper way to handle optional tools (or tools required
for optional targets)?
> > 2.) Is it bad/wrong to add a pseudo-builder to env['BUILDERS']?
>
> It has a drawback for more recent SCons versions (starting with 0.98, I
> think). When you add Builders to an
> Environment in this way, and then decide to Clone() the Environment, the
> added Builders don't get copied too.
> But when you use AddMethod(), SCons internally keeps track of the added
> methods and Clone() works as expected.
That would be too bad, but I tried doing exactly that and the builder works
fine from the Clone()'ed environment. Copied from the SConstruct I tried this
with:
bla = env.Clone()
docs = bla.AsciiDoc(['doc/index.txt'])
Looking at issue 780 (http://scons.tigris.org/issues/show_bug.cgi?id=780),
Steven Knight commented on the need to document this behaviour in early 2010,
about 18 months after the last 0.98 release (0.98.5). Maybe it was only a
short-term bug?
Also, in case it helps in tracking this down quicker, I remembered a comment in
another tool of mine (which I will ask about separately), where I tried to
find this out myself:
# NOTE: adding the function to $BUILDERS wraps it in a BuilderMethod object,
# which gives it the calling conventions of regular builders.
Although checking this I see that the class is now called BuilderWrapper, and
is used by BuilderDict, which looks like the class that manages the
environments builders, including cloning (see line 1388 in Environment.py). I'm
in over my head here, but it looks to me like there should be no reason for
this not to work.
> >
> > 3.) When I pass skeys to the constructor of a recursive Scanner, why does it
> > scan files with non-matching suffixes?
> >
> > [....]
>
> I'll try to have a look at your current code tomorrow. Then I can
> hopefully tell you more...if someone else is faster, all the better. ;)
Thanks!
> > 4.) Now a longer bit about emitters.
> >
> > [...]
>
> Using an Emitter for your chain of build steps seems like the right
> thing to me, and it should work. Again, I'll check out the sources... I
> assume the error is still present in the current head revision?
> Just remembering, the Doxygen Builder showed similar problems (like
> reverse dependencies) at first. Later I found out that for the Emitter
> or Scanner (not sure about this) the arguments target vs source were
> swapped. Maybe you want to check that in the meantime...
Nope, I *originally* used emitters, but moved everything to the pseudo-builders
after I couldn't figure out what was going on (otherwise I wouldn't be able to
use the tool in my own build systems). That's why I referred to the problematic
behaviour in the past tense :) . I did link to a version of the file with the
old code in it, though.
> Best regards,
>
> Dirk
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
Regards,
--
Marc Joliet
--
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20121126/3ca79ef1/attachment-0001.pgp>
More information about the Scons-users
mailing list