diff options
Diffstat (limited to 'engine/SCons/Tool/tex.py')
-rw-r--r-- | engine/SCons/Tool/tex.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/engine/SCons/Tool/tex.py b/engine/SCons/Tool/tex.py index 3f9dee3..b4b2819 100644 --- a/engine/SCons/Tool/tex.py +++ b/engine/SCons/Tool/tex.py @@ -32,12 +32,12 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/tex.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/Tool/tex.py 5023 2010/06/14 22:05:46 scons" import os.path import re -import string import shutil +import sys import SCons.Action import SCons.Node @@ -133,6 +133,10 @@ _null = SCons.Scanner.LaTeX._null modify_env_var = SCons.Scanner.LaTeX.modify_env_var +def check_file_error_message(utility, filename='log'): + msg = '%s returned an error, check the %s file\n' % (utility, filename) + sys.stdout.write(msg) + def FindFile(name,suffixes,paths,env,requireExt=False): if requireExt: name,ext = SCons.Util.splitext(name) @@ -232,8 +236,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None # # routine to update MD5 hash and compare # - # TODO(1.5): nested scopes - def check_MD5(filenode, suffix, saved_hashes=saved_hashes, targetbase=targetbase): + def check_MD5(filenode, suffix): global must_rerun_latex # two calls to clear old csig filenode.clear_memoized_values() @@ -292,13 +295,13 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None target_aux = os.path.join(targetdir, auxfilename) if os.path.exists(target_aux): content = open(target_aux, "rb").read() - if string.find(content, "bibdata") != -1: + if content.find("bibdata") != -1: if Verbose: print "Need to run bibtex" bibfile = env.fs.File(targetbase) result = BibTeXAction(bibfile, bibfile, env) if result != 0: - print env['BIBTEX']," returned an error, check the blg file" + check_file_error_message(env['BIBTEX'], 'blg') return result must_rerun_latex = check_MD5(suffix_nodes['.bbl'],'.bbl') break @@ -311,7 +314,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None idxfile = suffix_nodes['.idx'] result = MakeIndexAction(idxfile, idxfile, env) if result != 0: - print env['MAKEINDEX']," returned an error, check the ilg file" + check_file_error_message(env['MAKEINDEX'], 'ilg') return result # TO-DO: need to add a way for the user to extend this list for whatever @@ -329,7 +332,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None nclfile = suffix_nodes['.nlo'] result = MakeNclAction(nclfile, nclfile, env) if result != 0: - print env['MAKENCL']," (nomenclature) returned an error, check the nlg file" + check_file_error_message('%s (nomenclature)' % env['MAKENCL'], + 'nlg') #return result # Now decide if latex will need to be run again due to glossary. @@ -340,7 +344,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None glofile = suffix_nodes['.glo'] result = MakeGlossaryAction(glofile, glofile, env) if result != 0: - print env['MAKEGLOSSARY']," (glossary) returned an error, check the glg file" + check_file_error_message('%s (glossary)' % env['MAKEGLOSSARY'], + 'glg') #return result # Now decide if latex will need to be run again due to acronyms. @@ -351,7 +356,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None acrfile = suffix_nodes['.acn'] result = MakeAcronymsAction(acrfile, acrfile, env) if result != 0: - print env['MAKEACRONYMS']," (acronymns) returned an error, check the alg file" + check_file_error_message('%s (acronyms)' % env['MAKEACRONYMS'], + 'alg') return result # Now decide if latex needs to be run yet again to resolve warnings. @@ -420,9 +426,7 @@ def is_LaTeX(flist,env,abspath): pass else: # Split at os.pathsep to convert into absolute path - # TODO(1.5) - #paths = paths.split(os.pathsep) - paths = string.split(paths, os.pathsep) + paths = paths.split(os.pathsep) # now that we have the path list restore the env if savedpath is _null: @@ -488,11 +492,11 @@ def TeXLaTeXFunction(target = None, source= None, env=None): if is_LaTeX(source,env,abspath): result = LaTeXAuxAction(target,source,env) if result != 0: - print env['LATEX']," returned an error, check the log file" + check_file_error_message(env['LATEX']) else: result = TeXAction(target,source,env) if result != 0: - print env['TEX']," returned an error, check the log file" + check_file_error_message(env['TEX']) return result def TeXLaTeXStrFunction(target = None, source= None, env=None): @@ -646,9 +650,7 @@ def tex_emitter_core(target, source, env, graphics_extensions): pass else: # Split at os.pathsep to convert into absolute path - # TODO(1.5) - #paths = paths.split(os.pathsep) - paths = string.split(paths, os.pathsep) + paths = paths.split(os.pathsep) # now that we have the path list restore the env if savedpath is _null: |