diff --git a/wscript b/wscript index cacb632f..2d83ab08 100644 --- a/wscript +++ b/wscript @@ -258,20 +258,19 @@ def create_waf(self, *k, **kw): for x in Options.options.coretools.split(','): coretools.append(x + '.py') - for d in '. Tools extras'.split(): - dd = os.path.join('waflib', d) - for k in os.listdir(dd): - if k == '__init__.py': - files.append(os.path.normpath(os.path.join(dd, k))) + up_node = self.generator.bld.path + for node in up_node.find_dir('waflib').ant_glob(incl=['*.py', 'Tools/*.py', 'extras/*.py']): + relpath = node.path_from(up_node) + if node.name == '__init__.py': + files.append(relpath) + continue + if node.parent.name == 'Tools' and Options.options.coretools != 'default': + if node.name not in coretools: continue - if d == 'Tools' and Options.options.coretools != 'default': - if not k in coretools: - continue - if d == 'extras': - if not k in add3rdparty: - continue - if k.endswith('.py'): - files.append(os.path.normpath(os.path.join(dd, k))) + if node.parent.name == 'extras': + if node.name not in add3rdparty: + continue + files.append(relpath) if Options.options.namesfrom: with tarfile.open(Options.options.namesfrom) as tar: