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/tests/nodes/wscript

75 lines
1.6 KiB
Python

#! /usr/bin/env python3
from waflib import Utils
top = '.'
out = 'bin'
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
def build(bld):
bld(rule='echo hi')
bld(rule='touch ${TGT}', target='foo.txt')
bld(rule='touch ${TGT}', target='aaa')
t = bld(rule='touch ${TGT}', target='bbb', source='aaa')
t = bld(rule='touch ${TGT}', target='ccc', source='bbb')
t = bld(rule='touch ${TGT}', target='ddd', source='ccc')
t = bld(rule=('touch ${TGT}', 'touch ${TGT}'), target='eee', source='ddd', chmod=Utils.O755)
t.create_task('foo')
#print( 'path from srcnode', bld.path.find_or_declare('aaa').path_from(bld.bldnode) )
# folders as nodes are best avoided
dnode = bld.path.get_bld().make_node('testdir')
bld(rule='mkdir -p ${TGT}', target=dnode)
bld(rule='touch ${TGT}', source=dnode, target=dnode.make_node('stuff'), cls_str=lambda x: 'stuff')
bld.install_files('/tmp/bar', 'wscript')
bld(features='c cprogram', source='main.c', target='app')
def init(self):
print('init')
def shutdown(self):
print('shutdown')
def bar(ctx):
print("command ok")
from waflib import Task
class foo(Task.Task):
always_run = True
def run(self):
print("running foo")
print("classes", Task.classes)
#-----------------------------------------------
# variant example below
# call "../waf debug"
#
import os
from waflib import Build, Options
class debug_context(Build.BuildContext):
cmd = 'debug'
fun = 'build'
variant = 'test'
def __init__(self, start=None):
Build.BuildContext.__init__(self, start=start)
# looks evil
#def debug(bld):
# build(bld)