diff options
author | Robert Managan <managan1@llnl.gov> | 2008-09-18 00:13:45 (GMT) |
---|---|---|
committer | Robert Managan <managan1@llnl.gov> | 2008-09-18 00:13:45 (GMT) |
commit | aee3c77a33763e5665d57e2048102416c4172423 (patch) | |
tree | 5f06586f58d6b85e5cbb689a5048b04e1047f061 /test | |
parent | 08aeaa6464771231f4cbe8e53ce75918f2a5222a (diff) | |
download | SCons-aee3c77a33763e5665d57e2048102416c4172423.zip SCons-aee3c77a33763e5665d57e2048102416c4172423.tar.gz SCons-aee3c77a33763e5665d57e2048102416c4172423.tar.bz2 |
Hefty update to the tex tool.
It now iterates until all the warnings are gone and the auxiliary files
stop changing or it hits the max retires limit.
It adds the common auxiliary files to the emitter as sideeffects
Added support for glossaries, nomenclatures, lists of figures,
lists of tables, hyperref, and beamer
The user can entry environment changes like env['TEXINPUTS'] and
they get copied to env['ENV']['TEXINPUTS'] (thanks to Dmitry Mikhin )
It also works with variantdir, duplicate =0
Diffstat (limited to 'test')
-rw-r--r-- | test/TEX/LATEX.py | 12 | ||||
-rw-r--r-- | test/TEX/bibtex-latex-rerun.py | 2 | ||||
-rw-r--r-- | test/TEX/subdir_variantdir_input.py | 128 | ||||
-rw-r--r-- | test/TEX/variant_dir_dup0.py | 77 |
4 files changed, 214 insertions, 5 deletions
diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py index bb034be..34c5d13 100644 --- a/test/TEX/LATEX.py +++ b/test/TEX/LATEX.py @@ -146,7 +146,7 @@ This is the %s LaTeX file. latex1 = r""" \documentclass{report} \usepackage{makeidx} -\makeindex +\input{latexinputfile} \begin{document} \index{info} This is the %s LaTeX file. @@ -157,6 +157,10 @@ It has an Index and includes another file. """ latex2 = r""" +\makeindex +""" + + latex3 = r""" \index{include} This is the include file. \printindex{} @@ -171,7 +175,8 @@ This is the include file. test.subdir('subdir') test.write('latexi.tex', latex1 % 'latexi.tex'); - test.write([ 'subdir', 'latexincludefile.tex'], latex2) + test.write([ 'subdir', 'latexinputfile.tex'], latex2) + test.write([ 'subdir', 'latexincludefile.tex'], latex3) test.run(arguments = 'foo.dvi', stderr = None) test.must_not_exist('wrapper.out') @@ -188,6 +193,9 @@ This is the include file. test.must_exist('latexi.dvi') test.must_exist('latexi.ind') + test.run(arguments = '-c', stderr = None) + test.must_not_exist('latexi.ind') + test.must_not_exist('latexi.ilg') test.pass_test() diff --git a/test/TEX/bibtex-latex-rerun.py b/test/TEX/bibtex-latex-rerun.py index 9191713..bd1fd3b 100644 --- a/test/TEX/bibtex-latex-rerun.py +++ b/test/TEX/bibtex-latex-rerun.py @@ -42,7 +42,7 @@ if not pdflatex: test.skip_test("Could not find pdflatex; skipping test(s).\n") test.write(['SConstruct'], """\ -env = Environment(tools=['pdflatex', 'tex']) +env = Environment(tools=['pdftex', 'tex']) env.PDF( 'bibtest.tex' ) """) diff --git a/test/TEX/subdir_variantdir_input.py b/test/TEX/subdir_variantdir_input.py new file mode 100644 index 0000000..1229032 --- /dev/null +++ b/test/TEX/subdir_variantdir_input.py @@ -0,0 +1,128 @@ +#!/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__" + +""" +Verify that we execute TeX in a subdirectory (if that's where the document +resides) by checking that all the auxiliary files get created there and +not in the top-level directory. Test this when variantDir is used + +Also check that we find files + +Test case courtesy Joel B. Mohler. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +#test.verbose_set(2) + +latex = test.where_is('latex') +if not latex: + test.skip_test("Could not find 'latex'; skipping test.\n") + +pdflatex = test.where_is('pdflatex') +if not pdflatex: + test.skip_test("Could not find 'pdflatex'; skipping test.\n") + +test.subdir('docs') +test.subdir(['docs','sub']) + +test.write('SConstruct', """\ +env = Environment(TOOLS = ['tex', 'pdftex']) + +env.VariantDir('build', 'docs',duplicate=0) +env.SConscript('build/SConscript', exports = ['env']) +""") + +test.write(['docs','SConscript'], """\ +Import('env') + +env.PDF( 'sub/x.tex' ) +env.DVI( 'sub/x.tex' ) +""") + +test.write(['docs','sub', 'x.tex'], +r"""\documentclass{article} +\usepackage{makeidx} +\makeindex +\begin{document} +Hi there. +\index{info} +\input{y} +\printindex{} +\end{document} +""") + +test.write(['docs','sub', 'y.tex'], """\ +Sub-document 1 +""") + +#test.run(arguments = '.') +test.run(arguments = '.', stderr=None, stdout=None) + +test.must_exist(['build', 'sub', 'x.aux']) +test.must_exist(['build', 'sub', 'x.dvi']) +test.must_exist(['build', 'sub', 'x.idx']) +test.must_exist(['build', 'sub', 'x.ilg']) +test.must_exist(['build', 'sub', 'x.ind']) +test.must_exist(['build', 'sub', 'x.log']) +test.must_exist(['build', 'sub', 'x.pdf']) + +test.must_not_exist('x.aux') +test.must_not_exist('x.dvi') +test.must_not_exist('x.idx') +test.must_not_exist('x.ilg') +test.must_not_exist('x.ind') +test.must_not_exist('x.log') +test.must_not_exist('x.pdf') + +test.must_not_exist(['docs', 'x.aux']) +test.must_not_exist(['docs', 'x.dvi']) +test.must_not_exist(['docs', 'x.idx']) +test.must_not_exist(['docs', 'x.ilg']) +test.must_not_exist(['docs', 'x.ind']) +test.must_not_exist(['docs', 'x.log']) +test.must_not_exist(['docs', 'x.pdf']) + +test.must_not_exist(['docs', 'sub', 'x.aux']) +test.must_not_exist(['docs', 'sub', 'x.dvi']) +test.must_not_exist(['docs', 'sub', 'x.idx']) +test.must_not_exist(['docs', 'sub', 'x.ilg']) +test.must_not_exist(['docs', 'sub', 'x.ind']) +test.must_not_exist(['docs', 'sub', 'x.log']) +test.must_not_exist(['docs', 'sub', 'x.pdf']) + +test.up_to_date(arguments = '.', stderr=None, stdout=None) + +test.write(['docs','sub', 'y.tex'], """\ +Sub-document 2 +""") + +test.not_up_to_date(arguments = '.') +#test.up_to_date(arguments = '.', stderr=None, stdout=None) + +test.pass_test() diff --git a/test/TEX/variant_dir_dup0.py b/test/TEX/variant_dir_dup0.py index c37a13b..b03e89c 100644 --- a/test/TEX/variant_dir_dup0.py +++ b/test/TEX/variant_dir_dup0.py @@ -28,6 +28,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test creation of a fully-featured TeX document (with bibliography and index) in a variant_dir. +Also test that the target can be named differently than what +Latex produces by default. + Test courtesy Rob Managan. """ @@ -62,7 +65,9 @@ test.write(['docs', 'SConscript'], """\ Import('env') test_dvi = env.DVI(source='test.tex') -testpdf = env.PDF(source=test_dvi) +test2_dvi = env.DVI(target='result',source='test2.tex') +testpdf = env.PDF(target='pdfoutput',source=test_dvi) +test2pdf = env.PDF(target='pdfoutput.xyz',source=test2_dvi) """) @@ -228,6 +233,63 @@ All done now. \end{document} """) +test.write(['docs', 'test2.tex'], +r"""\documentclass{report} + +\usepackage{graphicx} +\usepackage{epsfig,color} % for .tex version of figures if we go that way + +\usepackage{makeidx} +\makeindex + +\begin{document} + +\title{Report Title} + +\author{A. N. Author} + +\maketitle + +\begin{abstract} +there is no abstract +\end{abstract} + +\tableofcontents +\listoffigures + +\chapter{Introduction} + +The introduction is short. + +\index{Acknowledgements} + +\section{Acknowledgements} + +The Acknowledgements are show as well \cite{AnAuthor:2006fk}. + +\index{Getting the Report} + +To get a hard copy of this report call me. + +\begin{figure}[htbp] +\begin{center} +\input{Fig1.tex} % testing figure variant that uses TeX labeling +\caption{Zone and Node indexing} +\label{fig1} +\end{center} +\end{figure} + +All done now. + +\bibliographystyle{unsrt} +\bibliography{test} +\newpage + +\printindex + +\end{document} +""") + # makeindex will write status messages to stderr (grrr...), so ignore it. test.run(arguments = '.', stderr=None) @@ -245,8 +307,19 @@ files = [ 'test.ind', 'test.lof', 'test.log', - 'test.pdf', 'test.toc', + 'test2.aux', + 'test2.bbl', + 'test2.blg', + 'test2.idx', + 'test2.ilg', + 'test2.ind', + 'test2.lof', + 'test2.log', + 'test2.toc', + 'result.dvi', + 'pdfoutput.pdf', + 'pdfoutput.xyz' ] for f in files: |