-
Notifications
You must be signed in to change notification settings - Fork 0
Snippets
A simple builder (doesn't clean-up the log file, and if run in parallel it should output to different log files)
env.Append(BUILDERS={'RBuilder': Builder(action='Rscript --vanilla $SOURCE > out.log')})Usage example: code_bld_obj = env.RBuilder(target="output_file", source="code.R")
A simple builder (doesn't clean-up the log file, and if run in parallel it should output to different log files)
env.Append(BUILDERS={'PyBuilder': Builder(action='python $SOURCE > out.log')})Usage example: code_bld_obj = env.PyBuilder(target="output_file", source="code.py")
These are targets that don't correspond to built files. They are used just to run arbitrary commands (that don't fit well into the build-a-file mentality). The following executes dir when someone specifies the target show_dir. "dir" could be replaced with a real python function
env.AlwaysBuild(env.Alias("show_dir", action="dir"))This is a way to store you dependencies in a simple data structure and loaded programmatically in your SConstruct
You can save the following to a file, e.g., deps.json
[["a.do", ["i1", "i2"], ["o1", "o2"]], ["b.do", ["i3"], ["o4"]]]Then in your SConstruct you can do this:
def deps_from_json(fname):
import json
with open(fname, "r") as fhandle:
return json.load(fhandle)
# dep_list = deps_from_json("deps.json")
#Generate builder instances from list
for do_file, inputs, outputs from dep_list:
env.StataBuild(target = outputs, source = do_file, depends=inputs)