2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

Node objects can be folders too, but dependencies must be managed manually

This commit is contained in:
Thomas Nagy 2016-03-07 21:12:51 +01:00
parent 6768a4cb38
commit 3cac9c7077
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 15 additions and 2 deletions

View File

@ -23,8 +23,12 @@ def build(bld):
#print( 'path from srcnode', bld.path.find_or_declare('aaa').path_from(bld.bldnode) )
bld.install_files('/tmp/bar', 'wscript')
# 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')

View File

@ -823,7 +823,16 @@ class Node(object):
try:
ret = cache[self]
except KeyError:
ret = cache[self] = Utils.h_file(self.abspath())
p = self.abspath()
try:
ret = cache[self] = Utils.h_file(p)
except EnvironmentError:
if os.path.isdir(p):
# allow folders as build nodes, do not use the creation time
st = os.stat(p)
ret = cache[self] = Utils.h_list([p, st.st_ino, st.st_mode])
return ret
raise
return ret
# --------------------------------------------