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 1QRkZl-00035Z-8b for garchives@archives.gentoo.org; Wed, 01 Jun 2011 12:31:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5C65B1C064; Wed, 1 Jun 2011 12:30:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3088C1C04C for ; Wed, 1 Jun 2011 12:30:18 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E50A51B400E for ; Wed, 1 Jun 2011 12:30:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 42ED68050E for ; Wed, 1 Jun 2011 12:30:17 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <9b8e3b50dd05b6a799a919c40e992dd1f987e9c4.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/repository/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: PMSTestSuite/repository/__init__.py X-VCS-Directories: PMSTestSuite/repository/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 9b8e3b50dd05b6a799a919c40e992dd1f987e9c4 Date: Wed, 1 Jun 2011 12:30:17 +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: X-Archives-Hash: 60a14114e16dd6b160da13e27c991d94 commit: 9b8e3b50dd05b6a799a919c40e992dd1f987e9c4 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Wed Jun 1 12:15:18 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Wed Jun 1 12:15:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D9b8e3b50 Update files dict in add_category() instead of spawning a new write. --- PMSTestSuite/repository/__init__.py | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/PMSTestSuite/repository/__init__.py b/PMSTestSuite/repositor= y/__init__.py index 70f3727..9af204a 100644 --- a/PMSTestSuite/repository/__init__.py +++ b/PMSTestSuite/repository/__init__.py @@ -49,7 +49,7 @@ class EbuildRepository(object): if tail in ('eclass', 'profiles'): pass elif tail not in self.categories: - self.add_category(tail) + self.add_category(tail, files) =20 fp =3D os.path.join(self.path, fn) if not os.path.exists(os.path.dirname(fp)): @@ -63,8 +63,11 @@ class EbuildRepository(object): dirs =3D frozenset([os.path.join(self.path, os.path.dirname(f)) for f = in files]) pm.remanifest(dirs) =20 - def add_category(self, catname): - """ Add category to profiles/categories. """ + def add_category(self, catname, files): + """ + Add category to profiles/categories. Update + the profiles/categories file in dict. + """ raise ValueError("The repository doesn't support %s category." % catna= me) =09 class NewEbuildRepository(EbuildRepository): @@ -87,11 +90,10 @@ class NewEbuildRepository(EbuildRepository): f.close() =20 EbuildRepository.__init__(self, path) - =09 - def add_category(self, catname): + + def add_category(self, catname, files): + # XXX: profiles/categories can contain new categories already + # and they may not be in self.categories self.categories.append(catname) newcats =3D '\n'.join(self.categories) - files =3D { - os.path.join('profiles', 'categories'): newcats - } - self.write_files(files) + files[os.path.join('profiles', 'categories')] =3D newcats