[Scons-users] chained/contingent Builders (specifically: multiple TeX->PDF paths)

Christopher Genovese genovese.cr at gmail.com
Wed Mar 13 20:29:37 EDT 2013


I have a large collection of TeX files that need to be converted to PDF in
multiple ways. Many are in a custom TeX format (using plain libraries) and
can be processed with pdftex; many more are in the custom format but use
pstricks and need to be converted dvi to postscript first (tex, dvips) and
then to pdf; and some are in LaTeX and can be handled by pdflatex. Files
can go from the first to second type (or vice versa) during editing, so the
classification needs to be based on the file contents.

I've long used a makefile with pattern targets and some small scripts to
automate this so that I can just build the PDF file without having to
specify the classification explicitly. It works, but I think SCons would
be more flexible and powerful in the long run, and I'd like to switch over
(for this and in general). However, it seems that the builtin PDF builder
only handles cases 1 and 3, so I think I will need a custom builder.

My question is this: What is the easiest way to specify a Builder that acts
like one or more other/built-in Builder's depending on the source contents?
My first thought was to override the __call__ method of a generic builder
to invoke PDF() in one case or DVI()+PostScript()+the ps-to-pdf action in
the second case. But perhaps/hopefully there is an easier and more
idiomatic way. Either way, I'd appreciate any ideas or pointers.

(As a side note, I needed a custom Scanner to scrape implicit dependencies
from specialized macros in these files. That is working with the built-in
Builders, but I'd need to be able to add that Scanner to whatever Builder I
end up using. I don't see a problem there, but thought I'd mention that
requirement.)

Thanks for your help.

-- Christopher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130313/a7d3ff80/attachment.html>


More information about the Scons-users mailing list