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 1QQk46-00026h-V9 for garchives@archives.gentoo.org; Sun, 29 May 2011 17:46:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 49C391C058; Sun, 29 May 2011 17:46:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1AF751C058 for ; Sun, 29 May 2011 17:46:07 +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 A89942AC044 for ; Sun, 29 May 2011 17:46:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D61948050C for ; Sun, 29 May 2011 17:46:05 +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: <8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: PMSTestSuite/cli.py ebuild-generator X-VCS-Directories: / PMSTestSuite/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f Date: Sun, 29 May 2011 17:46:05 +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: 04ee363772f892b68e8fbd4605110de4 commit: 8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Sun May 29 17:45:45 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Sun May 29 17:45:45 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D8b3a2bcf Use argv in main()/_start() instead of __init__(). --- PMSTestSuite/cli.py | 10 ++++------ ebuild-generator | 12 ++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py index a0d957c..746d9f8 100644 --- a/PMSTestSuite/cli.py +++ b/PMSTestSuite/cli.py @@ -25,16 +25,13 @@ class PMSTestSuiteCLI(object): - repository (EbuildRepository). """ =20 - def __init__(self, prog): + def __init__(self): """ Initialize the class. Set the option parser up. =09 - program name for optparse output (argv[0]) """ - opt =3D OptionParser( - prog =3D os.path.basename(prog), - version =3D PV - ) + opt =3D OptionParser(version =3D PV) =20 # XXX: -r for getting through PM's repo_name opt.add_option('-R', '--repository-path', dest=3D'repo_path', @@ -49,7 +46,7 @@ class PMSTestSuiteCLI(object): =20 self.optparser =3D opt =20 - def _start(self, args): + def _start(self, prog, *args): """ Initialize the program. Parse command-line args. Instantiate classes encapsulating the Package Manager, test library and repository. @@ -57,6 +54,7 @@ class PMSTestSuiteCLI(object): - command line args (argv[1:]) """ opt =3D self.optparser + opt.prog =3D os.path.basename(prog) (opts, args) =3D opt.parse_args(list(args)) =20 if not opts.repo_path: diff --git a/ebuild-generator b/ebuild-generator index 94b227a..caac6ba 100755 --- a/ebuild-generator +++ b/ebuild-generator @@ -8,12 +8,8 @@ import sys from PMSTestSuite.cli import PMSTestSuiteCLI =20 class EbuildGenCLI(PMSTestSuiteCLI): - def __init__(self, prog, *args): - PMSTestSuiteCLI.__init__(self, prog) - self._args =3D args - - def main(self): - self._start(self._args) + def main(self, argv): + self._start(*argv) =20 files =3D {} for t in self.test_library: @@ -25,5 +21,5 @@ class EbuildGenCLI(PMSTestSuiteCLI): return 0 =20 if __name__ =3D=3D '__main__': - cli =3D EbuildGenCLI(*sys.argv) - sys.exit(cli.main()) + cli =3D EbuildGenCLI() + sys.exit(cli.main(sys.argv))