summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-18 03:30:55 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-18 03:30:55 +0000
commit55f3afa1ce6e542373a04161cc984da172699db0 (patch)
tree4f82053b1915ac35d095bef1fcebe440a1997f50 /bin
parentMore eblank. (diff)
downloadportage-idfetch-55f3afa1ce6e542373a04161cc984da172699db0.tar.gz
portage-idfetch-55f3afa1ce6e542373a04161cc984da172699db0.tar.bz2
portage-idfetch-55f3afa1ce6e542373a04161cc984da172699db0.zip
Use optparse instead of getopt.
svn path=/main/trunk/; revision=10710
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild33
1 files changed, 20 insertions, 13 deletions
diff --git a/bin/ebuild b/bin/ebuild
index 65afc660..75151b41 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 <ebuild file> <command> [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 <ebuild file> <command> [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)"