From: managan Date: Thu, 4 Sep 2008 22:30:55 +0000 (+0000) Subject: Pass the results of the InternalLaTeXAuxAction back up the call chain X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e244734e2f2c19a551645e4171aec2c17880eedc;p=scons.git Pass the results of the InternalLaTeXAuxAction back up the call chain in teh various tex builders. This allows the user to interrupt the build which was not working before. It also allows configuration tests to work since now they can tell if there was failure in a test. The result from the internal MakeIndexAction and BibtexAction are checked as well and control returned if there was an error in one of those. This is to avoid repeatedly running commands until we hit the retry limit. I added no test for this simce I am unsure how to test for user interrupts. Also unclear how to test for how many times the internal actions were run during a test to see if it returns on teh first error! git-svn-id: http://scons.tigris.org/svn/scons/trunk@3339 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py index 8258829b..69b544a9 100644 --- a/src/engine/SCons/Tool/latex.py +++ b/src/engine/SCons/Tool/latex.py @@ -43,7 +43,8 @@ import SCons.Tool.tex LaTeXAction = None def LaTeXAuxFunction(target = None, source= None, env=None): - SCons.Tool.tex.InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + result = SCons.Tool.tex.InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + return result LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction, strfunction=SCons.Tool.tex.TeXLaTeXStrFunction) diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py index b8a77365..91868ef4 100644 --- a/src/engine/SCons/Tool/pdflatex.py +++ b/src/engine/SCons/Tool/pdflatex.py @@ -41,7 +41,8 @@ import SCons.Tool.tex PDFLaTeXAction = None def PDFLaTeXAuxFunction(target = None, source= None, env=None): - SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + return result PDFLaTeXAuxAction = None diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 7bd57b06..75c6bc9f 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -44,17 +44,18 @@ PDFTeXAction = None PDFLaTeXAction = None def PDFLaTeXAuxAction(target = None, source= None, env=None): - SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env ) + return result 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) + result = PDFLaTeXAuxAction(target,source,env) else: - PDFTeXAction(target,source,env) - return 0 + result = PDFTeXAction(target,source,env) + return result PDFTeXLaTeXAction = None diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 29dc81de..0c1ed3d4 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -122,7 +122,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None tocContents = open(tocfilename, "rb").read() # Run LaTeX once to generate a new aux file and log file. - XXXLaTeXAction(target, source, env) + result = XXXLaTeXAction(target, source, env) + if result != 0: + return result # Decide if various things need to be run, or run again. We check # for the existence of files before opening them--even ones like the @@ -143,7 +145,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None content = open(target_aux, "rb").read() if string.find(content, "bibdata") != -1: bibfile = env.fs.File(targetbase) - BibTeXAction(bibfile, bibfile, env) + result = BibTeXAction(bibfile, bibfile, env) + if result != 0: + return result break must_rerun_latex = 0 @@ -159,11 +163,15 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None if os.path.exists(idxfilename) and idxContents != open(idxfilename, "rb").read(): # We must run makeindex idxfile = env.fs.File(targetbase) - MakeIndexAction(idxfile, idxfile, env) + result = MakeIndexAction(idxfile, idxfile, env) + if result != 0: + return result must_rerun_latex = 1 if must_rerun_latex == 1: - XXXLaTeXAction(target, source, env) + result = XXXLaTeXAction(target, source, env) + if result != 0: + return result # Now decide if latex needs to be run yet again to resolve warnings. logfilename = targetbase + '.log' @@ -175,7 +183,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None not rerun_citations_re.search(content) and \ not undefined_references_re.search(content): break - XXXLaTeXAction(target, source, env) + result = XXXLaTeXAction(target, source, env) + if result != 0: + return result env['ENV']['TEXINPUTS'] = texinputs_save env['ENV']['BIBINPUTS'] = bibinputs_save @@ -185,10 +195,11 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None # later on Mac OSX so leave it, # env['ENV']['TEXPICTS'] = texpicts_save - return 0 + return result def LaTeXAuxAction(target = None, source= None, env=None): - InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + result = InternalLaTeXAuxAction( LaTeXAction, target, source, env ) + return result LaTeX_re = re.compile("\\\\document(style|class)") @@ -205,9 +216,10 @@ def TeXLaTeXFunction(target = None, source= None, env=None): decide the "flavor" of the source and then executes the appropriate program.""" if is_LaTeX(source): - LaTeXAuxAction(target,source,env) + result = LaTeXAuxAction(target,source,env) else: - TeXAction(target,source,env) + result = TeXAction(target,source,env) + return result def TeXLaTeXStrFunction(target = None, source= None, env=None): """A strfunction for TeX and LaTeX that scans the source file to