3 # Thomas Nagy, 2010-2018 (ita)
5 from __future__ import with_statement
12 """Call all substitution functions on Waf folders"""
14 for v in all_modifs[k]:
15 modif(os.path.join(dir, 'waflib'), k, v)
17 def modif(dir, name, fun):
18 """Call a substitution function"""
21 for y in '. Tools extras'.split():
22 for x in os.listdir(os.path.join(dir, y)):
24 lst.append(y + os.sep + x)
29 filename = os.path.join(dir, name)
30 with open(filename, 'r') as f:
35 with open(filename, 'w') as f:
39 """register a substitution function"""
43 all_modifs[x].append(fun)
51 "utf-8 fixes for python < 2.6"
52 code = code.replace('as e:', ',e:')
53 code = code.replace(".decode(sys.stdout.encoding or'latin-1',errors='replace')", '')
54 return code.replace('.encode()', '')
59 return code.replace('next(self.biter)', 'self.biter.next()').replace('self.daemon = True', 'self.setDaemon(1)')
63 return code.replace("('Execution failure: %s'%str(e),ex=e)", "('Execution failure: %s'%str(e),ex=e),None,sys.exc_info()[2]")