Saturday, 15 March 2014

Why can't waf find a path that exists? -



Why can't waf find a path that exists? -

let's have x.y file in /mydir/a/b (on linux) when run waf, not find file.

def configure(context): pass def build(build_context): build_context(source='/mydir/a/b/x.y', rule='echo ${src} > ${tgt}', target='test.out')

result: source not found: '/mydir/a/b/x.y' in bld(features=[], idx=1, meths=['process_rule', 'process_source'] ...

ok, maybe want relative path, waf? , not telling me?

def build(context): path_str = '/mydir/a/b' xy_node = context.path.find_dir(path_str) if xy_node none: exit ("error: failed find path {}".format(path_str)) # refer current script orig_path = context.path.find_resource('wscript') rel_path = xy_node.path_from(orig_path) print "relative path: ", rel_path

result: error: failed find path /mydir/a/b

but directory exists! what's that?

and, way, relative path subdirectory (which can find) 1 off. e.g. a/b under current directory results in relative path "../a/b". i'd expect "a/b"

in general there (at least) 2 node objects in each context: - path: pointing location of wscript - root: pointing filesystem root

so in case solution utilize context.root:

def build(context): print context.path.abspath() print context.root.abspath() print context.root.find_dir('/mydir/a/b')

waf

No comments:

Post a Comment