commit: 298bd98dabaa92e85a57795fa37ef47d3379092d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 7 22:38:49 2016 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 21:39:04 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=298bd98d
config.setcpv: add recursion assertion
pym/portage/package/ebuild/config.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/pym/portage/package/ebuild/config.py
b/pym/portage/package/ebuild/config.py
index 7de4df7..505c7a2 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1372,6 +1372,21 @@ class config(object):
return value
+ def _setcpv_recursion_gate(f):
+ """
+ Raise AssertionError for recursive setcpv calls.
+ """
+ def wrapper(self, *args, **kwargs):
+ if hasattr(self, '_setcpv_active'):
+ raise AssertionError('setcpv recursion
detected')
+ self._setcpv_active = True
+ try:
+ return f(self, *args, **kwargs)
+ finally:
+ del self._setcpv_active
+ return wrapper
+
+ @_setcpv_recursion_gate
def setcpv(self, mycpv, use_cache=None, mydb=None):
"""
Load a particular CPV into the config, this lets us see the