Add Atom._eval_qa_conditionals method, which unevaluated_atom support
authorZac Medico <zmedico@gentoo.org>
Wed, 16 Jun 2010 17:30:34 +0000 (10:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 16 Jun 2010 17:30:34 +0000 (10:30 -0700)
that will be useful for repoman atom display.

pym/portage/dep/__init__.py
pym/portage/dep/dep_check.py

index 5de6de1aea6ed80922376b5ccd9c74c70c4afbf4..5fbe0dc3bdf4c987d006db213e1f20941c455bd0 100644 (file)
@@ -687,7 +687,7 @@ class Atom(_atom_base):
                if self.slot:
                        atom += ":%s" % self.slot
                atom += str(self.use.evaluate_conditionals(use))
-               return Atom(atom, self)
+               return Atom(atom, unevaluated_atom=self)
 
        def violated_conditionals(self, other_use, parent_use=None):
                """
@@ -706,7 +706,16 @@ class Atom(_atom_base):
                if self.slot:
                        atom += ":%s" % self.slot
                atom += str(self.use.violated_conditionals(other_use, parent_use))
-               return Atom(atom, self)
+               return Atom(atom, unevaluated_atom=self)
+
+       def _eval_qa_conditionals(self, use_mask, use_force):
+               if not (self.use and self.use.conditional):
+                       return self
+               atom = remove_slot(self)
+               if self.slot:
+                       atom += ":%s" % self.slot
+               atom += str(self.use._eval_qa_conditionals(use_mask, use_force))
+               return Atom(atom, unevaluated_atom=self)
 
        def __copy__(self):
                """Immutable, so returns self."""
index 73bcfabc0a35813ccd10f0ac86e14c19441e3f34..f4a44611837ccc1b4e3bdcb7f503c6e7285a37c9 100644 (file)
@@ -76,13 +76,8 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                                        raise ParseError(
                                                _("invalid atom: '%s'") % (x,))
 
-               if repoman and x.use and x.use.conditional:
-                       evaluated_atom = remove_slot(x)
-                       if x.slot:
-                               evaluated_atom += ":%s" % x.slot
-                       evaluated_atom += str(x.use._eval_qa_conditionals(
-                               use_mask, use_force))
-                       x = Atom(evaluated_atom)
+               if repoman:
+                       x = x._eval_qa_conditionals(use_mask, use_force)
 
                if not repoman and \
                        myuse is not None and isinstance(x, Atom) and x.use: