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
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'))
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.
# 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')