summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-19 09:57:18 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-19 09:57:18 -0800
commita551ca783486467f531a2e38ac3730826f1269bb (patch)
tree69660c6376ecbef1caf5d3d45f3c71b9e56f8bd3
parent389dc491de2d865ab7592f5c17fc39110921da18 (diff)
downloadportage-a551ca783486467f531a2e38ac3730826f1269bb.tar.gz
portage-a551ca783486467f531a2e38ac3730826f1269bb.tar.bz2
portage-a551ca783486467f531a2e38ac3730826f1269bb.zip
paren_enclose: preserve atom USE conditionals
The depgraph sometimes uses paren_enclose to temporarily convert parts of use_reduce output to a plain string. In these cases, we want to preserve atom USE conditionals, since these sometimes make a difference for IUSE checks during package matching (as in bug #348389).
-rw-r--r--pym/_emerge/depgraph.py6
-rw-r--r--pym/portage/dep/__init__.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 4aec743b5..7e47a4604 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1188,7 +1188,8 @@ class depgraph(object):
if not dep_string:
continue
- dep_string = portage.dep.paren_enclose(dep_string)
+ dep_string = portage.dep.paren_enclose(dep_string,
+ unevaluated_atom=True)
if not self._add_pkg_dep_string(
pkg, dep_root, dep_priority, dep_string,
@@ -1465,7 +1466,8 @@ class depgraph(object):
"""
pkg, dep_root, dep_priority, dep_struct = \
self._dynamic_config._dep_disjunctive_stack.pop()
- dep_string = portage.dep.paren_enclose(dep_struct)
+ dep_string = portage.dep.paren_enclose(dep_struct,
+ unevaluated_atom=True)
if not self._add_pkg_dep_string(
pkg, dep_root, dep_priority, dep_string, allow_unsatisfied):
return 0
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 52009fea3..10f6d8234 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -232,7 +232,7 @@ class paren_normalize(list):
self._zap_parens(x, dest)
return dest
-def paren_enclose(mylist):
+def paren_enclose(mylist, unevaluated_atom=False):
"""
Convert a list to a string with sublists enclosed with parens.
@@ -251,6 +251,8 @@ def paren_enclose(mylist):
if isinstance(x, list):
mystrparts.append("( "+paren_enclose(x)+" )")
else:
+ if unevaluated_atom:
+ x = getattr(x, 'unevaluated_atom', x)
mystrparts.append(x)
return " ".join(mystrparts)