Commit 32e10b9e authored by Julien Muchembled's avatar Julien Muchembled

Ignore NameError in unused conditional configuration sections

Adding new names for expression is currently not possible
because buildout aborts before it tries to upgrade.
parent 5f1f7d23
......@@ -1338,7 +1338,9 @@ class Buildout(DictMixin):
data = self._raw[section]
except KeyError:
raise MissingSection(section)
e = data.get('__unsupported_conditional_expression__')
if e:
raise e
options = self.Options(self, section, data)
self._data[section] = options
options._initialize()
......
......@@ -187,7 +187,12 @@ def parse(fp, fpname, exp_globals=dict):
if not context:
context = exp_globals()
# evaluated expression is in list: get first element
try:
section_condition = eval(expr, context)[0]
except NameError as x:
sections.setdefault(sectname, {})[
'__unsupported_conditional_expression__'] = x
continue
# finally, ignore section when an expression
# evaluates to false
if not section_condition:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment