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/tasks_chains/wscript

33 lines
691 B
Python

#! /usr/bin/env python
# encoding: utf-8
def configure(ctx):
pass
def build(ctx):
import os
from waflib import Utils, Task
def chmod_fun(task):
for x in task.outputs:
os.chmod(x.abspath(), Utils.O755)
def remove_fun(task):
for x in task.outputs:
try:
os.remove(x.abspath())
except OSError:
if os.path.exists(x.abspath()):
raise ValueError('Cannot remove %r' % x)
class complex_copy(Task.Task):
run_str = (remove_fun, "${CP} ${SRC} ${TGT}", chmod_fun)
ctx.env.CP = '/bin/cp'
tsk = complex_copy(env=ctx.env.derive())
tsk.set_inputs(ctx.path.find_resource('wscript'))
tsk.set_outputs(ctx.path.find_or_declare('wscript.out'))
ctx.add_to_group(tsk)