Bug #335620 - Add backward compatible config.virtuals and virts_p
authorZac Medico <zmedico@gentoo.org>
Thu, 2 Sep 2010 21:10:51 +0000 (14:10 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 2 Sep 2010 21:10:51 +0000 (14:10 -0700)
properties, and trigger a DeprecationWarning if they are accessed.

pym/portage/package/ebuild/config.py

index 6ccb1da5f3410737568fc3d4c79772c90afcaa8f..22edda68ef763e798a93295d59f523507988a559 100644 (file)
@@ -1977,6 +1977,20 @@ class config(object):
                myflags.difference_update(self.usemask)
                self.configlist[-1]["USE"]= " ".join(sorted(myflags))
 
+       @property
+       def virts_p(self):
+               warnings.warn("portage config.virts_p attribute " + \
+                       "is deprecated, use config.get_virts_p()",
+                       DeprecationWarning, stacklevel=2)
+               return self.get_virts_p()
+
+       @property
+       def virtuals(self):
+               warnings.warn("portage config.virtuals attribute " + \
+                       "is deprecated, use config.getvirtuals()",
+                       DeprecationWarning, stacklevel=2)
+               return self.getvirtuals()
+
        def get_virts_p(self):
                return self._virtuals_manager.get_virts_p()