waf/docs/book/examples/scenarios_impfile/wscript

23 lines
423 B
Python

#! /usr/bin/env python
"""
Create a file in the build directory before the build starts
"""
cfg_file = 'somedir/foo.txt'
def configure(conf):
orig = conf.root.find_node('/etc/fstab')
txt = orig.read()
dest = conf.bldnode.make_node(cfg_file)
dest.parent.mkdir()
dest.write(txt)
conf.env.append_value('cfg_files', dest.abspath())
def build(ctx):
ctx(rule='cp ${SRC} ${TGT}', source=cfg_file, target='bar.txt')