summaryrefslogtreecommitdiffstats
path: root/test/TEX/LATEX2.py
diff options
context:
space:
mode:
authorRobert Managan <managan1@llnl.gov>2008-10-07 18:39:19 (GMT)
committerRobert Managan <managan1@llnl.gov>2008-10-07 18:39:19 (GMT)
commitdf77b84392bf621b701cdb248c58b0780e5439de (patch)
treea286e02570aab9fef4c62974bd4c4dcb6fe9053a /test/TEX/LATEX2.py
parent856870a4151e82c4511b4ca2e77240685d10c4af (diff)
downloadSCons-df77b84392bf621b701cdb248c58b0780e5439de.zip
SCons-df77b84392bf621b701cdb248c58b0780e5439de.tar.gz
SCons-df77b84392bf621b701cdb248c58b0780e5439de.tar.bz2
test/TEX/PDF_single_source.py
Test of generating several .pdfs from a list of .ps (new single_source setting) test/TEX/LATEX2.py Based on second half of LATEX. generate all .pdf's at once by giving a list of .tex files test of single_source src/engine/SCons/Scanner/LaTeX.py Add test of changing an included file. Add test of included file having no extension src/engine/SCons/Scanner/LaTeX.py Add lists of acceptable graphics extensions, In the furture make this user configurable?? Scan for files in the paths stored in env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] for people who may just input their environment... Add function findENVPatDirs for this purpose src/engine/SCons/Tool/pdf.py add epstopdf action Have to add it after the pdftex action so it is not the default. Make builder single_source since each input produces one output src/engine/SCons/Tool/pdftex.py use tex_eps_emitter call pdf.generate2 to add epstopdf action after the PDFLaTeXAction src/engine/SCons/Tool/dvipdf.py simplify coding that adds the source directory to the search path TEXPICTS src/engine/SCons/Tool/dvips.py Add single_source option since each ps file comes from one dvi file src/engine/SCons/Tool/pdflatex.py add .tex as a valid extension and switch emitters to tex_pdf_emitter src/engine/SCons/Tool/tex.py fix regular expressions ^[^%]* to ^[^%\n]* for multiline environment add REs for \input or \include and \includegraphics get graphics extensions from Scanner.LaTeX so they are defined in one place move modify_env_var to Scanner.LaTeX since it is used there and easier to import it here add FindFile routine to find a file given name, list of suffixes, paths, env returns a node for the file. add tex_eps_emitter and tex_pdf_emitter that call a core routine with a different list of graphics extensions that can be handled by the tool used (latex vs. pdflatex) revamp feature test/suffix list into two lists and build the list used to create sideeffects for each input file... These tests now get applied to each included file so the whole source tree is tested. Get list of paths from env['ENV']['TEXINPUTS'] and env['TEXINPUTS'] if find we need a .pdf file and only have .eps or .ps set up the .pdf as a target with the .eps as source... change emitter to tex_eps_emitter src/engine/SCons/Tool/latex.py add .tex as a valid extension and switch emitters to tex_eps_emitter
Diffstat (limited to 'test/TEX/LATEX2.py')
-rw-r--r--test/TEX/LATEX2.py125
1 files changed, 125 insertions, 0 deletions
diff --git a/test/TEX/LATEX2.py b/test/TEX/LATEX2.py
new file mode 100644
index 0000000..8ef7321
--- /dev/null
+++ b/test/TEX/LATEX2.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Validate that we can produce several .pdf at once from several sources.
+"""
+
+import os
+import os.path
+import string
+import sys
+import TestSCons
+
+_python_ = TestSCons._python_
+
+test = TestSCons.TestSCons()
+
+
+latex = test.where_is('latex')
+
+if latex:
+
+ test.write('SConstruct', """
+import os
+ENV = { 'PATH' : os.environ['PATH'],
+ 'TEXINPUTS' : [ os.environ.get('TEXINPUTS', '') ] }
+foo = Environment(ENV = ENV)
+foo['TEXINPUTS'] = ['subdir',]
+foo.PDF(source = ['foo.ltx','bar.latex','makeindex.tex','latexi.tex'])
+""" % locals())
+
+ latex = r"""
+\documentclass{letter}
+\begin{document}
+This is the %s LaTeX file.
+\end{document}
+"""
+
+ makeindex = r"""
+\documentclass{report}
+\usepackage{makeidx}
+\makeindex
+\begin{document}
+\index{info}
+This is the %s LaTeX file.
+\printindex{}
+\end{document}
+"""
+
+ latex1 = r"""
+\documentclass{report}
+\usepackage{makeidx}
+\input{latexinputfile}
+\begin{document}
+\index{info}
+This is the %s LaTeX file.
+
+It has an Index and includes another file.
+\include{latexincludefile}
+\end{document}
+"""
+
+ latex2 = r"""
+\makeindex
+"""
+
+ latex3 = r"""
+\index{include}
+This is the include file. mod %s
+\printindex{}
+"""
+
+ test.write('foo.ltx', latex % 'foo.ltx')
+
+ test.write('bar.latex', latex % 'bar.latex')
+
+ test.write('makeindex.tex', makeindex % 'makeindex.tex')
+ test.write('makeindex.idx', '')
+
+ test.subdir('subdir')
+ test.write('latexi.tex', latex1 % 'latexi.tex');
+ test.write([ 'subdir', 'latexinputfile'], latex2)
+ test.write([ 'subdir', 'latexincludefile.tex'], latex3 % '1')
+
+ test.run(stderr = None)
+ test.must_not_exist('wrapper.out')
+ test.must_exist('foo.pdf')
+
+ test.must_exist('bar.pdf')
+
+ test.must_exist('latexi.pdf')
+ test.must_exist('latexi.ind')
+
+ test.write([ 'subdir', 'latexincludefile.tex'], latex3 % '2')
+ test.not_up_to_date(arguments = 'latexi.pdf', stderr = None)
+
+ test.run(arguments = '-c', stderr = None)
+ test.must_not_exist('latexi.ind')
+ test.must_not_exist('latexi.ilg')
+
+
+test.pass_test()