Make portdbapi constructor backward compatible.
authorZac Medico <zmedico@gentoo.org>
Tue, 19 Oct 2010 04:29:37 +0000 (21:29 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 19 Oct 2010 04:29:37 +0000 (21:29 -0700)
pym/portage/dbapi/porttree.py

index 3b527cf5c63baf67b3471b7d025ba7fbfd6533dd..938877ca1ae67a9f169f6ede2e7d5118ea2e85ae 100644 (file)
@@ -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