From bb6448785038e812b806e14d16497a1a3aacd201 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 22 Sep 2011 17:47:48 -0700 Subject: Atom: add a with_repo method for adding a repo --- pym/portage/dep/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pym') diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 89b6f1547..5bb6becdb 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1216,6 +1216,18 @@ class Atom(_atom_base): return Atom(self.replace(_slot_separator + self.slot, '', 1), allow_repo=True, allow_wildcard=True) + def with_repo(self, repo): + if self.slot is None: + atom = self + else: + atom = remove_slot(self) + if self.slot is not None: + atom += _slot_separator + slot + atom += _repo_separator + repo + if self.use is not None: + atom += str(self.use) + return Atom(atom, allow_repo=True, allow_wildcard=True) + def with_slot(self, slot): atom = remove_slot(self) + _slot_separator + slot if self.repo is not None: -- cgit v1.2.3-1-g7c22