summaryrefslogtreecommitdiffstats
path: root/extras/sas.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-17 17:31:05 +0100
committerDavid Robillard <d@drobilla.net>2019-03-17 17:31:05 +0100
commit406f89271452fdb573c7e28113b1ed08ff2b4eda (patch)
treed2dcbaf61f3749f73dc7a5e10d3fc6cd5e6e129a /extras/sas.py
parent7983a5aae615290d04fd43cbc2752f8cf4a46d10 (diff)
downloadsuil-406f89271452fdb573c7e28113b1ed08ff2b4eda.tar.gz
suil-406f89271452fdb573c7e28113b1ed08ff2b4eda.tar.bz2
suil-406f89271452fdb573c7e28113b1ed08ff2b4eda.zip
Squashed 'waflib/' changes from 915dcb1..e7a29b6
e7a29b6 Upgrade to waf 2.0.15 8280f9d Add command for running executables from the build directory 8073c1a Make make_simple_dox() safe in case of exception 70d03b8 Avoid use of global counter hacks for configuration display b7d689a Rewrite test framework 94deadf Automatically add options and move add_flags() to options context f4259ee Reduce system include path noise 927b608 Automatically display configuration header c44b8f3 Set line justification from a constant in the wscript a48e26f Automatically detect if wscript has a test hook ef66724 Save runtime variables in the environment 63bcbcd Clean up TestContext b1d9505 Add ExecutionContext for setting runtime environment 387c1df Add show_diff() and test_file_equals() utilities 29d4d29 Fix in-tree library paths 9fde01f Add custom configuration context 6d3612f Add lib_path_name constant git-subtree-dir: waflib git-subtree-split: e7a29b6b9b2f842314244c23c14d8f8f560904e1
Diffstat (limited to 'extras/sas.py')
-rw-r--r--extras/sas.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/extras/sas.py b/extras/sas.py
new file mode 100644
index 0000000..754c614
--- /dev/null
+++ b/extras/sas.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# encoding: utf-8
+# Mark Coggeshall, 2010
+
+"SAS support"
+
+import os
+from waflib import Task, Errors, Logs
+from waflib.TaskGen import feature, before_method
+
+sas_fun, _ = Task.compile_fun('sas -sysin ${SRCFILE} -log ${LOGFILE} -print ${LSTFILE}', shell=False)
+
+class sas(Task.Task):
+ vars = ['SAS', 'SASFLAGS']
+ def run(task):
+ command = 'SAS'
+ fun = sas_fun
+
+ node = task.inputs[0]
+ logfilenode = node.change_ext('.log')
+ lstfilenode = node.change_ext('.lst')
+
+ # set the cwd
+ task.cwd = task.inputs[0].parent.get_src().abspath()
+ Logs.debug('runner: %r on %r', command, node)
+
+ SASINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep
+ task.env.env = {'SASINPUTS': SASINPUTS}
+
+ task.env.SRCFILE = node.abspath()
+ task.env.LOGFILE = logfilenode.abspath()
+ task.env.LSTFILE = lstfilenode.abspath()
+ ret = fun(task)
+ if ret:
+ Logs.error('Running %s on %r returned a non-zero exit', command, node)
+ Logs.error('SRCFILE = %r', node)
+ Logs.error('LOGFILE = %r', logfilenode)
+ Logs.error('LSTFILE = %r', lstfilenode)
+ return ret
+
+@feature('sas')
+@before_method('process_source')
+def apply_sas(self):
+ if not getattr(self, 'type', None) in ('sas',):
+ self.type = 'sas'
+
+ self.env['logdir'] = getattr(self, 'logdir', 'log')
+ self.env['lstdir'] = getattr(self, 'lstdir', 'lst')
+
+ deps_lst = []
+
+ if getattr(self, 'deps', None):
+ deps = self.to_list(self.deps)
+ for filename in deps:
+ n = self.path.find_resource(filename)
+ if not n:
+ n = self.bld.root.find_resource(filename)
+ if not n:
+ raise Errors.WafError('cannot find input file %s for processing' % filename)
+ if not n in deps_lst:
+ deps_lst.append(n)
+
+ for node in self.to_nodes(self.source):
+ if self.type == 'sas':
+ task = self.create_task('sas', src=node)
+ task.dep_nodes = deps_lst
+ self.source = []
+
+def configure(self):
+ self.find_program('sas', var='SAS', mandatory=False)
+