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]
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
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]
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) )