summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/tex.py
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-01-23 15:07:01 +0100
committerLuca Falavigna <dktrkranz@debian.org>2010-01-23 15:07:01 +0100
commit5d815f9314d2a12f7e92e9cec33f0a9cf6b14883 (patch)
tree1db5deb3a8e5075d9a8abe3aae576ae00bab8e56 /engine/SCons/Tool/tex.py
parentbb7273665583fda5d0ddb30e969718984ea4c205 (diff)
parent7764805dd1d4df1cf1bdfe2ad1f2e130d91f515a (diff)
Merge commit 'upstream/1.2.0.d20100117'
Diffstat (limited to 'engine/SCons/Tool/tex.py')
-rw-r--r--engine/SCons/Tool/tex.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/engine/SCons/Tool/tex.py b/engine/SCons/Tool/tex.py
index 664b8ab..763a7a1 100644
--- a/engine/SCons/Tool/tex.py
+++ b/engine/SCons/Tool/tex.py
@@ -10,7 +10,7 @@ selection method.
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/tex.py 4577 2009/12/27 19:43:56 scons"
+__revision__ = "src/engine/SCons/Tool/tex.py 4629 2010/01/17 22:23:21 scons"
import os.path
import re
@@ -94,6 +94,7 @@ beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE)
# search to find all files included by Latex
include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE)
+includeOnly_re = re.compile(r'^[^%\n]*\\(?:include){([^}]*)}', re.MULTILINE)
# search to find all graphics files included by Latex
includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE)
@@ -530,7 +531,7 @@ def tex_pdf_emitter(target, source, env):
return (target, source)
-def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir):
+def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files):
""" For theFile (a Node) update any file_tests and search for graphics files
then find all included files and call ScanFiles recursively for each of them"""
@@ -542,6 +543,11 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi
if file_tests[i][0] is None:
file_tests[i][0] = file_tests_search[i].search(content)
+ incResult = includeOnly_re.search(content)
+ if incResult:
+ aux_files.append(os.path.join(targetdir, incResult.group(1)))
+ if Verbose:
+ print "\include file names : ", aux_files
# recursively call this on each of the included files
inc_files = [ ]
inc_files.extend( include_re.findall(content) )
@@ -553,7 +559,7 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi
for src in inc_files:
srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False)
if srcNode is not None:
- file_tests = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir)
+ file_tests = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files)
if Verbose:
print " done scanning ",str(theFile)
return file_tests
@@ -655,7 +661,8 @@ def tex_emitter_core(target, source, env, graphics_extensions):
if Verbose:
print "search path ",paths
- file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir)
+ aux_files = []
+ file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files)
for (theSearch,suffix_list) in file_tests:
if theSearch:
@@ -665,6 +672,12 @@ def tex_emitter_core(target, source, env, graphics_extensions):
print "side effect :",targetbase + suffix
env.Clean(target[0],targetbase + suffix)
+ for aFile in aux_files:
+ aFile_base = SCons.Util.splitext(aFile)[0]
+ env.SideEffect(aFile_base + '.aux',target[0])
+ if Verbose:
+ print "side effect :",aFile_base + '.aux'
+ env.Clean(target[0],aFile_base + '.aux')
# read fls file to get all other files that latex creates and will read on the next pass
# remove files from list that we explicitly dealt with above
if os.path.exists(flsfilename):