]> git.pld-linux.org Git - projects/pld-builder.new.git/commitdiff
rewrite Blacklist_File with set
authorKacper Kornet <draenog@pld-linux.org>
Mon, 24 Jun 2013 00:13:09 +0000 (01:13 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Mon, 24 Jun 2013 00:23:14 +0000 (01:23 +0100)
PLD_Builder/blacklist.py

index 54cc66b9b9474489bff10b4076af6807600d7228..fa207239904dff067724e24e6e9a0fa247a4034a 100644 (file)
@@ -26,20 +26,20 @@ class Blacklist_File:
 
     def reload(self):
         self.blacklist_file_mtime = os.stat(path.blacklist_file)[stat.ST_MTIME]
-        self.blacklist = {}
+        self.blacklist = set()
         status.push("reading package-blacklist")
         with open(path.blacklist_file) as f:
             for l in f:
                 p = l.rstrip()
                 if re.match(r"^#.*", p):
                     continue
-                self.blacklist[p] = 1
-                log.notice("blacklist added: %s (%d)" % (l, self.blacklist.has_key(p)))
+                self.blacklist.add(p)
+                log.notice("blacklist added: %s" % l)
         status.pop()
 
     def package(self, p):
 #       log.notice("blacklist check: %s (%d)" % (p, self.blacklist.has_key(p)))
-        if self.blacklist.has_key(p):
+        if p in self.blacklist:
             return True
         return False
 
This page took 0.484702 seconds and 4 git commands to generate.