diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-02-19 09:32:44 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-02-19 09:32:44 +0000 |
commit | 0f89a14b8e0c9d512a71bb93a821d9d1709f4f57 (patch) | |
tree | f45e008ecf0b43fa70798300424e65c3a6214dc2 | |
parent | ddc507922db5e5f11e05692dcd55a7cc5809be61 (diff) | |
download | portage-0f89a14b8e0c9d512a71bb93a821d9d1709f4f57.tar.gz portage-0f89a14b8e0c9d512a71bb93a821d9d1709f4f57.tar.bz2 portage-0f89a14b8e0c9d512a71bb93a821d9d1709f4f57.zip |
Use a property to trigger deprecation warnings if binarytree.remotepkgs
is accessed.
svn path=/main/trunk/; revision=15379
-rw-r--r-- | pym/portage/dbapi/bintree.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index ce636dd9c..3fd098db1 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -163,7 +163,7 @@ class binarytree(object): self._remote_has_index = False self._remote_base_uri = None self._remotepkgs = None # remote metadata indexed by cpv - self.remotepkgs = {} # indexed by tbz2 name (deprecated) + self.__remotepkgs = {} # indexed by tbz2 name (deprecated) self.invalids = [] self.settings = settings self._pkg_paths = {} @@ -223,6 +223,24 @@ class binarytree(object): chain(*self._pkgindex_translated_keys) )) + def _get_remotepkgs(self): + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs", + DeprecationWarning) + return self.__remotepkgs + + def _set_remotepkgs(self, remotepkgs): + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs", + DeprecationWarning) + self.__remotepkgs = remotepkgs + + def _del_remotepkgs(self): + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs", + DeprecationWarning) + del self.__remotepkgs + + remotepkgs = property(_get_remotepkgs, _set_remotepkgs, _del_remotepkgs, + "Deprecated self.remotepkgs, only for backward compatibility") + def move_ent(self, mylist): if not self.populated: self.populate() @@ -753,7 +771,7 @@ class binarytree(object): self._remotepkgs[d["CPV"]] = d self._remote_has_index = True self._remote_base_uri = pkgindex.header.get("URI", base_url) - self.remotepkgs = {} + self.__remotepkgs = {} for cpv in self._remotepkgs: self.dbapi.cpv_inject(cpv) self.populated = 1 @@ -798,18 +816,18 @@ class binarytree(object): writemsg_stdout( colorize("GOOD", _("Fetching bininfo from ")) + \ re.sub(r'//(.+):.+@(.+)/', r'//\1:*password*@\2/', base_url) + "\n") - self.remotepkgs = portage.getbinpkg.dir_get_metadata( + self.__remotepkgs = portage.getbinpkg.dir_get_metadata( self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size) #writemsg(green(" -- DONE!\n\n")) - for mypkg in list(self.remotepkgs): - if "CATEGORY" not in self.remotepkgs[mypkg]: + for mypkg in list(self.__remotepkgs): + if "CATEGORY" not in self.__remotepkgs[mypkg]: #old-style or corrupt package writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, noiselevel=-1) - del self.remotepkgs[mypkg] + del self.__remotepkgs[mypkg] continue - mycat = self.remotepkgs[mypkg]["CATEGORY"].strip() + mycat = self.__remotepkgs[mypkg]["CATEGORY"].strip() fullpkg = mycat+"/"+mypkg[:-5] if fullpkg in metadata: @@ -832,7 +850,7 @@ class binarytree(object): # invalid tbz2's can hurt things. #print "cpv_inject("+str(fullpkg)+")" self.dbapi.cpv_inject(fullpkg) - remote_metadata = self.remotepkgs[mypkg] + remote_metadata = self.__remotepkgs[mypkg] for k, v in remote_metadata.items(): remote_metadata[k] = v.strip() @@ -853,7 +871,7 @@ class binarytree(object): except: writemsg(_("!!! Failed to inject remote binary package: %s\n") % fullpkg, noiselevel=-1) - del self.remotepkgs[mypkg] + del self.__remotepkgs[mypkg] continue self.populated=1 |