From: W. Trevor King Date: Thu, 29 Apr 2010 06:33:13 +0000 (-0400) Subject: Add Alias('bibtex-files') dependency as SCons' LaTeX scanner doesn't seem to. X-Git-Tag: v1.0~394 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d3605c3230a4ea9a7e5320fbe5c299c957a9977d;p=thesis.git Add Alias('bibtex-files') dependency as SCons' LaTeX scanner doesn't seem to. --- diff --git a/tex/site_cons/site_init.py b/tex/site_cons/site_init.py index a4131ff..6e72e42 100644 --- a/tex/site_cons/site_init.py +++ b/tex/site_cons/site_init.py @@ -1,7 +1,6 @@ import os.path import SCons.Node.FS - def include_child_SConscripts(env, SConscript): """Get all the nested SConscripts in that may alter and pass back the environment. They may also add thesis subdependencies to that @@ -38,6 +37,26 @@ def check_exec(context, executible): context.env[executible.upper()] = path return result +def _recursive_glob_dir(env, *args, **kwargs): + glob_results = env.fs.Glob(env.subst(args[0]), *args[1:], **kwargs) + assert 'pattern' not in kwargs, kwargs # or we'd need subdir_kwargs + subdirs = [] + for subdir in env.fs.Glob(env.subst('*'), *args[1:], **kwargs): + if not isinstance(subdir, SCons.Node.FS.Dir): + continue # subdir isn't a directory + subdirs.append(subdir) + return (subdirs, glob_results) + +def recursive_glob(env, *args, **kwargs): + dir_stack = [kwargs.pop('cwd', None)] + glob_results = [] + while len(dir_stack) > 0: + kwargs['cwd'] = dir_stack.pop(0) + subdirs,results = _recursive_glob_dir(env, *args, **kwargs) + dir_stack.extend(subdirs) + glob_results.extend(results) + return glob_results + def link_wtk_graph(env): return env.Command('wtk_graph.asy', '../asy/wtk_graph.asy', SCons.Script.Copy('$TARGET', '$SOURCE')) diff --git a/tex/src/SConscript b/tex/src/SConscript index 0196373..313493d 100644 --- a/tex/src/SConscript +++ b/tex/src/SConscript @@ -1,7 +1,8 @@ import os.path import SCons.Scanner -from site_cons.site_init import include_child_SConscripts, check_exec +from site_cons.site_init import ( + include_child_SConscripts, check_exec, recursive_glob) from site_cons.site_tools import asymptote, gnuplot # Make a new environment. @@ -34,10 +35,14 @@ env = include_child_SConscripts(env, SConscript) # building the Asymptote graphics. env.Alias('latex-base', [Glob('*.tex'), env.Alias('extra-packages')]) +# Alias Bibtex files (?since SCons' LaTeX scanned isn't picking them up?) +env.Alias('bibtex-files', recursive_glob(env, '*.bib')) + # Add a rule for the thesis itself. thesis = env.PDF('root.tex') env.Depends(thesis, env.Alias('extra-packages')) env.Depends(thesis, env.Alias('asymptote-figures')) +env.Depends(thesis, env.Alias('bibtex-files')) Return('thesis')