From af50fee789e71c1fff0b405db4cf55b618b73466 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 12 May 2012 18:07:29 -0700 Subject: _pkg_str: add slot and repo attributes --- pym/portage/versions.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pym/portage/versions.py') diff --git a/pym/portage/versions.py b/pym/portage/versions.py index ea8d5ae57..33c7159a5 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -339,10 +339,10 @@ class _pkg_str(_unicode): manually convert them to a plain unicode object first. """ - def __new__(cls, cpv, eapi=None): + def __new__(cls, cpv, slot=None, repo=None, eapi=None): return _unicode.__new__(cls, cpv) - def __init__(self, cpv, eapi=None): + def __init__(self, cpv, slot=None, repo=None, eapi=None): if not isinstance(cpv, _unicode): # Avoid TypeError from _unicode.__init__ with PyPy. cpv = _unicode_decode(cpv) @@ -353,6 +353,10 @@ class _pkg_str(_unicode): self.__dict__['cp'] = self.cpv_split[0] + '/' + self.cpv_split[1] # for match_from_list introspection self.__dict__['cpv'] = self + if slot is not None: + self.__dict__['slot'] = slot + if repo is not None: + self.__dict__['repo'] = repo def __setattr__(self, name, value): raise AttributeError("_pkg_str instances are immutable", -- cgit v1.2.3-1-g7c22