diff options
| author | Steven Knight <knight@baldmt.com> | 2004-12-03 04:09:35 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2004-12-03 04:09:35 (GMT) |
| commit | abcf29987d2baa25d51716f888015aaa9d104d36 (patch) | |
| tree | 55b5ddbfe2baca260bb10c209041d2235d1f9565 /src/engine/SCons/Tool/tex.py | |
| parent | 2fa621343311180c159ee09262cefe0ee0ad2d83 (diff) | |
| download | SCons-abcf29987d2baa25d51716f888015aaa9d104d36.zip SCons-abcf29987d2baa25d51716f888015aaa9d104d36.tar.gz SCons-abcf29987d2baa25d51716f888015aaa9d104d36.tar.bz2 | |
More command-line customizability: , , , , .
Diffstat (limited to 'src/engine/SCons/Tool/tex.py')
| -rw-r--r-- | src/engine/SCons/Tool/tex.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index b9257ea..db2664a 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -45,14 +45,14 @@ import SCons.Util # Define an action to build a generic tex file. This is sufficient for all # tex files. -TeXAction = SCons.Action.CommandAction("$TEXCOM") +TeXAction = SCons.Action.Action("$TEXCOM", "$TEXCOMSTR") # Define an action to build a latex file. This action might be needed more # than once if we are dealing with labels and bibtex -LaTeXAction = SCons.Action.CommandAction("$LATEXCOM") +LaTeXAction = SCons.Action.Action("$LATEXCOM", "$LATEXCOMSTR") # Define an action to run BibTeX on a file. -BibTeXAction = SCons.Action.CommandAction("$BIBTEXCOM") +BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") def LaTeXAuxAction(target = None, source= None, env=None): """A builder for LaTeX files that checks the output in the aux file @@ -74,22 +74,29 @@ def LaTeXAuxAction(target = None, source= None, env=None): LaTeXAction(target,source,env) return 0 -def TeXLaTeXAction(target = None, source= None, env=None): +LaTeX_re = re.compile("\\\\document(style|class)") + +def is_LaTeX(flist): + # Scan a file list to decide if it's TeX- or LaTeX-flavored. + for f in flist: + content = f.get_contents() + if LaTeX_re.search(content): + return 1 + return 0 + +def TeXLaTeXFunction(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.""" - LaTeXFile = None - for src in source: - content = src.get_contents() - if re.search("\\\\document(style|class)",content): - LaTeXFile = 1 - break - if LaTeXFile: + if is_LaTeX(source): LaTeXAuxAction(target,source,env) else: TeXAction(target,source,env) return 0 +TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, + strfunction=None) + def generate(env): """Add Builders and construction variables for TeX to an Environment.""" try: |
