From: Daniel Martí Date: Wed, 29 Jan 2014 23:16:03 +0000 (+0100) Subject: Handle dirs to be ignored in scan_source more gracefully X-Git-Tag: 0.2~340^2~3 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1b0fb05337f7498c93302317d1be7751fdd62339;p=fdroidserver.git Handle dirs to be ignored in scan_source more gracefully --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index b348af1f..4e451cd2 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1241,12 +1241,17 @@ def scan_source(build_dir, root_dir, thisbuild): def warnproblem(what, fd, fp): print 'Warning: Found %s at %s' % (what, fd) + 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 curfile in f: - if '/.hg' in r or '/.git' in r or '/.svn' in r: - continue + if any(insidedir(r, igndir) for igndir in ('.hg', '.git', '.svn')): + print r + continue + + for curfile in f: # Path (relative) to the file... fp = os.path.join(r, curfile)