From e04fb604484cf37da383a38ef9b2bd8c9ef6c175 Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Fri, 9 Jan 2009 01:06:54 +0000 Subject: Remove the feature that would build .pdf graphics files from .eps files for the pdf latex builder That is if the .tex file has "\includegraphics{figure1}" and the file figure1.eps then when using the .DVI builder latex will find the file and all is fine. However, when using the .PDF builder pdflatex can not process .eps files and will fail. After this patch the user will need to add env.PDF('figure1.eps') Update two tests that used the old feature and would fail otherwise I could not come up with a way to test for a feature that is removed. That is, I can write a test that works before the update and fails after but not the other way around. --- src/engine/SCons/Scanner/LaTeX.py | 3 +++ src/engine/SCons/Tool/tex.py | 31 +++++-------------------------- test/TEX/multiple_include.py | 1 + test/TEX/multiple_include_subdir.py | 1 + 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index db7f555..a96c279 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -251,6 +251,9 @@ class LaTeX(SCons.Scanner.Base): base, ext = os.path.splitext( filename ) if ext == "": #TODO(1.5) return [filename + e for e in self.graphics_extensions] + #return map(lambda e, f=filename: f+e, self.graphics_extensions + TexGraphics) + # use the line above to find dependency for PDF builder when only .eps figure is present + # Since it will be found if the user tell scons how to make the pdf figure leave it out for now. return map(lambda e, f=filename: f+e, self.graphics_extensions) return [filename] diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 15e2d3e..1e78bb5 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -128,7 +128,10 @@ modify_env_var = SCons.Scanner.LaTeX.modify_env_var def FindFile(name,suffixes,paths,env,requireExt=False): if requireExt: - name = SCons.Util.splitext(name)[0] + name,ext = SCons.Util.splitext(name) + # if the user gave an extension use it. + if ext: + name = name + ext if Verbose: print " searching for '%s' with extensions: " % name,suffixes @@ -178,6 +181,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None basedir = os.path.split(str(source[0]))[0] basefile = os.path.split(str(basename))[1] abspath = os.path.abspath(basedir) + targetext = os.path.splitext(str(target[0]))[1] targetdir = os.path.split(str(target[0]))[0] @@ -430,31 +434,6 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi if file_tests[i][0] == None: file_tests[i][0] = file_tests_search[i].search(content) - # For each file see if any graphics files are included - # and set up target to create ,pdf graphic - # is this is in pdflatex toolchain - graphic_files = includegraphics_re.findall(content) - if Verbose: - print "graphics files in '%s': "%str(theFile),graphic_files - for graphFile in graphic_files: - graphicNode = FindFile(graphFile,graphics_extensions,paths,env,requireExt=True) - # if building with pdflatex see if we need to build the .pdf version of the graphic file - # I should probably come up with a better way to tell which builder we are using. - if graphics_extensions == LatexGraphics: - # see if we can build this graphics file by epstopdf - graphicSrc = FindFile(graphFile,TexGraphics,paths,env,requireExt=True) - # it seems that FindFile checks with no extension added - # so if the extension is included in the name then both searches find it - # we don't want to try to build a .pdf from a .pdf so make sure src!=file wanted - if (graphicSrc != None) and (graphicSrc != graphicNode): - if Verbose: - if graphicNode == None: - print "need to build '%s' by epstopdf %s -o %s" % (graphFile,graphicSrc,graphFile) - else: - print "no need to build '%s', but source file %s exists" % (graphicNode,graphicSrc) - graphicNode = env.PDF(graphicSrc) - env.Depends(target[0],graphicNode) - # recursively call this on each of the included files inc_files = [ ] inc_files.extend( include_re.findall(content) ) diff --git a/test/TEX/multiple_include.py b/test/TEX/multiple_include.py index 2b3cfe0..acace43 100644 --- a/test/TEX/multiple_include.py +++ b/test/TEX/multiple_include.py @@ -51,6 +51,7 @@ import os env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) +env.PDF('Fig1.ps') test = env.PDF(source='test.tex') """) diff --git a/test/TEX/multiple_include_subdir.py b/test/TEX/multiple_include_subdir.py index d78394c..8f61465 100644 --- a/test/TEX/multiple_include_subdir.py +++ b/test/TEX/multiple_include_subdir.py @@ -51,6 +51,7 @@ import os env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) +env.PDF('docs/Fig1.eps') test = env.PDF(source='docs/test.tex') """) -- cgit v0.12