[Scons-users] chained/contingent Builders (specifically: multiple TeX->PDF paths)
Managan, Rob
managan1 at llnl.gov
Thu Mar 14 11:25:11 EDT 2013
Christopher,
Correct me if I am wrong but it sounds like case 2 (pstricks) can be handled with the existing builders.
For this I assume you need to create a .dvi file, run dvips, and then convert ps to pdf. Am I right that dvipdf is not an option?
To do this you would need to use the DVI builder first and then pass the result of that to the PS and then the PDF builder.
So it sounds like you need to write some python coding that decides what type of file the source is and then calls the correct set of builders.
If type == 1 or type == 3:
Env.PDF(source)
Else
Mydvi = env.DVI("src.tex")
Myps = env.PS(Mydvi)
Mypdf = env.PDF(Myps)
Hope this at least gets you started.
Rob
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Rob Managan email managan at llnl.gov
LLNL phone: 925-423-0903
P.O. Box 808, L-095 FAX: 925-422-3389
Livermore, CA 94551-0808
On 3/13/13 5:29 PM, "Christopher Genovese" <genovese.cr at gmail.com<mailto: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/20130314/76673ba7/attachment.htm>
More information about the Scons-users
mailing list