From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A138C138200 for ; Sat, 3 Aug 2013 01:00:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5332CE08A6; Sat, 3 Aug 2013 00:59:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D3B38E08A6 for ; Sat, 3 Aug 2013 00:59:58 +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 7F41833EC3F for ; Sat, 3 Aug 2013 00:59:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0C31AE468F for ; Sat, 3 Aug 2013 00:59:56 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1375491561.42b76667b04bb87ac9a16469a24f8bc57c61abcd.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 42b76667b04bb87ac9a16469a24f8bc57c61abcd X-VCS-Branch: master Date: Sat, 3 Aug 2013 00:59:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fcf9fb23-a349-4e85-bdf7-750f9e38d0f3 X-Archives-Hash: d5bfde68208ee8fda5508877c3d57213 commit: 42b76667b04bb87ac9a16469a24f8bc57c61abcd Author: Zac Medico gentoo org> AuthorDate: Sat Aug 3 00:48:55 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Aug 3 00:59:21 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=42b76667 ebuild: portage.util._argparse --- bin/ebuild | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 4fdc762..a100657 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -36,33 +36,7 @@ else: signal.signal(debug_signum, debug_signal) import io -import optparse import os - -description = "See the ebuild(1) man page for more info" -usage = "Usage: ebuild [command] ..." -parser = optparse.OptionParser(description=description, usage=usage) - -force_help = "When used together with the digest or manifest " + \ - "command, this option forces regeneration of digests for all " + \ - "distfiles associated with the current ebuild. Any distfiles " + \ - "that do not already exist in ${DISTDIR} will be automatically fetched." - -parser.add_option("--force", help=force_help, action="store_true", dest="force") -parser.add_option("--color", help="enable or disable color output", - type="choice", choices=("y", "n")) -parser.add_option("--debug", help="show debug output", - action="store_true", dest="debug") -parser.add_option("--version", help="show version and exit", - action="store_true", dest="version") -parser.add_option("--ignore-default-opts", - action="store_true", - help="do not use the EBUILD_DEFAULT_OPTS environment variable") -parser.add_option("--skip-manifest", help="skip all manifest checks", - action="store_true", dest="skip_manifest") - -opts, pargs = parser.parse_args(args=sys.argv[1:]) - from os import path as osp pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym") sys.path.insert(0, pym_path) @@ -74,9 +48,34 @@ from portage import _shell_quote from portage import _unicode_decode from portage import _unicode_encode from portage.const import VDB_PATH +from portage.util._argparse import ArgumentParser from _emerge.Package import Package from _emerge.RootConfig import RootConfig +description = "See the ebuild(1) man page for more info" +usage = "Usage: ebuild [command] ..." +parser = ArgumentParser(description=description, usage=usage) + +force_help = "When used together with the digest or manifest " + \ + "command, this option forces regeneration of digests for all " + \ + "distfiles associated with the current ebuild. Any distfiles " + \ + "that do not already exist in ${DISTDIR} will be automatically fetched." + +parser.add_argument("--force", help=force_help, action="store_true") +parser.add_argument("--color", help="enable or disable color output", + choices=("y", "n")) +parser.add_argument("--debug", help="show debug output", + action="store_true") +parser.add_argument("--version", help="show version and exit", + action="store_true") +parser.add_argument("--ignore-default-opts", + action="store_true", + help="do not use the EBUILD_DEFAULT_OPTS environment variable") +parser.add_argument("--skip-manifest", help="skip all manifest checks", + action="store_true") + +opts, pargs = parser.parse_known_args(args=sys.argv[1:]) + def err(txt): portage.writemsg('ebuild: %s\n' % (txt,), noiselevel=-1) sys.exit(1) @@ -91,7 +90,7 @@ if len(pargs) < 2: if not opts.ignore_default_opts: default_opts = portage.util.shlex_split( portage.settings.get("EBUILD_DEFAULT_OPTS", "")) - opts, pargs = parser.parse_args(default_opts + sys.argv[1:]) + opts, pargs = parser.parse_known_args(default_opts + sys.argv[1:]) debug = opts.debug force = opts.force