summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/TEX/LATEX.py9
-rw-r--r--test/TEX/LATEX2.py125
-rw-r--r--test/TEX/PDF_single_source.py137
3 files changed, 268 insertions, 3 deletions
diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py
index 34c5d13..d80636f 100644
--- a/test/TEX/LATEX.py
+++ b/test/TEX/LATEX.py
@@ -162,7 +162,7 @@ It has an Index and includes another file.
latex3 = r"""
\index{include}
-This is the include file.
+This is the include file. mod %s
\printindex{}
"""
@@ -175,8 +175,8 @@ This is the include file.
test.subdir('subdir')
test.write('latexi.tex', latex1 % 'latexi.tex');
- test.write([ 'subdir', 'latexinputfile.tex'], latex2)
- test.write([ 'subdir', 'latexincludefile.tex'], latex3)
+ test.write([ 'subdir', 'latexinputfile'], latex2)
+ test.write([ 'subdir', 'latexincludefile.tex'], latex3 % '1')
test.run(arguments = 'foo.dvi', stderr = None)
test.must_not_exist('wrapper.out')
@@ -193,6 +193,9 @@ This is the include file.
test.must_exist('latexi.dvi')
test.must_exist('latexi.ind')
+ test.write([ 'subdir', 'latexincludefile.tex'], latex3 % '2')
+ test.not_up_to_date(arguments = 'latexi.dvi', stderr = None)
+
test.run(arguments = '-c', stderr = None)
test.must_not_exist('latexi.ind')
test.must_not_exist('latexi.ilg')
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()
diff --git a/test/TEX/PDF_single_source.py b/test/TEX/PDF_single_source.py
new file mode 100644
index 0000000..5d46605
--- /dev/null
+++ b/test/TEX/PDF_single_source.py
@@ -0,0 +1,137 @@
+#!/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__"
+
+"""
+Test creation of a mulitple pdf's from a list of PostScript files.
+
+Test courtesy Rob Managan.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+epstopdf = test.where_is('epstopdf')
+if not epstopdf:
+ test.skip_test("Could not find 'epstopdf'; skipping test.\n")
+
+
+test.write(['SConstruct'], """\
+import os
+
+env = Environment(ENV = { 'PATH' : os.environ['PATH'] })
+
+env.PDF(['Fig1.ps','Fig3.ps','Fig2.ps'])
+""")
+
+
+figure = """\
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: Fig1.fig
+%%Creator: fig2dev Version 3.2 Patchlevel 4
+%%CreationDate: Tue Apr 25 09:56:11 2006
+%%For: managan@mangrove.llnl.gov (Rob Managan)
+%%BoundingBox: 0 0 98 98
+%%Magnification: 1.0000
+%%EndComments
+/$F2psDict 200 dict def
+$F2psDict begin
+$F2psDict /mtrx matrix put
+/col-1 {0 setgray} bind def
+/col0 {0.000 0.000 0.000 srgb} bind def
+
+end
+save
+newpath 0 98 moveto 0 0 lineto 98 0 lineto 98 98 lineto closepath clip newpath
+-24.9 108.2 translate
+1 -1 scale
+
+/cp {closepath} bind def
+/ef {eofill} bind def
+/gr {grestore} bind def
+/gs {gsave} bind def
+/rs {restore} bind def
+/l {lineto} bind def
+/m {moveto} bind def
+/rm {rmoveto} bind def
+/n {newpath} bind def
+/s {stroke} bind def
+/slc {setlinecap} bind def
+/slj {setlinejoin} bind def
+/slw {setlinewidth} bind def
+/srgb {setrgbcolor} bind def
+/sc {scale} bind def
+/sf {setfont} bind def
+/scf {scalefont} bind def
+/tr {translate} bind def
+ /DrawEllipse {
+ /endangle exch def
+ /startangle exch def
+ /yrad exch def
+ /xrad exch def
+ /y exch def
+ /x exch def
+ /savematrix mtrx currentmatrix def
+ x y tr xrad yrad sc 0 0 1 startangle endangle arc
+ closepath
+ savematrix setmatrix
+ } def
+
+/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
+/$F2psEnd {$F2psEnteredState restore end} def
+
+$F2psBegin
+10 setmiterlimit
+ 0.06299 0.06299 sc
+%
+% Fig objects follow
+%
+7.500 slw
+% Ellipse
+n 1170 945 766 766 0 360 DrawEllipse gs col0 s gr
+
+$F2psEnd
+rs
+"""
+test.write('Fig1.ps',figure )
+test.write('Fig2.ps',figure )
+test.write('Fig3.ps',figure )
+
+
+test.run(arguments = '.', stderr=None)
+
+
+files = [
+ 'Fig1.pdf',
+ 'Fig2.pdf',
+ 'Fig3.pdf',
+]
+
+for f in files:
+ test.must_exist(f)
+
+
+test.pass_test()