diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-01-28 05:37:57 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-01-28 05:37:57 +0000 |
commit | b3222041e0eeca52708b36da8462b09160f48789 (patch) | |
tree | 174a9929279b2c25a52eaee6885f98f81285ea07 /pym | |
parent | 0d838ad5a25a409b96461e56b420b599b247c70a (diff) | |
download | portage-b3222041e0eeca52708b36da8462b09160f48789.tar.gz portage-b3222041e0eeca52708b36da8462b09160f48789.tar.bz2 portage-b3222041e0eeca52708b36da8462b09160f48789.zip |
Add an Atom.evaluate_conditionals() method and use where appropriate.
svn path=/main/trunk/; revision=15212
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/__init__.py | 6 | ||||
-rw-r--r-- | pym/portage/dep.py | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 23e69cabf..5f62fd7ae 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -7815,11 +7815,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", if not repoman and \ myuse is not None and isinstance(x, portage.dep.Atom) and x.use: if x.use.conditional: - evaluated_atom = portage.dep.remove_slot(x) - if x.slot: - evaluated_atom += ":%s" % x.slot - evaluated_atom += str(x.use.evaluate_conditionals(myuse)) - x = portage.dep.Atom(evaluated_atom) + x = x.evaluate_conditionals(myuse) mykey = x.cp if not mykey.startswith("virtual/"): diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 70d95e484..409bc93de 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -612,6 +612,22 @@ class Atom(_atom_base): return False + def evaluate_conditionals(self, use): + """ + Create an atom instance with any USE conditionals evaluated. + @param use: The set of enabled USE flags + @type other: set + @rtype: Atom + @return: an atom instance with any USE conditionals evaluated + """ + if not self.use.conditional: + return self + atom = remove_slot(self) + if self.slot: + atom += ":%s" % self.slot + atom += str(self.use.evaluate_conditionals(use)) + return Atom(atom) + def __copy__(self): """Immutable, so returns self.""" return self |