You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
waf_old/docs/book/examples/rules_function/wscript

33 lines
567 B
Python

#! /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',
)