summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Tool/latex.py13
-rw-r--r--src/engine/SCons/Tool/pdflatex.py6
-rw-r--r--src/engine/SCons/Tool/pdftex.py11
-rw-r--r--src/engine/SCons/Tool/tex.py54
4 files changed, 38 insertions, 46 deletions
diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py
index 8712d74..90adbab 100644
--- a/src/engine/SCons/Tool/latex.py
+++ b/src/engine/SCons/Tool/latex.py
@@ -1,6 +1,7 @@
"""SCons.Tool.latex
Tool-specific initialization for LaTeX.
+Generates .dvi files from .latex or .ltx files
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
@@ -40,10 +41,8 @@ import SCons.Util
import SCons.Tool
import SCons.Tool.tex
-LaTeXAction = None
-
def LaTeXAuxFunction(target = None, source= None, env=None):
- result = SCons.Tool.tex.InternalLaTeXAuxAction( LaTeXAction, target, source, env )
+ result = SCons.Tool.tex.InternalLaTeXAuxAction( SCons.Tool.tex.LaTeXAction, target, source, env )
if result != 0:
print env['LATEX']," returned an error, check the log file"
return result
@@ -53,9 +52,6 @@ LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction,
def generate(env):
"""Add Builders and construction variables for LaTeX to an Environment."""
- global LaTeXAction
- if LaTeXAction is None:
- LaTeXAction = SCons.Action.Action('$LATEXCOM', '$LATEXCOMSTR')
env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)
@@ -71,10 +67,7 @@ def generate(env):
bld.add_emitter('.ltx', SCons.Tool.tex.tex_eps_emitter)
bld.add_emitter('.latex', SCons.Tool.tex.tex_eps_emitter)
- env['LATEX'] = 'latex'
- env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
- env['LATEXCOM'] = 'cd ${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}'
- env['LATEXRETRIES'] = 3
+ SCons.Tool.tex.generate_common(env)
def exists(env):
return env.Detect('latex')
diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py
index c4a8264..167de51 100644
--- a/src/engine/SCons/Tool/pdflatex.py
+++ b/src/engine/SCons/Tool/pdflatex.py
@@ -1,6 +1,7 @@
"""SCons.Tool.pdflatex
Tool-specific initialization for pdflatex.
+Generates .pdf files from .latex or .ltx files
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
@@ -70,10 +71,7 @@ def generate(env):
bld.add_emitter('.ltx', SCons.Tool.tex.tex_pdf_emitter)
bld.add_emitter('.latex', SCons.Tool.tex.tex_pdf_emitter)
- env['PDFLATEX'] = 'pdflatex'
- env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
- env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}'
- env['LATEXRETRIES'] = 3
+ SCons.Tool.tex.generate_common(env)
def exists(env):
return env.Detect('pdflatex')
diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py
index b487a8d..01b7f85 100644
--- a/src/engine/SCons/Tool/pdftex.py
+++ b/src/engine/SCons/Tool/pdftex.py
@@ -1,6 +1,7 @@
"""SCons.Tool.pdftex
Tool-specific initialization for pdftex.
+Generates .pdf files from .tex files
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
@@ -91,15 +92,7 @@ def generate(env):
# so pdftex is the default for no source suffix
pdf.generate2(env)
- env['PDFTEX'] = 'pdftex'
- env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
- env['PDFTEXCOM'] = 'cd ${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}'
-
- # Duplicate from latex.py. If latex.py goes away, then this is still OK.
- env['PDFLATEX'] = 'pdflatex'
- env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
- env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}'
- env['LATEXRETRIES'] = 3
+ SCons.Tool.tex.generate_common(env)
def exists(env):
return env.Detect('pdftex')
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py
index 7856f42..35022dc 100644
--- a/src/engine/SCons/Tool/tex.py
+++ b/src/engine/SCons/Tool/tex.py
@@ -1,6 +1,7 @@
"""SCons.Tool.tex
Tool-specific initialization for TeX.
+Generates .dvi files from .tex files
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
@@ -491,12 +492,12 @@ def tex_emitter_core(target, source, env, graphics_extensions):
are needed on subsequent runs of latex to finish tables of contents,
bibliographies, indices, lists of figures, and hyperlink references.
"""
- targetbase, targetext = SCons.Util.splitext(str(target[0]))
basename = SCons.Util.splitext(str(source[0]))[0]
basefile = os.path.split(str(basename))[1]
+ targetdir = os.path.split(str(target[0]))[0]
+ targetbase = os.path.join(targetdir, basefile)
basedir = os.path.split(str(source[0]))[0]
- targetdir = os.path.split(str(target[0]))[0]
abspath = os.path.abspath(basedir)
target[0].attributes.path = abspath
@@ -614,6 +615,25 @@ TeXLaTeXAction = None
def generate(env):
"""Add Builders and construction variables for TeX to an Environment."""
+ global TeXLaTeXAction
+ if TeXLaTeXAction is None:
+ TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction,
+ strfunction=TeXLaTeXStrFunction)
+
+ env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)
+
+ generate_common(env)
+
+ import dvi
+ dvi.generate(env)
+
+ bld = env['BUILDERS']['DVI']
+ bld.add_action('.tex', TeXLaTeXAction)
+ bld.add_emitter('.tex', tex_eps_emitter)
+
+def generate_common(env):
+ """Add internal Builders and construction variables for LaTeX to an Environment."""
+
# A generic tex file Action, sufficient for all tex files.
global TeXAction
if TeXAction is None:
@@ -650,30 +670,23 @@ def generate(env):
if MakeAcronymsAction is None:
MakeAcronymsAction = SCons.Action.Action("$MAKEACRONYMSCOM", "$MAKEACRONYMSCOMSTR")
- global TeXLaTeXAction
- if TeXLaTeXAction is None:
- TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction,
- strfunction=TeXLaTeXStrFunction)
-
- env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)
-
- import dvi
- dvi.generate(env)
-
- bld = env['BUILDERS']['DVI']
- bld.add_action('.tex', TeXLaTeXAction)
- bld.add_emitter('.tex', tex_eps_emitter)
-
env['TEX'] = 'tex'
env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
env['TEXCOM'] = 'cd ${TARGET.dir} && $TEX $TEXFLAGS ${SOURCE.file}'
- # Duplicate from latex.py. If latex.py goes away, then this is still OK.
+ env['PDFTEX'] = 'pdftex'
+ env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
+ env['PDFTEXCOM'] = 'cd ${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}'
+
env['LATEX'] = 'latex'
env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
env['LATEXCOM'] = 'cd ${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}'
env['LATEXRETRIES'] = 3
+ env['PDFLATEX'] = 'pdflatex'
+ env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
+ env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}'
+
env['BIBTEX'] = 'bibtex'
env['BIBTEXFLAGS'] = SCons.Util.CLVar('')
env['BIBTEXCOM'] = 'cd ${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}'
@@ -693,15 +706,10 @@ def generate(env):
env['MAKEACRONYMSCOM'] = 'cd ${TARGET.dir} && $MAKEACRONYMS ${SOURCE.filebase}.acn $MAKEACRONYMSFLAGS -o ${SOURCE.filebase}.acr'
env['MAKENCL'] = 'makeindex'
- env['MAKENCLSTYLE'] = '$nomencl.ist'
+ env['MAKENCLSTYLE'] = 'nomencl.ist'
env['MAKENCLFLAGS'] = '-s ${MAKENCLSTYLE} -t ${SOURCE.filebase}.nlg'
env['MAKENCLCOM'] = 'cd ${TARGET.dir} && $MAKENCL ${SOURCE.filebase}.nlo $MAKENCLFLAGS -o ${SOURCE.filebase}.nls'
- # Duplicate from pdflatex.py. If latex.py goes away, then this is still OK.
- env['PDFLATEX'] = 'pdflatex'
- env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder')
- env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}'
-
def exists(env):
return env.Detect('tex')