Bug #331429 - Fix breakage in package.properties and package.license
authorZac Medico <zmedico@gentoo.org>
Sat, 7 Aug 2010 00:25:41 +0000 (17:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 7 Aug 2010 00:25:41 +0000 (17:25 -0700)
handling due to behavior of ExtendedAtomDict.get(). We need to use
setdefault() when updating ExtendedAtomDict like this.

pym/portage/package/ebuild/config.py

index ba3e91c973a8214b14a34ac6be26dd87ac7c1566..ff9894d8e876cfd388016d14cdfb04adc3bf5d00 100644 (file)
@@ -868,12 +868,8 @@ class config(object):
                                        else:
                                                self.configdict["conf"]["ACCEPT_LICENSE"] = " ".join(v)
                                for k, v in licdict.items():
-                                       cp = k.cp
-                                       cp_dict = self._plicensedict.get(cp)
-                                       if not cp_dict:
-                                               cp_dict = {}
-                                               self._plicensedict[cp] = cp_dict
-                                       cp_dict[k] = self.expandLicenseTokens(v)
+                                       self._plicensedict.setdefault(k.cp, {})[k] = \
+                                               self.expandLicenseTokens(v)
 
                                #package.properties
                                propdict = grabdict_package(os.path.join(
@@ -885,12 +881,7 @@ class config(object):
                                        else:
                                                self.configdict["conf"]["ACCEPT_PROPERTIES"] = " ".join(v)
                                for k, v in propdict.items():
-                                       cp = k.cp
-                                       cp_dict = self._ppropertiesdict.get(cp)
-                                       if not cp_dict:
-                                               cp_dict = {}
-                                               self._ppropertiesdict[cp] = cp_dict
-                                       cp_dict[k] = v
+                                       self._ppropertiesdict.setdefault(k.cp, {})[k] = v
 
                                self._local_repo_configs = {}
                                self._local_repo_conf_path = \