]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- use glob for blacklisting
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 25 May 2010 14:03:53 +0000 (14:03 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    check-unused-files.py -> 1.9

check-unused-files.py

index be281db904e207d5066bd0055dbf453c317cc936..25d259c0964e8f60cd456a1668b0aff07e05f9d2 100644 (file)
@@ -3,6 +3,7 @@
 import subprocess
 import sys
 import os
+import fnmatch
 
 if len(sys.argv) != 2:
     print >> sys.stderr, "Usage: %s <spec>" % sys.argv[0]
@@ -36,13 +37,22 @@ for l in out.split('\n'):
 
 obsolete = []
 
-for file in os.listdir(dir):
-    file = os.path.basename(file)
+def blacklisted(file):
     if file in [ '.', '..', 'CVS', '.cvsignore', 'dropin', 'md5', 'adapter', 'builder',
             'relup.sh', 'compile.sh', 'repackage.sh', 'rsync.sh', 'TODO', os.path.basename(spec) ]:
+        return True
+
+    for pat in ['log.*', '.#*', '*~', '*.orig', '*.sw?']:
+        if fnmatch.fnmatch(file, pat):
+            return True
+
+    return False
+
+for file in os.listdir(dir):
+    file = os.path.basename(file)
+    if blacklisted(file):
         continue
-    if file[:4] == 'log.' or file[:2] == '.#' or file[-1] == '~': # IndexError: or file[-5] == '.orig':
-        continue
+
     if file not in files:
         print "Obsolete file: %s" % file
         obsolete.append(file)
This page took 0.037571 seconds and 4 git commands to generate.