diff options
author | 2010-05-25 12:18:28 +0200 | |
---|---|---|
committer | 2010-05-25 04:43:46 -0700 | |
commit | 0abb4b72c31bbdc17e65103c5913ef1652ce7357 (patch) | |
tree | 2ce91ee80bc36e1aaec87257a6531bc395b05ea9 | |
parent | Fix traceback in _show_unsatisfied_dep, reported on forums: (diff) | |
download | portage-idfetch-0abb4b72c31bbdc17e65103c5913ef1652ce7357.tar.gz portage-idfetch-0abb4b72c31bbdc17e65103c5913ef1652ce7357.tar.bz2 portage-idfetch-0abb4b72c31bbdc17e65103c5913ef1652ce7357.zip |
Make parent_use parameter for portage.dep.Atom.violated_conditionals() optional (for evaluated atoms)
-rw-r--r-- | pym/_emerge/depgraph.py | 5 | ||||
-rw-r--r-- | pym/portage/dep/__init__.py | 30 |
2 files changed, 18 insertions, 17 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 3a35e84e..ff561f7f 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2269,9 +2269,8 @@ class depgraph(object): # Lets see if the violated use deps are conditional. # If so, suggest to change them on the parent. mreasons = [] - violated_atom = atom.unevaluated_atom.violated_conditionals(myparent.use.enabled, pkg.use.enabled) - if violated_atom.use and not \ - (violated_atom.use.enabled or violated_atom.use.disabled): + violated_atom = atom.unevaluated_atom.violated_conditionals(pkg.use.enabled, myparent.use.enabled) + if not (violated_atom.use.enabled or violated_atom.use.disabled): #all violated use deps are conditional changes = [] conditional = violated_atom.use.conditional diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index bc04e5be..5de6de1a 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -499,26 +499,28 @@ class _use_dep(object): tokens.extend(x for x in conditional.not_equal if x not in use) return _use_dep(tokens) - - def violated_conditionals(self, use, other_use): + + def violated_conditionals(self, other_use, parent_use=None): """ - Create a new instance with satisfied conditionals removed. + Create a new instance with satisfied use deps removed. """ tokens = [] - + conditional = self.conditional tokens.extend(x for x in self.enabled if x not in other_use) tokens.extend("-" + x for x in self.disabled if x in other_use) if conditional: - tokens.extend(x + "?" for x in conditional.enabled if x in use and not x in other_use) - tokens.extend("!" + x + "?" for x in conditional.disabled if x not in use and x in other_use) - tokens.extend(x + "=" for x in conditional.equal if x in use and x not in other_use) - tokens.extend(x + "=" for x in conditional.equal if x not in use and x in other_use) - tokens.extend("!" + x + "=" for x in conditional.not_equal if x in use and x in other_use) - tokens.extend("!" + x + "=" for x in conditional.not_equal if x not in use and x not in other_use) - - return _use_dep(tokens) + if not parent_use: + raise InvalidAtom("violated_conditionals needs 'parent_use'" + \ + " parameter for conditional flags: '%s'" % (token,)) + tokens.extend(x + "?" for x in conditional.enabled if x in parent_use and not x in other_use) + tokens.extend("!" + x + "?" for x in conditional.disabled if x not in parent_use and x in other_use) + tokens.extend(x + "=" for x in conditional.equal if x in parent_use and x not in other_use) + tokens.extend(x + "=" for x in conditional.equal if x not in parent_use and x in other_use) + tokens.extend("!" + x + "=" for x in conditional.not_equal if x in parent_use and x in other_use) + tokens.extend("!" + x + "=" for x in conditional.not_equal if x not in parent_use and x not in other_use) + return _use_dep(tokens) def _eval_qa_conditionals(self, use_mask, use_force): """ @@ -687,7 +689,7 @@ class Atom(_atom_base): atom += str(self.use.evaluate_conditionals(use)) return Atom(atom, self) - def violated_conditionals(self, use, other_use): + def violated_conditionals(self, other_use, parent_use=None): """ Create an atom instance with any USE conditional removed, that is satisfied by other_use. @@ -703,7 +705,7 @@ class Atom(_atom_base): atom = remove_slot(self) if self.slot: atom += ":%s" % self.slot - atom += str(self.use.violated_conditionals(use, other_use)) + atom += str(self.use.violated_conditionals(other_use, parent_use)) return Atom(atom, self) def __copy__(self): |