Show a deprecation warning when getvirtuals() is called.
authorZac Medico <zmedico@gentoo.org>
Sun, 21 Feb 2010 09:53:03 +0000 (09:53 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 21 Feb 2010 09:53:03 +0000 (09:53 -0000)
svn path=/main/trunk/; revision=15416

pym/portage/__init__.py

index 8af1bb4b1d1878d99457ea3805386de6e0e50de6..6515b919e90b09efc9c5f5c66c45481602d98f78 100644 (file)
@@ -3520,6 +3520,12 @@ class config(object):
                self.already_in_regenerate = 0
 
        def get_virts_p(self, myroot=None):
+
+               if myroot is not None:
+                       warnings.warn("The 'myroot' parameter for " + \
+                               "portage.config.get_virts_p() is deprecated",
+                               DeprecationWarning, stacklevel=2)
+
                if self.virts_p:
                        return self.virts_p
                virts = self.getvirtuals()
@@ -3533,6 +3539,12 @@ class config(object):
        def getvirtuals(self, myroot=None):
                """myroot is now ignored because, due to caching, it has always been
                broken for all but the first call."""
+
+               if myroot is not None:
+                       warnings.warn("The 'myroot' parameter for " + \
+                               "portage.config.getvirtuals() is deprecated",
+                               DeprecationWarning, stacklevel=2)
+
                myroot = self["ROOT"]
                if self.virtuals:
                        return self.virtuals
@@ -8456,8 +8468,8 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
        mysplit = versions._pkgsplit(myslash[-1])
        if settings is None:
                settings = globals()["settings"]
-       virts = settings.getvirtuals("/")
-       virts_p = settings.get_virts_p("/")
+       virts = settings.getvirtuals()
+       virts_p = settings.get_virts_p()
        if len(myslash)>2:
                # this is illegal case.
                mysplit=[]
@@ -8947,9 +8959,14 @@ def deprecated_profile_check(settings=None):
 
 # gets virtual package settings
 def getvirtuals(myroot):
+       """
+       Calls portage.settings.getvirtuals().
+       @deprecated: Use portage.settings.getvirtuals().
+       """
        global settings
-       writemsg("--- DEPRECATED call to getvirtual\n")
-       return settings.getvirtuals(myroot)
+       warnings.warn("portage.getvirtuals() is deprecated",
+               DeprecationWarning, stacklevel=2)
+       return settings.getvirtuals()
 
 def commit_mtimedb(mydict=None, filename=None):
        if mydict is None: