diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-12-24 12:20:58 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-12-24 12:20:58 -0800 |
commit | a5fdf591cffaa787ac8c579f853e5ea8c20b4543 (patch) | |
tree | 4942cec19f9521ad876975d2d8ac8a6549ed7e6d | |
parent | b4440ce6a87d7c6932132185697dd3c4888d752c (diff) | |
download | portage-a5fdf591cffaa787ac8c579f853e5ea8c20b4543.tar.gz portage-a5fdf591cffaa787ac8c579f853e5ea8c20b4543.tar.bz2 portage-a5fdf591cffaa787ac8c579f853e5ea8c20b4543.zip |
porttree.py: tweak deprecated constructor params
Trigger a DeprecationWarning even when None is passed in for one of the
deprecated parameters, ensuring that any potentially unsafe usage
triggers the warning.
-rw-r--r-- | pym/portage/dbapi/porttree.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 9f0140cdf..35f4e2d09 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -65,7 +65,7 @@ class portdbapi(dbapi): return None return main_repo.eclass_db - def __init__(self, _unused_param=None, mysettings=None): + def __init__(self, _unused_param=DeprecationWarning, mysettings=None): """ @param _unused_param: deprecated, use mysettings['PORTDIR'] instead @type _unused_param: None @@ -81,7 +81,7 @@ class portdbapi(dbapi): from portage import settings self.settings = config(clone=settings) - if _unused_param is not None: + if _unused_param is not DeprecationWarning: warnings.warn("The first parameter of the " + \ "portage.dbapi.porttree.portdbapi" + \ " constructor is unused since portage-2.1.8. " + \ @@ -986,7 +986,8 @@ def close_portdbapi_caches(): portage.process.atexit_register(portage.portageexit) class portagetree(object): - def __init__(self, root=None, virtual=DeprecationWarning, settings=None): + def __init__(self, root=DeprecationWarning, virtual=DeprecationWarning, + settings=None): """ Constructor for a PortageTree @@ -1002,7 +1003,7 @@ class portagetree(object): settings = portage.settings self.settings = settings - if root is not None and root != settings['ROOT']: + if root is not DeprecationWarning: warnings.warn("The root parameter of the " + \ "portage.dbapi.porttree.portagetree" + \ " constructor is now unused. Use " + \ |