Fix chmod with tuple rules #1884

This commit is contained in:
Thomas Nagy 2016-12-22 12:07:08 +01:00
parent c78d53a7a2
commit 3c22fd412e
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#! /usr/bin/env python3
from waflib import Utils
top = '.'
out = 'bin'
@ -19,6 +21,7 @@ def build(bld):
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) )

View File

@ -571,7 +571,12 @@ def process_rule(self):
def chmod_fun(tsk):
for x in tsk.outputs:
os.chmod(x.abspath(), self.chmod)
rule = (self.rule, chmod_fun)
if isinstance(self.rule, tuple):
rule = list(self.rule)
rule.append(chmod_fun)
rule = tuple(rule)
else:
rule = (rule, chmod_fun)
cls = Task.task_factory(name, rule,
getattr(self, 'vars', []),