diff options
author | Steven Knight <knight@baldmt.com> | 2005-11-07 03:44:30 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-11-07 03:44:30 (GMT) |
commit | 9c10969e399eeef7bbeed949a66f3c7a543c18cf (patch) | |
tree | 57c19a423016e8fdddbb3b697eaacfd81d24063c /src/engine/SCons/Tool/pdftex.py | |
parent | 6e913271bb52eb06a4221f008325ecbb5fde450a (diff) | |
download | SCons-9c10969e399eeef7bbeed949a66f3c7a543c18cf.zip SCons-9c10969e399eeef7bbeed949a66f3c7a543c18cf.tar.gz SCons-9c10969e399eeef7bbeed949a66f3c7a543c18cf.tar.bz2 |
Make all relevant builders of .tex and .ltx files consistent with respect to handling generating bibliographies and re-running LaTeX to resolve undefined references. (Joel B. Mohler) Add a $LATEXRETRIES to configure the number of undefined reference re-runs.
Diffstat (limited to 'src/engine/SCons/Tool/pdftex.py')
-rw-r--r-- | src/engine/SCons/Tool/pdftex.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 92a622a..6606f0d 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -36,9 +36,30 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action import SCons.Defaults import SCons.Util +import SCons.Tool.tex PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') +# Define an action to build a latex file. This action might be needed more +# than once if we are dealing with labels and bibtex +PDFLaTeXAction = SCons.Action.Action("$PDFLATEXCOM", "$PDFLATEXCOMSTR") + +def PDFLaTeXAuxAction(target = None, source= None, env=None): + SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + +def PDFTeXLaTeXFunction(target = None, source= None, env=None): + """A builder for TeX and LaTeX that scans the source file to + decide the "flavor" of the source and then executes the appropriate + program.""" + if SCons.Tool.tex.is_LaTeX(source): + PDFLaTeXAuxAction(target,source,env) + else: + PDFTeXAction(target,source,env) + return 0 + +PDFTeXLaTeXAction = SCons.Action.Action(PDFTeXLaTeXFunction, + strfunction=None) + def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" try: @@ -47,11 +68,21 @@ def generate(env): bld = SCons.Defaults.PDF() env['BUILDERS']['PDF'] = bld - bld.add_action('.tex', PDFTeXAction) + bld.add_action('.tex', PDFTeXLaTeXAction) env['PDFTEX'] = 'pdftex' env['PDFTEXFLAGS'] = SCons.Util.CLVar('') env['PDFTEXCOM'] = '$PDFTEX $PDFTEXFLAGS $SOURCE' + # Duplicate from latex.py. If latex.py goes away, then this is still OK. + env['PDFLATEX'] = 'pdflatex' + env['PDFLATEXFLAGS'] = SCons.Util.CLVar('') + env['PDFLATEXCOM'] = '$PDFLATEX $PDFLATEXFLAGS $SOURCES' + env['LATEXRETRIES'] = 3 + + env['BIBTEX'] = 'bibtex' + env['BIBTEXFLAGS'] = SCons.Util.CLVar('') + env['BIBTEXCOM'] = '$BIBTEX $BIBTEXFLAGS $SOURCES' + def exists(env): return env.Detect('pdftex') |