public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
Date: Sun, 29 May 2011 17:46:05 +0000 (UTC)	[thread overview]
Message-ID: <8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f.mgorny@gentoo> (raw)

commit:     8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:45:45 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:45:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=8b3a2bcf

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).
 	"""
 
-	def __init__(self, prog):
+	def __init__(self):
 		"""
 		Initialize the class. Set the option parser up.
 		
 		<prog> - program name for optparse output (argv[0])
 		"""
-		opt = OptionParser(
-				prog = os.path.basename(prog),
-				version = PV
-		)
+		opt = OptionParser(version = PV)
 
 		# XXX: -r for getting through PM's repo_name
 		opt.add_option('-R', '--repository-path', dest='repo_path',
@@ -49,7 +46,7 @@ class PMSTestSuiteCLI(object):
 
 		self.optparser = opt
 
-	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):
 		<args> - command line args (argv[1:])
 		"""
 		opt = self.optparser
+		opt.prog = os.path.basename(prog)
 		(opts, args) = opt.parse_args(list(args))
 
 		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
 
 class EbuildGenCLI(PMSTestSuiteCLI):
-	def __init__(self, prog, *args):
-		PMSTestSuiteCLI.__init__(self, prog)
-		self._args = args
-
-	def main(self):
-		self._start(self._args)
+	def main(self, argv):
+		self._start(*argv)
 
 		files = {}
 		for t in self.test_library:
@@ -25,5 +21,5 @@ class EbuildGenCLI(PMSTestSuiteCLI):
 		return 0
 
 if __name__ == '__main__':
-	cli = EbuildGenCLI(*sys.argv)
-	sys.exit(cli.main())
+	cli = EbuildGenCLI()
+	sys.exit(cli.main(sys.argv))



             reply	other threads:[~2011-05-29 17:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 17:46 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-03 15:52 [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/ Michał Górny
2011-06-27 21:24 Michał Górny
2011-06-01 12:30 [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/ Michał Górny
2011-06-01 12:30 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:46 Michał Górny
2011-05-29 17:13 Michał Górny
2011-05-22  9:17 Michał Górny
2011-05-16 20:00 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox