summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-20 06:43:16 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-20 06:43:16 -0700
commit567700e7cc0aa2ddb73128c9b02ffbeeefcf74e6 (patch)
treef5d62244cc8baef503a413f0b514b0ab04b8ab94
parent3623af181e95bb77d1fc9d46668ce8678ff6f267 (diff)
downloadportage-567700e7cc0aa2ddb73128c9b02ffbeeefcf74e6.tar.gz
portage-567700e7cc0aa2ddb73128c9b02ffbeeefcf74e6.tar.bz2
portage-567700e7cc0aa2ddb73128c9b02ffbeeefcf74e6.zip
Make the portagetree.root attribute a property that generates a
DeprecationWarning on access.
-rw-r--r--pym/portage/dbapi/porttree.py14
1 files changed, 11 insertions, 3 deletions
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)