support multi requirement with inverse for same option
This commit is contained in:
@ -869,8 +869,19 @@ def validate_requires_arg(requires, name):
|
||||
" action: {1}").format(name, action))
|
||||
else:
|
||||
config_action[action] = inverse
|
||||
if action not in ret_requires:
|
||||
ret_requires[action] = {}
|
||||
if option not in ret_requires[action]:
|
||||
ret_requires[action][option] = (option, [expected], action,
|
||||
inverse, transitive, same_action)
|
||||
else:
|
||||
ret_requires[action][option][1].append(expected)
|
||||
|
||||
ret_requires.setdefault(action, []).append((option, expected, action,
|
||||
inverse, transitive, same_action))
|
||||
|
||||
return tuple(tuple(ret) for ret in ret_requires.values())
|
||||
ret = []
|
||||
for opt_requires in ret_requires.values():
|
||||
ret_action = []
|
||||
for require in opt_requires.values():
|
||||
req = (require[0], tuple(require[1]), require[2], require[3], require[4], require[5])
|
||||
ret_action.append(req)
|
||||
ret.append(tuple(ret_action))
|
||||
return tuple(ret)
|
||||
|
@ -360,12 +360,12 @@ class Setting(object):
|
||||
raise RequirementError(_("option '{0}' has requirement's property error: "
|
||||
"{1} {2}").format(opt._name, path, properties))
|
||||
#transitive action, force expected
|
||||
value = expected
|
||||
value = expected[0]
|
||||
inverse = False
|
||||
except AttributeError:
|
||||
raise AttributeError(_("required option not found: "
|
||||
"{0}").format(path))
|
||||
if not inverse and value == expected or inverse and value != expected:
|
||||
if not inverse and value in expected or inverse and value not in expected:
|
||||
matches = True
|
||||
setting.append(action)
|
||||
## the calculation cannot be carried out
|
||||
|
Reference in New Issue
Block a user