summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-05-19 14:04:13 +0200
committerZac Medico <zmedico@gentoo.org>2010-05-20 02:52:02 -0700
commitf3e9d04bfbca52991f0f8f26d29babce379ceb47 (patch)
treed87debf8420f6e6663d65f32de2255203730bf55
parentAdd _emerge.Package.__str__() for nicer output formatting (diff)
downloadportage-idfetch-f3e9d04bfbca52991f0f8f26d29babce379ceb47.tar.gz
portage-idfetch-f3e9d04bfbca52991f0f8f26d29babce379ceb47.tar.bz2
portage-idfetch-f3e9d04bfbca52991f0f8f26d29babce379ceb47.zip
Add portage.dep.Atom.unevaluated_atom to not lose the original use dep in Atom.evaluate_conditionals()
-rw-r--r--pym/portage/dep/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 34195393..146caa70 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -549,7 +549,10 @@ class Atom(_atom_base):
def __init__(self, forbid_overlap=False):
self.overlap = self._overlap(forbid=forbid_overlap)
- def __init__(self, s):
+ def __new__(cls, s, unevaluated_atom=None):
+ return _atom_base.__new__(cls, s)
+
+ def __init__(self, s, unevaluated_atom=None):
if isinstance(s, Atom):
# This is an efficiency assertion, to ensure that the Atom
# constructor is not called redundantly.
@@ -608,6 +611,11 @@ class Atom(_atom_base):
self.__dict__['use'] = use
self.__dict__['without_use'] = without_use
+ if unevaluated_atom:
+ self.__dict__['unevaluated_atom'] = unevaluated_atom
+ else:
+ self.__dict__['unevaluated_atom'] = self
+
def __setattr__(self, name, value):
raise AttributeError("Atom instances are immutable",
self.__class__, name, value)
@@ -657,7 +665,7 @@ class Atom(_atom_base):
if self.slot:
atom += ":%s" % self.slot
atom += str(self.use.evaluate_conditionals(use))
- return Atom(atom)
+ return Atom(atom, self)
def __copy__(self):
"""Immutable, so returns self."""