wscript
#! /usr/bin/env python
# encoding: utf-8
"""
Task generators with a rule= attribute will create a single task
that will execute the corresponding function. The rule below is
equivalent to rule='cp ${SRC} ${TGT}'
Try:
$ waf configure clean build
"""
top = '.'
out = 'build'
def configure(conf):
pass
def build(bld):
def run(task):
src = task.inputs[0].abspath()
tgt = task.outputs[0].abspath()
cmd = 'cp %s %s' % (src, tgt)
print(cmd)
return task.generator.bld.exec_command(cmd)
bld(
rule = run,
source = 'wscript',
target = 'same.txt',
)