From: Zac Medico Date: Wed, 18 Jun 2008 03:30:55 +0000 (-0000) Subject: Use optparse instead of getopt. X-Git-Tag: v2.2_rc1~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=55f3afa1ce6e542373a04161cc984da172699db0;p=portage.git Use optparse instead of getopt. svn path=/main/trunk/; revision=10710 --- diff --git a/bin/ebuild b/bin/ebuild index 65afc660f..75151b414 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -3,22 +3,29 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $ -import getopt, os, sys +import optparse +import os +import sys -if len(sys.argv) <= 2: - print "Usage: ebuild [command] ..." - print "" - print "See the ebuild(1) man page for more info" - sys.exit(1) +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." -try: - opts, pargs = getopt.getopt(sys.argv[1:], '', ['debug', 'force']) -except getopt.GetoptError, e: - print e - sys.exit(1) -debug = ("--debug",'') in opts -force = ("--force",'') in opts +parser.add_option("--force", help=force_help, action="store_true", dest="force") +parser.add_option("--debug", action="store_true", dest="debug") + +opts, pargs = parser.parse_args(args=sys.argv[1:]) + +if len(pargs) < 2: + parser.error("missing required args") + +debug = opts.debug +force = opts.force if "merge" in pargs: print "Disabling noauto in features... merge disables it. (qmerge doesn't)"