From: Zac Medico Date: Fri, 20 Aug 2010 13:43:16 +0000 (-0700) Subject: Make the portagetree.root attribute a property that generates a X-Git-Tag: v2.2_rc68~57 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=567700e7cc0aa2ddb73128c9b02ffbeeefcf74e6;p=portage.git Make the portagetree.root attribute a property that generates a DeprecationWarning on access. --- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index c925d9bf8..a604260b2 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -1060,7 +1060,7 @@ class portagetree(object): """ Constructor for a PortageTree - @param root: ${ROOT}, defaults to '/', see make.conf(5) + @param root: deprectated, defaults to settings['ROOT'] @type root: String/Path @param virtual: UNUSED @type virtual: No Idea @@ -1072,8 +1072,7 @@ class portagetree(object): settings = portage.settings self.settings = settings - self.root = settings['ROOT'] - if root is not None and root != self.root: + if root is not None and root != settings['ROOT']: warnings.warn("The root parameter of the " + \ "portage.dbapi.porttree.portagetree" + \ " constructor is now unused. Use " + \ @@ -1084,6 +1083,15 @@ class portagetree(object): self.virtual = virtual self.dbapi = portdbapi(mysettings=settings) + @property + def root(self): + warnings.warn("The root attribute of " + \ + "portage.dbapi.porttree.portagetree" + \ + " is deprecated. Use " + \ + "settings['ROOT'] instead.", + DeprecationWarning, stacklevel=2) + return self.settings['ROOT'] + def dep_bestmatch(self,mydep): "compatibility method" mymatch = self.dbapi.xmatch("bestmatch-visible",mydep)