commit: bbe00f515b80be3d6e279e4033f1cbc776a7fe27 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun Jan 20 06:39:39 2019 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sun Jan 20 06:53:34 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bbe00f51
portagetree: getname and portroot DeprecationWarning Bug: https://bugs.gentoo.org/668164 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/dbapi/porttree.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py index 76b7967f7..2ff3e1b34 100644 --- a/lib/portage/dbapi/porttree.py +++ b/lib/portage/dbapi/porttree.py @@ -1339,10 +1339,18 @@ class portagetree(object): " constructor is unused", DeprecationWarning, stacklevel=2) - self.portroot = settings["PORTDIR"] self.__virtual = virtual self.dbapi = portdbapi(mysettings=settings) + @property + def portroot(self): + """Deprecated. Use the portdbapi getRepositoryPath method instead.""" + warnings.warn("The portroot attribute of " + "portage.dbapi.porttree.portagetree is deprecated. Use the " + "portdbapi getRepositoryPath method instead.", + DeprecationWarning, stacklevel=3) + return self.settings['PORTDIR'] + @property def root(self): warnings.warn("The root attribute of " + \ @@ -1383,7 +1391,11 @@ class portagetree(object): return self.dbapi.cp_all() def getname(self, pkgname): - "returns file location for this particular package (DEPRECATED)" + """Deprecated. Use the portdbapi findname method instead.""" + warnings.warn("The getname method of " + "portage.dbapi.porttree.portagetree is deprecated. " + "Use the portdbapi findname method instead.", + DeprecationWarning, stacklevel=2) if not pkgname: return "" mysplit = pkgname.split("/")
