From a2b4784108a9748b5826ee16e4daebd01def7460 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 18 Oct 2010 21:29:37 -0700 Subject: [PATCH] Make portdbapi constructor backward compatible. --- pym/portage/dbapi/porttree.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 3b527cf5c..938877ca1 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -68,7 +68,7 @@ class portdbapi(dbapi): def porttree_root(self): return self.settings.repositories.mainRepoLocation() - def __init__(self, mysettings=None): + def __init__(self, _unused_param=None, mysettings=None): """ @param _unused_param: deprecated, use mysettings['PORTDIR'] instead @type _unused_param: None @@ -84,6 +84,14 @@ class portdbapi(dbapi): from portage import settings self.settings = config(clone=settings) + if _unused_param is not None and \ + _unused_param != self.settings['PORTDIR']: + warnings.warn("The first parameter of the " + \ + "portage.dbapi.porttree.portdbapi" + \ + " constructor is now unused. " + \ + "mysettings['PORTDIR'] will be used instead.", + DeprecationWarning, stacklevel=2) + self.repositories = self.settings.repositories self.treemap = self.repositories.treemap -- 2.26.2