From 9ed91aff33d645d9d846d416cf21de33ab968f54 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Tue, 24 Aug 2010 12:00:22 +0200 Subject: [PATCH] Atom.violated_conditionals: Always treat deps as violated if the flag is not in IUSE --- pym/portage/dep/__init__.py | 23 +++++++++++++++++++++++ pym/portage/tests/dep/testAtom.py | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 723330571..cd0087ad7 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -763,12 +763,35 @@ class _use_dep(object): conditional = {} tokens = [] + all_defaults = frozenset(chain(self.missing_enabled, self.missing_disabled)) + + def validate_flag(flag): + return is_valid_flag(flag) or flag in all_defaults + + for x in self.tokens: m = _useflag_re.match(x) operator = m.group("prefix") + m.group("suffix") flag = m.group("flag") + if not validate_flag(flag): + tokens.append(x) + if not operator: + enabled_flags.add(flag) + elif operator == "-": + disabled_flags.add(flag) + elif operator == "?": + conditional.setdefault("enabled", set()).add(flag) + elif operator == "=": + conditional.setdefault("equal", set()).add(flag) + elif operator == "!=": + conditional.setdefault("not_equal", set()).add(flag) + elif operator == "!?": + conditional.setdefault("disabled", set()).add(flag) + + continue + if not operator: if flag not in other_use: if is_valid_flag(flag) or flag in self.missing_disabled: diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py index 4c504e013..31999dc2c 100644 --- a/pym/portage/tests/dep/testAtom.py +++ b/pym/portage/tests/dep/testAtom.py @@ -190,6 +190,14 @@ class TestAtom(TestCase): ("dev-libs/D[!x=]", [], ["x"], ["x"], "dev-libs/D"), ("dev-libs/D[!x(+)=]", [], [], ["x"], "dev-libs/D[!x(+)=]"), ("dev-libs/D[!x(-)=]", [], [], ["x"], "dev-libs/D"), + + #Missing IUSE test cases + ("dev-libs/B[x]", [], [], [], "dev-libs/B[x]"), + ("dev-libs/B[-x]", [], [], [], "dev-libs/B[-x]"), + ("dev-libs/B[x?]", [], [], [], "dev-libs/B[x?]"), + ("dev-libs/B[x=]", [], [], [], "dev-libs/B[x=]"), + ("dev-libs/B[!x=]", [], [], ["x"], "dev-libs/B[!x=]"), + ("dev-libs/B[!x?]", [], [], ["x"], "dev-libs/B[!x?]"), ) test_cases_xfail = ( -- 2.26.2