[Scons-users] chained/contingent Builders (specifically: multiple TeX->PDF paths)
Christopher Genovese
genovese.cr at gmail.com
Fri Mar 15 01:57:25 EDT 2013
Thanks Rob and Dirk for your very helpful comments.
Rob, that is exactly the logic I want, except I'd like to encapsulate it in
a builder.
Something like this was what I had in mind:
env = Environment()
env['ENV']['TEXINPUTS'] = os.environ['TEXINPUTS']
env.Append(SCANNERS=Scanner(mySpecializedScanner, skeys=['.tex']))
if COMMAND_LINE_TARGETS:
targets = COMMAND_LINE_TARGETS
else:
targets = Glob(r'[a-z]\w+\.tex')
for texfile in targets:
env.MyPDF(texfile)
In my quick look at the builtin-builders, it wasn't clear how to use the
desired
logic from within. However, it looks like the Psuedo-Builders that Dirk
mentioned
might be just the thing. I will definitely take a look at that and try it.
Thanks again to you both,
Christopher
On Wed, Mar 13, 2013 at 8:29 PM, Christopher Genovese <genovese.cr at gmail.com
> wrote:
> 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/20130315/8d369418/attachment.html>
More information about the Scons-users
mailing list