From 69725c3f4cc4045769cb6dbf3d044bf2779fc485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 9 Jul 2014 19:11:13 +0200 Subject: [PATCH] Much cleaner and nicer way to ignore vcs dot dirs We now discard their entire subtree directly --- fdroidserver/common.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index f4b51a27..37473bb7 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1456,14 +1456,13 @@ def scan_source(build_dir, root_dir, thisbuild): return True return False - def insidedir(path, dirname): - return path.endswith('/%s' % dirname) or '/%s/' % dirname in path - # Iterate through all files in the source code - for r, d, f in os.walk(build_dir): + for r, d, f in os.walk(build_dir, topdown=True): - if any(insidedir(r, d) for d in ('.hg', '.git', '.svn', '.bzr')): - continue + # It's topdown, so checking the basename is enough + for ignoredir in ('.hg', '.git', '.svn', '.bzr'): + if ignoredir in d: + d.remove(ignoredir) for curfile in f: