From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SbAil-0000hK-8s for garchives@archives.gentoo.org; Sun, 03 Jun 2012 13:19:51 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1C81CE0733; Sun, 3 Jun 2012 13:19:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CDF1EE0741 for ; Sun, 3 Jun 2012 13:19:37 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 136431B4024 for ; Sun, 3 Jun 2012 13:19:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id BA69AE5432 for ; Sun, 3 Jun 2012 13:19:34 +0000 (UTC) From: "Slava Bacherikov" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Slava Bacherikov" Message-ID: <1338727578.578144075b13c6e755525dd8565d706baf7d7bff.bacher09@gentoo> Subject: [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/ X-VCS-Repository: proj/gentoo-packages X-VCS-Files: gpackages/libs/herds.py X-VCS-Directories: gpackages/libs/ X-VCS-Committer: bacher09 X-VCS-Committer-Name: Slava Bacherikov X-VCS-Revision: 578144075b13c6e755525dd8565d706baf7d7bff X-VCS-Branch: master Date: Sun, 3 Jun 2012 13:19:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: aa58aa0f-84d7-4593-bfd8-ab8f64c0f0d6 X-Archives-Hash: 027eb5c2958a2cbe4a2582fdf0739ab2 commit: 578144075b13c6e755525dd8565d706baf7d7bff Author: Slava Bacherikov bacher09 org> AuthorDate: Sun Jun 3 12:46:18 2012 +0000 Commit: Slava Bacherikov bacherikov org ua> CommitDate: Sun Jun 3 12:46:18 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoo-packag= es.git;a=3Dcommit;h=3D57814407 Changes in herds layer. --- gpackages/libs/herds.py | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gpackages/libs/herds.py b/gpackages/libs/herds.py index b1e596b..02d2782 100644 --- a/gpackages/libs/herds.py +++ b/gpackages/libs/herds.py @@ -29,6 +29,11 @@ class AbstarctXmlObject(object): class Maintainer(AbstarctXmlObject, ToStrMixin): attrs =3D ('name', 'email', 'role') =20 + def __init__(self, *args, **kwargs): + super(Maintainer, self).__init__(*args, **kwargs) + if self._email is not None: + self._email =3D self._email.lower() + def __eq__(self, other): return self.email =3D=3D other.email =20 @@ -47,21 +52,31 @@ class Herd(AbstarctXmlObject, ToStrMixin): =20 def __init__(self, xml_object): super(Herd, self).__init__(xml_object)=20 - self._iter_maintainer =3D xml_object.iterfind('maintainer') + self._xml_object =3D xml_object + + def __eq__(self, other): + return self.name =3D=3D other.name + + def __ne__(self, other): + return self.name !=3D other.name + + def __hash__(self): + return hash(self.name) =20 def iter_mainteiner(self): - for maintainer_tree in self._iter_maintainer: + for maintainer_tree in self._xml_object.iterfind('maintainer'): yield Maintainer(maintainer_tree) =20 def __unicode__(self): return self.name =20 =20 -class Herds(object): +class Herds(ToStrMixin): def __init__(self, herd_path=3D'/usr/portage/metadata/herds.xml'): self._herd_path =3D herd_path self._herd_parse =3D etree.parse(herd_path) self._herds_dict =3D None + self._maintainers_dict =3D None =20 def iter_herd(self): for herd_tree in self._herd_parse.iterfind('herd'): @@ -77,9 +92,15 @@ class Herds(object): return res =20 def get_maintainers_with_hers(self): + if self._maintainers_dict is not None: + return self._maintainers_dict herd_dict =3D self.get_herds_indict() maintainer_dict =3D defaultdict(list) for herd in herd_dict.itervalues(): for maintainer in herd.iter_mainteiner(): maintainer_dict[maintainer].append(herd.name) + self._maintainers_dict =3D maintainer_dict return maintainer_dict + + def __unicode__(self): + return self._herd_path