From: Zac Medico Date: Sat, 10 Sep 2011 14:25:19 +0000 (-0700) Subject: Atom: add a with_slot method for adding a slot X-Git-Tag: v2.2.0_alpha56~39 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c626e20620cb7004d0fe55e18288a0f15fcb48d7;p=portage.git Atom: add a with_slot method for adding a slot --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index fd5ad3065..89b6f1547 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1216,6 +1216,14 @@ class Atom(_atom_base): return Atom(self.replace(_slot_separator + self.slot, '', 1), allow_repo=True, allow_wildcard=True) + def with_slot(self, slot): + atom = remove_slot(self) + _slot_separator + slot + if self.repo is not None: + atom += _repo_separator + self.repo + if self.use is not None: + atom += str(self.use) + return Atom(atom, allow_repo=True, allow_wildcard=True) + def __setattr__(self, name, value): raise AttributeError("Atom instances are immutable", self.__class__, name, value)