From f3e9d04bfbca52991f0f8f26d29babce379ceb47 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Wed, 19 May 2010 14:04:13 +0200 Subject: [PATCH] Add portage.dep.Atom.unevaluated_atom to not lose the original use dep in Atom.evaluate_conditionals() --- pym/portage/dep/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 341953930..146caa709 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.""" -- 2.26.2