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.
43 lines
980 B
Python
43 lines
980 B
Python
#! /usr/bin/env python
|
|
|
|
"""
|
|
The wscript file in this directory uses external commands in the
|
|
task execution. We may as well use node objects to write to them
|
|
directly.
|
|
"""
|
|
|
|
def configure(ctx):
|
|
pass
|
|
|
|
from waflib.Task import Task
|
|
class cp(Task):
|
|
def run(self):
|
|
txt = self.inputs[0].read()
|
|
self.outputs[0].write(txt)
|
|
|
|
class cat(Task):
|
|
def run(self):
|
|
txt = self.inputs[0].read() + self.inputs[1].read()
|
|
self.outputs[0].write(txt)
|
|
|
|
def build(ctx):
|
|
|
|
cp_1 = cp(env=ctx.env)
|
|
cp_1.set_inputs(ctx.path.find_resource('wscript'))
|
|
cp_1.set_outputs(ctx.path.find_or_declare('foo.txt'))
|
|
ctx.add_to_group(cp_1)
|
|
|
|
cp_2 = cp(env=ctx.env)
|
|
cp_2.set_inputs(ctx.path.find_resource('wscript'))
|
|
cp_2.set_outputs(ctx.path.find_or_declare('bar.txt'))
|
|
ctx.add_to_group(cp_2)
|
|
|
|
cat_1 = cat(env=ctx.env)
|
|
cat_1.set_inputs(cp_1.outputs + cp_2.outputs)
|
|
cat_1.set_outputs(ctx.path.find_or_declare('foobar.txt'))
|
|
ctx.add_to_group(cat_1)
|
|
|
|
cat_1.set_run_after(cp_1)
|
|
cat_1.set_run_after(cp_2)
|
|
|