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 1PorWT-0004u2-H8 for garchives@archives.gentoo.org; Mon, 14 Feb 2011 06:02:57 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0C35AE09B4; Mon, 14 Feb 2011 06:00:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C1040E09A6 for ; Mon, 14 Feb 2011 06:00:29 +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 5F2E11B4221 for ; Mon, 14 Feb 2011 06:00:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C8FA880073 for ; Mon, 14 Feb 2011 06:00:28 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <3ae0e5c0768081314183e66f589b57a13f271af5.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/config.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 3ae0e5c0768081314183e66f589b57a13f271af5 Date: Mon, 14 Feb 2011 06:00:28 +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: 6eac3a68768936ed2b9af70ec71eeb33 commit: 3ae0e5c0768081314183e66f589b57a13f271af5 Author: Brian Dolbec gmail com> AuthorDate: Mon Jan 17 06:49:16 2011 +0000 Commit: Brian Dolbec gmail com> CommitDate: Fri Feb 11 10:49:14 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3D3ae0e5c0 fix long lines and a typo, minor code improvements --- layman/config.py | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/layman/config.py b/layman/config.py index ceafcc4..baa3af3 100644 --- a/layman/config.py +++ b/layman/config.py @@ -127,7 +127,7 @@ class BareConfig(object): self._options['output'].debug('Retrieving BareConfig default', 8= ) if key in self._defaults: if '%(storage)s' in self._defaults[key]: - return self._defaults[key] %{'storage': self._defaults[= 'storage']} + return self._defaults[key] %{'storage': self._defaults['= storage']} return self._defaults[key] return None =20 @@ -137,7 +137,8 @@ class BareConfig(object): class ArgsParser(object): '''Handles the configuration and option parser.''' =20 - def __init__(self, args=3DNone, output=3DNone, stdout=3DNone, stdin=3D= None, stderr=3DNone): + def __init__(self, args=3DNone, output=3DNone, + stdout=3DNone, stdin=3DNone, stderr=3DNone): ''' Creates and describes all possible polymeraZe options and create= s a debugging object. @@ -150,7 +151,10 @@ class ArgsParser(object): >>> a['overlays'] '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml' >>> sorted(a.keys()) - ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command= ', 'git_command', 'local_list', 'make_conf', 'mercurial_command', 'nochec= k', 'overlays', 'proxy', 'quietness', 'rsync_command', 'storage', 'svn_co= mmand', 'tar_command', 'umask', 'width'] + ['bzr_command', 'cache', 'config', 'cvs_command', 'darcs_command= ', + 'git_command', 'local_list', 'make_conf', 'mercurial_command', + 'nocheck', 'overlays', 'proxy', 'quietness', 'rsync_command', 's= torage', + 'svn_command', 'tar_command', 'umask', 'width'] ''' if args =3D=3D None: args =3D sys.argv @@ -160,7 +164,10 @@ class ArgsParser(object): self.stdin =3D stdin if stdin else sys.stdin self.output =3D output if output else OUT =20 - self.defaults =3D BareConfig().get_defaults() + self.bare_config =3D BareConfig(self.output, self.stdout, + self.stdin, self.stderr) + self.defaults =3D self.bare_config.get_defaults() + #print self.defaults =20 self.parser =3D OptionParser( usage =3D _USAGE, @@ -243,13 +250,13 @@ class ArgsParser(object): group.add_option('-c', '--config', action =3D 'store', - help =3D 'Path to the config file [default: ' = \ + help =3D 'Path to the config file [default: ' \ + self.defaults['config'] + '].') =20 group.add_option('-o', '--overlays', action =3D 'append', - help =3D 'The list of overlays [default: ' = \ + help =3D 'The list of overlays [default: ' \ + self.defaults['overlays'] + '].') =20 self.parser.add_option_group(group) @@ -296,7 +303,7 @@ class ArgsParser(object): type =3D 'int', default =3D '0', help =3D 'Sets the screen width. This setting i= s usually ' - 'not required as layman is capable of detecting= the ava' + 'not required as layman is capable of detecting= the ' 'available number of columns automatically.') =20 group.add_option('-k', @@ -320,8 +327,10 @@ class ArgsParser(object): sys.exit(0) =20 (self.options, remain_args) =3D self.parser.parse_args(args) - if len(remain_args) > 1: # remain_args starts with something li= ke "bin/layman" ... - self.parser.error("Unhandled parameters: %s" % ', '.join(('"= %s"' % e) for e in remain_args[1:])) + # remain_args starts with something like "bin/layman" ... + if len(remain_args) > 1: + self.parser.error("Unhandled parameters: %s" + % ', '.join(('"%s"' % e) for e in remain_args[1:])) =20 # handle debugging self.output.cli_handle(self.options) @@ -333,7 +342,7 @@ class ArgsParser(object): self.options.__dict__['stdout'] =3D self.stdout self.options.__dict__['stdin'] =3D self.stdin self.options.__dict__['stderr'] =3D self.stderr - =20 + =20 if self.options.__dict__['nocolor']: self.output.color_off()