From 8de9c598c6edf0f792a36700fa759b510acca368 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 30 Jan 2010 12:46:30 +0000 Subject: Deprecate the first parameter of the portdbapi constructor since it is always the same as mysettings['PORTDIR']. svn path=/main/trunk/; revision=15281 --- pym/portage/dbapi/porttree.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 7536f7972..1b5567a8e 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -141,7 +141,13 @@ class portdbapi(dbapi): def _categories(self): return self.settings.categories - def __init__(self, porttree_root, mysettings=None): + def __init__(self, _unused_param=None, mysettings=None): + """ + @param _unused_param: deprecated + @type _unused_param: None + @param mysettings: an immutable config instance + @type mysettings: portage.config + """ portdbapi.portdbapi_instances.append(self) from portage import config @@ -151,6 +157,15 @@ class portdbapi(dbapi): from portage import settings self.mysettings = config(clone=settings) + if _unused_param is not None: + warnings.warn("The first parameter of the " + \ + "portage.dbapi.porttree.portdbapi" + \ + " constructor is now unused. Use " + \ + "mysettings['PORTDIR'] instead.", + DeprecationWarning) + + porttree_root = self.mysettings['PORTDIR'] + # This is strictly for use in aux_get() doebuild calls when metadata # is generated by the depend phase. It's safest to use a clone for # this purpose because doebuild makes many changes to the config @@ -1182,8 +1197,7 @@ class portagetree(object): self.settings = settings self.portroot = settings["PORTDIR"] self.virtual = virtual - self.dbapi = portdbapi( - settings["PORTDIR"], mysettings=settings) + self.dbapi = portdbapi(mysettings=settings) def dep_bestmatch(self,mydep): "compatibility method" -- cgit v1.2.3-1-g7c22