summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Managan <managan1@llnl.gov>2012-06-14 17:20:17 (GMT)
committerRobert Managan <managan1@llnl.gov>2012-06-14 17:20:17 (GMT)
commite980f0196884fc57563967f57f5845f4c7274df4 (patch)
tree0b05e2e42ab3613b4869842cfcdda66c47f59f38 /src
parent69ec58de81fae315449b1f6f425526977a7a2699 (diff)
downloadSCons-e980f0196884fc57563967f57f5845f4c7274df4.zip
SCons-e980f0196884fc57563967f57f5845f4c7274df4.tar.gz
SCons-e980f0196884fc57563967f57f5845f4c7274df4.tar.bz2
Add support for the biblatex package; search for new keywards to get side effects and dependencies right
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt1
-rw-r--r--src/engine/SCons/Scanner/LaTeX.py5
-rw-r--r--src/engine/SCons/Tool/tex.py16
3 files changed, 14 insertions, 8 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index f759622..605af5b 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -28,6 +28,7 @@ RELEASE 2.X.X -
From Rob Managan:
- Updated the TeX builder to support LaTeX's multibib package.
+ - Updated the TeX build to support LeTeX's biblatex package.
From Arve Knudsen:
- Test for FORTRANPPFILESUFFIXES (#2129).
diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py
index 2f0b263..2cb1ed5 100644
--- a/src/engine/SCons/Scanner/LaTeX.py
+++ b/src/engine/SCons/Scanner/LaTeX.py
@@ -159,6 +159,9 @@ class LaTeX(SCons.Scanner.Base):
'includegraphics': 'TEXINPUTS',
'bibliography': 'BIBINPUTS',
'bibliographystyle': 'BSTINPUTS',
+ 'addbibresource': 'BIBINPUTS',
+ 'addglobalbib': 'BIBINPUTS',
+ 'addsectionbib': 'BIBINPUTS',
'makeindex': 'INDEXSTYLE',
'usepackage': 'TEXINPUTS',
'lstinputlisting': 'TEXINPUTS'}
@@ -172,7 +175,7 @@ class LaTeX(SCons.Scanner.Base):
# line followed by one or more newline characters (i.e. blank
# lines), interfering with a match on the next line.
# add option for whitespace before the '[options]' or the '{filename}'
- regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage)\s*{([^}]*)}'
+ regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|addbibresource|addglobalbib|addsectionbib|usepackage)\s*{([^}]*)}'
self.cre = re.compile(regex, re.M)
self.comment_re = re.compile(r'^((?:(?:\\%)|[^%\n])*)(.*)$', re.M)
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py
index 0d871ad..83de5bb 100644
--- a/src/engine/SCons/Tool/tex.py
+++ b/src/engine/SCons/Tool/tex.py
@@ -62,7 +62,7 @@ all_suffixes = check_suffixes + ['.bbl', '.idx', '.nlo', '.glo', '.acn']
# or outputs that require rerunning latex
#
# search for all .aux files opened by latex (recorded in the .fls file)
-openout_aux_re = re.compile(r"INPUT *(.*\.aux)")
+openout_aux_re = re.compile(r"OUTPUT *(.*\.aux)")
#printindex_re = re.compile(r"^[^%]*\\printindex", re.MULTILINE)
#printnomenclature_re = re.compile(r"^[^%]*\\printnomenclature", re.MULTILINE)
@@ -87,6 +87,7 @@ makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE)
bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE)
bibunit_re = re.compile(r"^[^%\n]*\\begin\{bibunit\}", re.MULTILINE)
multibib_re = re.compile(r"^[^%\n]*\\newcites\{([^\}]*)\}", re.MULTILINE)
+addbibresource_re = re.compile(r"^[^%\n]*\\(addbibresource|addglobalbib|addsectionbib)", re.MULTILINE)
listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE)
listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE)
hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE)
@@ -317,8 +318,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
result = BibTeXAction(bibfile, bibfile, env)
if result != 0:
check_file_error_message(env['BIBTEX'], 'blg')
- #must_rerun_latex = must_rerun_latex or check_MD5(suffix_nodes['.bbl'],'.bbl')
must_rerun_latex = True
+
# Now decide if latex will need to be run again due to index.
if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and run_makeindex):
# We must run makeindex
@@ -630,6 +631,7 @@ def tex_emitter_core(target, source, env, graphics_extensions):
bibliography_re,
bibunit_re,
multibib_re,
+ addbibresource_re,
tableofcontents_re,
listoffigures_re,
listoftables_re,
@@ -646,6 +648,7 @@ def tex_emitter_core(target, source, env, graphics_extensions):
['.bbl', '.blg','bibliography'],
['.bbl', '.blg','bibunit'],
['.bbl', '.blg','multibib'],
+ ['.bbl', '.blg','addbibresource'],
['.toc','contents'],
['.lof','figures'],
['.lot','tables'],
@@ -698,10 +701,9 @@ def tex_emitter_core(target, source, env, graphics_extensions):
file_list = glob.glob(file_basename)
# remove the suffix '.aux'
for i in range(len(file_list)):
- file_list[i] = SCons.Util.splitext(file_list[i])[0]
+ file_list.append(SCons.Util.splitext(file_list[i])[0])
# for multibib we need a list of files
if suffix_list[-1] == 'multibib':
- file_list = []
for multibibmatch in multibib_re.finditer(content):
if Verbose:
print "multibib match ",multibibmatch.group(1)
@@ -716,14 +718,14 @@ def tex_emitter_core(target, source, env, graphics_extensions):
for suffix in suffix_list[:-1]:
env.SideEffect(file_name + suffix,target[0])
if Verbose:
- print "side effect :",file_name + suffix
+ print "side effect tst :",file_name + suffix, " target is ",str(target[0])
env.Clean(target[0],file_name + 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'
+ print "side effect aux :",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
@@ -736,7 +738,7 @@ def tex_emitter_core(target, source, env, graphics_extensions):
out_files.remove(filename)
env.SideEffect(out_files,target[0])
if Verbose:
- print "side effect :",out_files
+ print "side effect fls :",out_files
env.Clean(target[0],out_files)
return (target, source)