From 069ce5a194b250c09667606c2e926747f5f083aa Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Wed, 22 Jul 2009 04:56:52 +0000 Subject: Update tex builder to use the -recorder option. This was prompted because MikTeX, used on Windows, does not put the same information on files opened into the log file. The -recorder option gives a .fls file that is the same on all platforms. We still use the .log file contents to find warnings and errors that mean we need to rerun latex... Also add message about errors so user does not have to scroll up through all the latex output to find if there was an error. Update all tests to handle the new command line option. Add one more test on grpahics conversion. --- src/engine/SCons/Tool/latex.py | 4 +- src/engine/SCons/Tool/pdflatex.py | 4 +- src/engine/SCons/Tool/pdftex.py | 8 +- src/engine/SCons/Tool/tex.py | 51 ++++++++--- test/DVIPDF/DVIPDF.py | 6 +- test/DVIPDF/DVIPDFFLAGS.py | 4 +- test/DVIPS/DVIPS.py | 4 +- test/DVIPS/DVIPSFLAGS.py | 4 +- test/TEX/LATEX.py | 2 +- test/TEX/PDFLATEX.py | 2 +- test/TEX/PDFTEX.py | 2 +- test/TEX/TEX.py | 4 +- test/TEX/dryrun.py | 2 +- test/TEX/eps_graphics2.py | 188 ++++++++++++++++++++++++++++++++++++++ 14 files changed, 253 insertions(+), 32 deletions(-) create mode 100644 test/TEX/eps_graphics2.py diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py index 234d3c0..36c4fd2 100644 --- a/src/engine/SCons/Tool/latex.py +++ b/src/engine/SCons/Tool/latex.py @@ -44,6 +44,8 @@ LaTeXAction = None def LaTeXAuxFunction(target = None, source= None, env=None): result = SCons.Tool.tex.InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + if result != 0: + print env['LATEX']," returned an error, check the log file" return result LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction, @@ -68,7 +70,7 @@ def generate(env): bld.add_emitter('.latex', SCons.Tool.tex.tex_eps_emitter) env['LATEX'] = 'latex' - env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['LATEXCOM'] = 'cd ${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' env['LATEXRETRIES'] = 3 diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py index 6c37b46..81bdcd5 100644 --- a/src/engine/SCons/Tool/pdflatex.py +++ b/src/engine/SCons/Tool/pdflatex.py @@ -42,6 +42,8 @@ PDFLaTeXAction = None def PDFLaTeXAuxFunction(target = None, source= None, env=None): result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + if result != 0: + print env['PDFLATEX']," returned an error, check the log file" return result PDFLaTeXAuxAction = None @@ -67,7 +69,7 @@ def generate(env): bld.add_emitter('.latex', SCons.Tool.tex.tex_pdf_emitter) env['PDFLATEX'] = 'pdflatex' - env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' env['LATEXRETRIES'] = 3 diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 308cb71..fc09bf4 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -53,8 +53,12 @@ def PDFTeXLaTeXFunction(target = None, source= None, env=None): program.""" if SCons.Tool.tex.is_LaTeX(source): result = PDFLaTeXAuxAction(target,source,env) + if result != 0: + print env['PDFLATEX']," returned an error, check the log file" else: result = PDFTeXAction(target,source,env) + if result != 0: + print env['PDFTEX']," returned an error, check the log file" return result PDFTeXLaTeXAction = None @@ -86,12 +90,12 @@ def generate(env): pdf.generate2(env) env['PDFTEX'] = 'pdftex' - env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFTEXCOM'] = 'cd ${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}' # Duplicate from latex.py. If latex.py goes away, then this is still OK. env['PDFLATEX'] = 'pdflatex' - env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' env['LATEXRETRIES'] = 3 diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 3473f8b..e1ecd81 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -58,8 +58,8 @@ all_suffixes = check_suffixes + ['.bbl', '.idx', '.nlo', '.glo'] # regular expressions used to search for Latex features # or outputs that require rerunning latex # -# search for all .aux files opened by latex (recorded in the .log file) -openout_aux_re = re.compile(r"\\openout.*`(.*\.aux)'") +# search for all .aux files opened by latex (recorded in the .fls file) +openout_aux_re = re.compile(r"INPUT *(.*\.aux)") #printindex_re = re.compile(r"^[^%]*\\printindex", re.MULTILINE) #printnomenclature_re = re.compile(r"^[^%]*\\printnomenclature", re.MULTILINE) @@ -96,7 +96,7 @@ include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE) includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE) # search to find all files opened by Latex (recorded in .log file) -openout_re = re.compile(r"\\openout.*`(.*)'") +openout_re = re.compile(r"OUTPUT *(.*)") # list of graphics file extensions for TeX and LaTeX TexGraphics = SCons.Scanner.LaTeX.TexGraphics @@ -256,13 +256,22 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None must_rerun_latex = False # Decide if various things need to be run, or run again. - # Read the log file to find all .aux files + # Read the log file to find warnings/errors logfilename = targetbase + '.log' logContent = '' - auxfiles = [] if os.path.exists(logfilename): logContent = open(logfilename, "rb").read() - auxfiles = openout_aux_re.findall(logContent) + + + # Read the fls file to find all .aux files + flsfilename = targetbase + '.fls' + flsContent = '' + auxfiles = [] + if os.path.exists(flsfilename): + flsContent = open(flsfilename, "rb").read() + auxfiles = openout_aux_re.findall(flsContent) + if Verbose: + print "auxfiles ",auxfiles # Now decide if bibtex will need to be run. # The information that bibtex reads from the .aux file is @@ -280,6 +289,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None bibfile = env.fs.File(targetbase) result = BibTeXAction(bibfile, bibfile, env) if result != 0: + print env['BIBTEX']," returned an error, check the blg file" return result must_rerun_latex = check_MD5(suffix_nodes['.bbl'],'.bbl') break @@ -292,6 +302,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None idxfile = suffix_nodes['.idx'] result = MakeIndexAction(idxfile, idxfile, env) if result != 0: + print env['MAKEINDEX']," returned an error, check the ilg file" return result # TO-DO: need to add a way for the user to extend this list for whatever @@ -309,6 +320,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None nclfile = suffix_nodes['.nlo'] result = MakeNclAction(nclfile, nclfile, env) if result != 0: + print env['MAKENCL']," (nomenclature) returned an error, check the nlg file" return result # Now decide if latex will need to be run again due to glossary. @@ -319,6 +331,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None glofile = suffix_nodes['.glo'] result = MakeGlossaryAction(glofile, glofile, env) if result != 0: + print env['MAKEGLOSSARY']," (glossary) returned an error, check the glg file" return result # Now decide if latex needs to be run yet again to resolve warnings. @@ -388,8 +401,12 @@ def TeXLaTeXFunction(target = None, source= None, env=None): program.""" if is_LaTeX(source): result = LaTeXAuxAction(target,source,env) + if result != 0: + print env['LATEX']," returned an error, check the log file" else: result = TeXAction(target,source,env) + if result != 0: + print env['TEX']," returned an error, check the log file" return result def TeXLaTeXStrFunction(target = None, source= None, env=None): @@ -456,7 +473,7 @@ def tex_emitter_core(target, source, env, graphics_extensions): are needed on subsequent runs of latex to finish tables of contents, bibliographies, indices, lists of figures, and hyperlink references. """ - targetbase = SCons.Util.splitext(str(target[0]))[0] + targetbase, targetext = SCons.Util.splitext(str(target[0])) basename = SCons.Util.splitext(str(source[0]))[0] basefile = os.path.split(str(basename))[1] @@ -471,11 +488,14 @@ def tex_emitter_core(target, source, env, graphics_extensions): emit_suffixes = ['.aux', '.log', '.ilg', '.blg', '.nls', '.nlg', '.gls', '.glg'] + all_suffixes auxfilename = targetbase + '.aux' logfilename = targetbase + '.log' + flsfilename = targetbase + '.fls' env.SideEffect(auxfilename,target[0]) env.SideEffect(logfilename,target[0]) + env.SideEffect(flsfilename,target[0]) env.Clean(target[0],auxfilename) env.Clean(target[0],logfilename) + env.Clean(target[0],flsfilename) content = source[0].get_text_contents() @@ -545,10 +565,15 @@ def tex_emitter_core(target, source, env, graphics_extensions): env.SideEffect(targetbase + suffix,target[0]) env.Clean(target[0],targetbase + suffix) - # read log file to get all other files that latex creates and will read on the next pass - if os.path.exists(logfilename): - content = open(logfilename, "rb").read() + # read fls file to get all other files that latex creates and will read on the next pass + if os.path.exists(flsfilename): + content = open(flsfilename, "rb").read() out_files = openout_re.findall(content) + mysuffixes = ['.log' , '.fls' , targetext] + for filename in out_files: + base,ext = SCons.Util.splitext(filename) + if ext in mysuffixes: + out_files.remove(filename) env.SideEffect(out_files,target[0]) env.Clean(target[0],out_files) @@ -604,12 +629,12 @@ def generate(env): bld.add_emitter('.tex', tex_eps_emitter) env['TEX'] = 'tex' - env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['TEXCOM'] = 'cd ${TARGET.dir} && $TEX $TEXFLAGS ${SOURCE.file}' # Duplicate from latex.py. If latex.py goes away, then this is still OK. env['LATEX'] = 'latex' - env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['LATEXCOM'] = 'cd ${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' env['LATEXRETRIES'] = 3 @@ -633,7 +658,7 @@ def generate(env): # Duplicate from pdflatex.py. If latex.py goes away, then this is still OK. env['PDFLATEX'] = 'pdflatex' - env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode') + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' def exists(env): diff --git a/test/DVIPDF/DVIPDF.py b/test/DVIPDF/DVIPDF.py index b366152..7b3e292 100644 --- a/test/DVIPDF/DVIPDF.py +++ b/test/DVIPDF/DVIPDF.py @@ -38,7 +38,7 @@ test.write('mytex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') @@ -52,7 +52,7 @@ test.write('mylatex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') @@ -66,7 +66,7 @@ test.write('mydvipdf.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) infile = open(arg[0], 'rb') out_file = open(arg[1], 'wb') for l in infile.readlines(): diff --git a/test/DVIPDF/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py index 3d7bc72..93a435f 100644 --- a/test/DVIPDF/DVIPDFFLAGS.py +++ b/test/DVIPDF/DVIPDFFLAGS.py @@ -38,7 +38,7 @@ test.write('mytex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') @@ -52,7 +52,7 @@ test.write('mylatex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') diff --git a/test/DVIPS/DVIPS.py b/test/DVIPS/DVIPS.py index 7d32c97..540869d 100644 --- a/test/DVIPS/DVIPS.py +++ b/test/DVIPS/DVIPS.py @@ -38,7 +38,7 @@ test.write('mytex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') @@ -52,7 +52,7 @@ test.write('mylatex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') diff --git a/test/DVIPS/DVIPSFLAGS.py b/test/DVIPS/DVIPSFLAGS.py index 61d247a..a5be0a2 100644 --- a/test/DVIPS/DVIPSFLAGS.py +++ b/test/DVIPS/DVIPSFLAGS.py @@ -38,7 +38,7 @@ test.write('mytex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') @@ -52,7 +52,7 @@ test.write('mylatex.py', r""" import os import sys import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') out_file = open(base_name+'.dvi', 'wb') diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py index fff98df..2316770 100644 --- a/test/TEX/LATEX.py +++ b/test/TEX/LATEX.py @@ -44,7 +44,7 @@ test.write('mylatex.py', r""" import sys import os import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') dvi_file = open(base_name+'.dvi', 'wb') diff --git a/test/TEX/PDFLATEX.py b/test/TEX/PDFLATEX.py index a7e68aa..a7320a1 100644 --- a/test/TEX/PDFLATEX.py +++ b/test/TEX/PDFLATEX.py @@ -44,7 +44,7 @@ test.write('mypdflatex.py', r""" import sys import os import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') pdf_file = open(base_name+'.pdf', 'wb') diff --git a/test/TEX/PDFTEX.py b/test/TEX/PDFTEX.py index 1562b20..e9b547d 100644 --- a/test/TEX/PDFTEX.py +++ b/test/TEX/PDFTEX.py @@ -44,7 +44,7 @@ test.write('mypdftex.py', r""" import sys import os import getopt -cmd_opts, arg = getopt.getopt(sys.argv[2:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[2:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') pdf_file = open(base_name+'.pdf', 'wb') diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py index 99a69fe..58ec40d 100644 --- a/test/TEX/TEX.py +++ b/test/TEX/TEX.py @@ -44,7 +44,7 @@ test.write('mytex.py', r""" import sys import os import getopt -cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:', []) +cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', []) base_name = os.path.splitext(arg[0])[0] infile = open(arg[0], 'rb') dvi_file = open(base_name+'.dvi', 'wb') @@ -175,7 +175,7 @@ Run \texttt{latex}, then \texttt{bibtex}, then \texttt{latex} twice again \cite{ test.run(stderr = None) output_lines = string.split(test.stdout(), '\n') - reruns = filter(lambda x: string.find(x, 'latex -interaction=nonstopmode rerun.tex') != -1, output_lines) + reruns = filter(lambda x: string.find(x, 'latex -interaction=nonstopmode -recorder rerun.tex') != -1, output_lines) if len(reruns) != 2: print "Expected 2 latex calls, got %s:" % len(reruns) print string.join(reruns, '\n') diff --git a/test/TEX/dryrun.py b/test/TEX/dryrun.py index adbc0b6..3764426 100644 --- a/test/TEX/dryrun.py +++ b/test/TEX/dryrun.py @@ -56,7 +56,7 @@ This is the foo.ltx file. """) test.run(arguments = '--dry-run', stdout = test.wrap_stdout("""\ -cd . && latex -interaction=nonstopmode foo.ltx ... +cd . && latex -interaction=nonstopmode -recorder foo.ltx ... """), stderr = None) diff --git a/test/TEX/eps_graphics2.py b/test/TEX/eps_graphics2.py new file mode 100644 index 0000000..d291b0b --- /dev/null +++ b/test/TEX/eps_graphics2.py @@ -0,0 +1,188 @@ +#!/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 Tex document with nested includes in a +subdir that needs to create a fig.pdf. +Test creation with pdflatex + +Test courtesy Rob Managan. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') +epstopdf = test.where_is('epstopdf') +if not latex: + test.skip_test("Could not find 'latex'; skipping test.\n") + +if not epstopdf: + test.skip_test("Could not find 'epstopdf'; skipping test.\n") + +test.subdir(['docs']) + + +test.write(['SConstruct'], """\ +import os + +env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) + +env.PDF('docs/Fig1.eps') +test = env.PDF(source='docs/test.tex') +""") + + +test.write(['docs','Fig1.eps'], """\ +%!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 defThe Oxygen Isotopic Composition of Captured Solar Wind: First Results from the GENESIS Mission +/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(['docs','test.tex'], +r"""\documentclass{report} + +\usepackage{graphicx} +\usepackage{epsfig,color} % for .tex version of figures if we go that way + +\begin{document} + +\title{Report Title} + +\author{A. N. Author} + +\maketitle + +\begin{abstract} +there is no abstract +\end{abstract} + +\chapter{Introduction} + +The introduction is short. + +\section{Acknowledgements} + +The Acknowledgements are shown as well. + +To get a hard copy of this report call me. + +\begin{figure}[htbp] +\begin{center} +\includegraphics{Fig1} +\caption{Zone and Node indexing} +\label{fig1} +\end{center} +\end{figure} + +All done now. + +\end{document} +""") + +# makeindex will write status messages to stderr (grrr...), so ignore it. +test.run(arguments = '.', stderr=None) + + +# All (?) the files we expect will get created in the docs directory +files = [ + 'docs/test.aux', + 'docs/test.log', + 'docs/test.pdf', +] + +for f in files: + test.must_exist([ f]) + +#test.must_not_exist(['docs/Fig1.pdf',]) + +test.pass_test() -- cgit v0.12