Move default ACCEPT_KEYWORDS handling for package.keywords out of
authorZac Medico <zmedico@gentoo.org>
Sat, 21 Aug 2010 19:27:05 +0000 (12:27 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 21 Aug 2010 19:27:05 +0000 (12:27 -0700)
an unnecessary loop.

pym/portage/package/ebuild/config.py

index 572effd51252773d1031560c4881ca1b9aa4f662..09595791885d57e18e06a2478a08139a3d145d37 100644 (file)
@@ -1021,19 +1021,14 @@ class config(object):
                                        recursive=1, allow_wildcard=True).items():
                                        pkgdict.setdefault(k, []).extend(v)
 
+                               accept_keywords_defaults = \
+                                       self.configdict["defaults"].get("ACCEPT_KEYWORDS", "").split()
+                               accept_keywords_defaults = tuple('~' + keyword for keyword in \
+                                       accept_keywords_defaults if keyword[:1] not in "~-")
                                for k, v in pkgdict.items():
                                        # default to ~arch if no specific keyword is given
                                        if not v:
-                                               mykeywordlist = []
-                                               if self.configdict["defaults"] and \
-                                                       "ACCEPT_KEYWORDS" in self.configdict["defaults"]:
-                                                       groups = self.configdict["defaults"]["ACCEPT_KEYWORDS"].split()
-                                               else:
-                                                       groups = []
-                                               for keyword in groups:
-                                                       if not keyword[0] in "~-":
-                                                               mykeywordlist.append("~"+keyword)
-                                               v = mykeywordlist
+                                               v = accept_keywords_defaults
                                        self.pkeywordsdict.setdefault(k.cp, {})[k] = v
 
                                #package.license