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

36 lines
686 B
Python

#! /usr/bin/env python
"""
Demonstrate how to bind functions to be executed before or after the build
Try executing:
$ waf configure clean build
"""
top = '.'
out = 'build'
def options(ctx):
ctx.add_option('--exe', action='store_true', default=False,
help='execute the program after it is built')
def configure(ctx):
pass
def pre(ctx):
print('before the build is started')
def post(ctx):
print('after the build is complete')
if ctx.cmd == 'install':
from waflib import Options, Utils
if Options.options.exe:
ctx.exec_command('/sbin/ldconfig')
def build(ctx):
ctx(rule='touch ${TGT}', target='bar.txt', always=True)
ctx.add_pre_fun(pre)
ctx.add_post_fun(post)