[releng] Revert "convert-to-tarballs.py: use argparse instead of optparse"



commit 8f3a556d8f469cfb33f9d3ac80bb4d2724a6255b
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Fri Aug 12 16:00:15 2011 +0200

    Revert "convert-to-tarballs.py: use argparse instead of optparse"
    
    This reverts commit 2dac97d933107c72811f2661d985dc8f2156f3c9.
    
    Python 2.6 is still the default on Debian unstable, and doesn't have argparse.

 tools/smoketesting/convert-to-tarballs.py |   37 +++++++++++++---------------
 1 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/tools/smoketesting/convert-to-tarballs.py b/tools/smoketesting/convert-to-tarballs.py
index 44e1eae..0513ea9 100755
--- a/tools/smoketesting/convert-to-tarballs.py
+++ b/tools/smoketesting/convert-to-tarballs.py
@@ -67,7 +67,7 @@
 
 import sys, string
 import re
-import argparse
+import optparse
 import os
 import os.path
 from posixpath import join as posixjoin # Handy for URLs
@@ -1019,27 +1019,24 @@ def get_path(filename, path):
 def main(args):
     program_dir = os.path.abspath(sys.path[0] or os.curdir)
 
-    description = "Create tarball modulesets and version file"
-    parser = argparse.ArgumentParser(description=description)
-    parser.add_argument("-t", "--tarballdir", dest="tarballdir",
-                        help="location of tarballs", metavar="DIR")
-    parser.add_argument("-f", "--force", action="store_true", dest="force",
-                        default=False, help="overwrite existing versions and *.modules files")
-    parser.add_argument("-c", "--config", dest="config",
-                        help="tarball-conversion config file", metavar="FILE")
-    parser.add_argument("-o", "--versions-only", action="store_true", dest="versions_only",
-                        default=False, help="only create a versions file, without downloading the tarballs")
-    parser.add_argument("-l", "--local-only", action="store_true", dest="local_only",
-                        default=False, help="only look for files on a local file system")
-    parser.add_argument("-v", "--version", dest="version", required=True,
-                        help="GNOME version to build")
-    parser.add_argument('moduleset', nargs='?',
-                        help='moduleset file to use')
+    parser = optparse.OptionParser()
+    parser.add_option("-t", "--tarballdir", dest="tarballdir",
+                      help="location of tarballs", metavar="DIR")
+    parser.add_option("-v", "--version", dest="version",
+                      help="GNOME version to build")
+    parser.add_option("-f", "--force", action="store_true", dest="force",
+                      default=False, help="overwrite existing versions and *.modules files")
+    parser.add_option("-c", "--config", dest="config",
+                      help="tarball-conversion config file", metavar="FILE")
+    parser.add_option("-o", "--versions-only", action="store_true", dest="versions_only",
+                      default=False, help="only create a versions file, without downloading the tarballs")
+    parser.add_option("-l", "--local-only", action="store_true", dest="local_only",
+                      default=False, help="only look for files on a local file system")
 
     if os.path.exists(os.path.join(os.getcwd(), 'tarballs')):
         parser.set_defaults(tarballdir=os.path.join(os.getcwd(), 'tarballs'))
 
-    options = parser.parse_args()
+    (options, args) = parser.parse_args()
 
     if not options.version:
         parser.print_help()
@@ -1070,8 +1067,8 @@ def main(args):
     jhbuild_dir = get_path('jhbuild.in', (os.path.expanduser('~/src/jhbuild'), '/cvs/jhbuild'))
 
     moduleset = None
-    if options.moduleset:
-        moduleset = options.moduleset
+    if len(args):
+        moduleset = args[-1]
     elif jhbuild_dir:
         # Determine file_location from jhbuild checkoutdir
         if is_stable:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]