From c626e20620cb7004d0fe55e18288a0f15fcb48d7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 10 Sep 2011 07:25:19 -0700 Subject: [PATCH] Atom: add a with_slot method for adding a slot --- pym/portage/dep/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- 2.26.2