chiark / gitweb /
Much cleaner and nicer way to ignore vcs dot dirs
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 9 Jul 2014 17:11:13 +0000 (19:11 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 9 Jul 2014 17:11:13 +0000 (19:11 +0200)
We now discard their entire subtree directly

fdroidserver/common.py

index f4b51a27362718bf44a96947eea287017d29568d..37473bb7bcabd79d4c2beca01f5c911e529d6dcd 100644 (file)
@@ -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: