Add switches:
 --verbose (in addition to -v)
 -s,--sign (automatically sign unsigned executables)
 -f,--force (no prompt to commit changes)
 -h,--help

Converted to use OptionParser, so we got "-h,--help" for free.

Fully tested with all permutations of the new switches.

Index: update_versions
===================================================================
--- update_versions (revision 18233)
+++ update_versions (working copy)
@@ -16,15 +16,30 @@

 import database, db_mid, configxml, tools
 import sys, os, re, time, string
+from optparse import OptionParser

-verbose = 0
-try:
-    if sys.argv[1] == '-v':
-        verbose = 1
-        print '(verbose mode)'
-except:
-    pass
+parser = OptionParser(usage="usage: %prog [-vsi]")

+parser.add_option("-v", "--verbose", dest="verbose", action="store_true", \
+                  default=False, help="Enable verbose mode")
+
+parser.add_option("-s", "--sign", dest="autosign", action="store_true", \
+                  default=False, help="Silently sign executables when
unsigned (not recommended)")
+
+parser.add_option("-f", "--force", dest="force", action="store_true", \
+                  default=False, help="Do not prompt to continue before
committing changes")
+
+options,args = parser.parse_args()
+
+if options.verbose:
+    verbose = 1
+    print '(verbose mode)'
+else:
+    verbose = 0
+
+autosign = options.autosign
+interactive = not options.force
+
 config = configxml.default_config().config
 database.connect()

@@ -100,7 +115,8 @@
         signature_files = signature_files,
         file_ref_infos = file_ref_infos,
         api_version = api_version,
-        extra_xml = extra_xml
+        extra_xml = extra_xml,
+        quiet = autosign
         )

     object = database.AppVersion(
@@ -256,8 +272,9 @@
 for object in objects_to_commit:
     print "   ", object

-if not tools.query_yesno("Continue"):
-    raise SystemExit
+if interactive:
+    if not tools.query_yesno("Continue"):
+        raise SystemExit

 print "Committed:"
 for object in objects_to_commit:
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to