3 # Mark Coggeshall, 2010
8 from waflib
import Task
, Errors
, Logs
9 from waflib
.TaskGen
import feature
, before_method
11 sas_fun
, _
= Task
.compile_fun('sas -sysin ${SRCFILE} -log ${LOGFILE} -print ${LSTFILE}', shell
=False)
14 vars = ['SAS', 'SASFLAGS']
20 logfilenode
= node
.change_ext('.log')
21 lstfilenode
= node
.change_ext('.lst')
24 task
.cwd
= task
.inputs
[0].parent
.get_src().abspath()
25 Logs
.debug('runner: %r on %r', command
, node
)
27 SASINPUTS
= node
.parent
.get_bld().abspath() + os
.pathsep
+ node
.parent
.get_src().abspath() + os
.pathsep
28 task
.env
.env
= {'SASINPUTS': SASINPUTS
}
30 task
.env
.SRCFILE
= node
.abspath()
31 task
.env
.LOGFILE
= logfilenode
.abspath()
32 task
.env
.LSTFILE
= lstfilenode
.abspath()
35 Logs
.error('Running %s on %r returned a non-zero exit', command
, node
)
36 Logs
.error('SRCFILE = %r', node
)
37 Logs
.error('LOGFILE = %r', logfilenode
)
38 Logs
.error('LSTFILE = %r', lstfilenode
)
42 @before_method('process_source')
44 if not getattr(self
, 'type', None) in ('sas',):
47 self
.env
['logdir'] = getattr(self
, 'logdir', 'log')
48 self
.env
['lstdir'] = getattr(self
, 'lstdir', 'lst')
52 if getattr(self
, 'deps', None):
53 deps
= self
.to_list(self
.deps
)
55 n
= self
.path
.find_resource(filename
)
57 n
= self
.bld
.root
.find_resource(filename
)
59 raise Errors
.WafError('cannot find input file %s for processing' % filename
)
63 for node
in self
.to_nodes(self
.source
):
64 if self
.type == 'sas':
65 task
= self
.create_task('sas', src
=node
)
66 task
.dep_nodes
= deps_lst
70 self
.find_program('sas', var
='SAS', mandatory
=False)