From 2e58ac4134b51a0d33df9b5f1d5513d0e3edc29a Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Tue, 23 Apr 2019 07:39:19 +0200 Subject: [PATCH] When creating the waf script, assume that the 'extras' folder only contains Python files Files are also listed in a static arbitrary order. --- wscript | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) 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: