mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
replace deprecated optparse with argparse
following guidelines from: https://docs.python.org/2/library/argparse.html#upgrading-optparse-code except, still using option = parse.parse_args() instead of args = ... - using the following script in folder fdroidserver: for i in *.py; do sed -i -e 's/optparse/argparse/' \ -e 's/OptionParser/ArgumentParser/' \ -e 's/OptionError/ArgumentError/' \ -e 's/add_option/add_argument/' \ -e 's/(options, args) = parser/options = parser/' \ -e 's/options, args = parser/options = parser/' \ -e 's/Usage: %prog/%(prog)s/' $i; done - use ArgumentParser argument to replace (option, args) = parser.parse() call - use parser.error(msg) instead of raise ArgumentException as suggested in https://docs.python.org/2/library/argparse.html#exiting-methods - in fdroid catch ArgumentError instead of OptionError
This commit is contained in:
parent
41443edd55
commit
d23ecf1b35
4
fdroid
4
fdroid
@ -22,7 +22,7 @@ import sys
|
||||
import logging
|
||||
|
||||
import fdroidserver.common
|
||||
from optparse import OptionError
|
||||
from argparse import ArgumentError
|
||||
|
||||
commands = {
|
||||
"build": "Build a package from source",
|
||||
@ -124,7 +124,7 @@ def main():
|
||||
else:
|
||||
logging.critical(str(e))
|
||||
sys.exit(1)
|
||||
except OptionError, e:
|
||||
except ArgumentError as e:
|
||||
logging.critical(str(e))
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
|
@ -29,7 +29,7 @@ import traceback
|
||||
import time
|
||||
import json
|
||||
from ConfigParser import ConfigParser
|
||||
from optparse import OptionParser, OptionError
|
||||
from argparse import ArgumentParser
|
||||
from distutils.version import LooseVersion
|
||||
import logging
|
||||
|
||||
@ -930,47 +930,48 @@ def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir,
|
||||
|
||||
|
||||
def parse_commandline():
|
||||
"""Parse the command line. Returns options, args."""
|
||||
"""Parse the command line. Returns options, parser."""
|
||||
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-l", "--latest", action="store_true", default=False,
|
||||
help="Build only the latest version of each package")
|
||||
parser.add_option("-s", "--stop", action="store_true", default=False,
|
||||
help="Make the build stop on exceptions")
|
||||
parser.add_option("-t", "--test", action="store_true", default=False,
|
||||
help="Test mode - put output in the tmp directory only, and always build, even if the output already exists.")
|
||||
parser.add_option("--server", action="store_true", default=False,
|
||||
help="Use build server")
|
||||
parser.add_option("--resetserver", action="store_true", default=False,
|
||||
help="Reset and create a brand new build server, even if the existing one appears to be ok.")
|
||||
parser.add_option("--on-server", dest="onserver", action="store_true", default=False,
|
||||
help="Specify that we're running on the build server")
|
||||
parser.add_option("--skip-scan", dest="skipscan", action="store_true", default=False,
|
||||
help="Skip scanning the source code for binaries and other problems")
|
||||
parser.add_option("--no-tarball", dest="notarball", action="store_true", default=False,
|
||||
help="Don't create a source tarball, useful when testing a build")
|
||||
parser.add_option("--no-refresh", dest="refresh", action="store_false", default=True,
|
||||
help="Don't refresh the repository, useful when testing a build with no internet connection")
|
||||
parser.add_option("-f", "--force", action="store_true", default=False,
|
||||
help="Force build of disabled apps, and carries on regardless of scan problems. Only allowed in test mode.")
|
||||
parser.add_option("-a", "--all", action="store_true", default=False,
|
||||
help="Build all applications available")
|
||||
parser.add_option("-w", "--wiki", default=False, action="store_true",
|
||||
help="Update the wiki")
|
||||
options, args = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-l", "--latest", action="store_true", default=False,
|
||||
help="Build only the latest version of each package")
|
||||
parser.add_argument("-s", "--stop", action="store_true", default=False,
|
||||
help="Make the build stop on exceptions")
|
||||
parser.add_argument("-t", "--test", action="store_true", default=False,
|
||||
help="Test mode - put output in the tmp directory only, and always build, even if the output already exists.")
|
||||
parser.add_argument("--server", action="store_true", default=False,
|
||||
help="Use build server")
|
||||
parser.add_argument("--resetserver", action="store_true", default=False,
|
||||
help="Reset and create a brand new build server, even if the existing one appears to be ok.")
|
||||
parser.add_argument("--on-server", dest="onserver", action="store_true", default=False,
|
||||
help="Specify that we're running on the build server")
|
||||
parser.add_argument("--skip-scan", dest="skipscan", action="store_true", default=False,
|
||||
help="Skip scanning the source code for binaries and other problems")
|
||||
parser.add_argument("--no-tarball", dest="notarball", action="store_true", default=False,
|
||||
help="Don't create a source tarball, useful when testing a build")
|
||||
parser.add_argument("--no-refresh", dest="refresh", action="store_false", default=True,
|
||||
help="Don't refresh the repository, useful when testing a build with no internet connection")
|
||||
parser.add_argument("-f", "--force", action="store_true", default=False,
|
||||
help="Force build of disabled apps, and carries on regardless of scan problems. Only allowed in test mode.")
|
||||
parser.add_argument("-a", "--all", action="store_true", default=False,
|
||||
help="Build all applications available")
|
||||
parser.add_argument("-w", "--wiki", default=False, action="store_true",
|
||||
help="Update the wiki")
|
||||
options = parser.parse_args()
|
||||
|
||||
# Force --stop with --on-server to get correct exit code
|
||||
if options.onserver:
|
||||
options.stop = True
|
||||
|
||||
if options.force and not options.test:
|
||||
raise OptionError("Force is only allowed in test mode", "force")
|
||||
parser.error("option %s: Force is only allowed in test mode" % "force")
|
||||
|
||||
return options, args
|
||||
return options, parser
|
||||
|
||||
options = None
|
||||
config = None
|
||||
@ -980,16 +981,16 @@ def main():
|
||||
|
||||
global options, config
|
||||
|
||||
options, args = parse_commandline()
|
||||
if not args and not options.all:
|
||||
raise OptionError("If you really want to build all the apps, use --all", "all")
|
||||
options, parser = parse_commandline()
|
||||
if not options.appid and not options.all:
|
||||
parser.error("option %s: If you really want to build all the apps, use --all" % "all")
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
if config['build_server_always']:
|
||||
options.server = True
|
||||
if options.resetserver and not options.server:
|
||||
raise OptionError("Using --resetserver without --server makes no sense", "resetserver")
|
||||
parser.error("option %s: Using --resetserver without --server makes no sense" % "resetserver")
|
||||
|
||||
log_dir = 'logs'
|
||||
if not os.path.isdir(log_dir):
|
||||
@ -1026,7 +1027,7 @@ def main():
|
||||
# Read all app and srclib metadata
|
||||
allapps = metadata.read_metadata(xref=not options.onserver)
|
||||
|
||||
apps = common.read_app_args(args, allapps, True)
|
||||
apps = common.read_app_args(options.appid, allapps, True)
|
||||
for appid, app in apps.items():
|
||||
if (app['Disabled'] and not options.force) or not app['Repo Type'] or not app['builds']:
|
||||
del apps[appid]
|
||||
|
@ -24,7 +24,7 @@ import re
|
||||
import urllib2
|
||||
import time
|
||||
import subprocess
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import traceback
|
||||
import HTMLParser
|
||||
from distutils.version import LooseVersion
|
||||
@ -515,27 +515,28 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID [APPID ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("--auto", action="store_true", default=False,
|
||||
help="Process auto-updates")
|
||||
parser.add_option("--autoonly", action="store_true", default=False,
|
||||
help="Only process apps with auto-updates")
|
||||
parser.add_option("--commit", action="store_true", default=False,
|
||||
help="Commit changes")
|
||||
parser.add_option("--gplay", action="store_true", default=False,
|
||||
help="Only print differences with the Play Store")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id to check for updates")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("--auto", action="store_true", default=False,
|
||||
help="Process auto-updates")
|
||||
parser.add_argument("--autoonly", action="store_true", default=False,
|
||||
help="Only process apps with auto-updates")
|
||||
parser.add_argument("--commit", action="store_true", default=False,
|
||||
help="Commit changes")
|
||||
parser.add_argument("--gplay", action="store_true", default=False,
|
||||
help="Only print differences with the Play Store")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
# Get all apps...
|
||||
allapps = metadata.read_metadata()
|
||||
|
||||
apps = common.read_app_args(args, allapps, False)
|
||||
apps = common.read_app_args(options.appid, allapps, False)
|
||||
|
||||
if options.gplay:
|
||||
for app in apps:
|
||||
|
@ -20,7 +20,7 @@
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -35,12 +35,12 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
@ -22,7 +22,7 @@ import sys
|
||||
import os
|
||||
import shutil
|
||||
import urllib
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
from ConfigParser import ConfigParser
|
||||
import logging
|
||||
import common
|
||||
@ -75,18 +75,18 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-u", "--url", default=None,
|
||||
help="Project URL to import from.")
|
||||
parser.add_option("-s", "--subdir", default=None,
|
||||
help="Path to main android project subdirectory, if not in root.")
|
||||
parser.add_option("--rev", default=None,
|
||||
help="Allows a different revision (or git branch) to be specified for the initial import")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-u", "--url", default=None,
|
||||
help="Project URL to import from.")
|
||||
parser.add_argument("-s", "--subdir", default=None,
|
||||
help="Path to main android project subdirectory, if not in root.")
|
||||
parser.add_argument("--rev", default=None,
|
||||
help="Allows a different revision (or git branch) to be specified for the initial import")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
@ -25,7 +25,7 @@ import re
|
||||
import shutil
|
||||
import socket
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -50,22 +50,22 @@ def main():
|
||||
global options, config
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-d", "--distinguished-name", default=None,
|
||||
help="X.509 'Distiguished Name' used when generating keys")
|
||||
parser.add_option("--keystore", default=None,
|
||||
help="Path to the keystore for the repo signing key")
|
||||
parser.add_option("--repo-keyalias", default=None,
|
||||
help="Alias of the repo signing key in the keystore")
|
||||
parser.add_option("--android-home", default=None,
|
||||
help="Path to the Android SDK (sometimes set in ANDROID_HOME)")
|
||||
parser.add_option("--no-prompt", action="store_true", default=False,
|
||||
help="Do not prompt for Android SDK path, just fail")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-d", "--distinguished-name", default=None,
|
||||
help="X.509 'Distiguished Name' used when generating keys")
|
||||
parser.add_argument("--keystore", default=None,
|
||||
help="Path to the keystore for the repo signing key")
|
||||
parser.add_argument("--repo-keyalias", default=None,
|
||||
help="Alias of the repo signing key in the keystore")
|
||||
parser.add_argument("--android-home", default=None,
|
||||
help="Path to the Android SDK (sometimes set in ANDROID_HOME)")
|
||||
parser.add_argument("--no-prompt", action="store_true", default=False,
|
||||
help="Do not prompt for Android SDK path, just fail")
|
||||
options = parser.parse_args()
|
||||
|
||||
# find root install prefix
|
||||
tmp = os.path.dirname(sys.argv[0])
|
||||
|
@ -21,7 +21,7 @@
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
from optparse import OptionParser, OptionError
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -49,17 +49,18 @@ def main():
|
||||
global options, config
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-a", "--all", action="store_true", default=False,
|
||||
help="Install all signed applications available")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-a", "--all", action="store_true", default=False,
|
||||
help="Install all signed applications available")
|
||||
options = parser.parse_args()
|
||||
|
||||
if not args and not options.all:
|
||||
raise OptionError("If you really want to install all the signed apps, use --all", "all")
|
||||
if not options.appid and not options.all:
|
||||
parser.error("option %s: If you really want to install all the signed apps, use --all" % "all")
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
@ -68,9 +69,9 @@ def main():
|
||||
logging.info("No signed output directory - nothing to do")
|
||||
sys.exit(0)
|
||||
|
||||
if args:
|
||||
if options.appid:
|
||||
|
||||
vercodes = common.read_pkg_args(args, True)
|
||||
vercodes = common.read_pkg_args(options.appid, True)
|
||||
apks = {appid: None for appid in vercodes}
|
||||
|
||||
# Get the signed apk with the highest vercode
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU Affero General Public Licen
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import re
|
||||
import logging
|
||||
import common
|
||||
@ -150,18 +150,19 @@ def main():
|
||||
count['warn'] += 1
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID [APPID ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id in the form APPID")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
# Get all apps...
|
||||
allapps = metadata.read_metadata(xref=True)
|
||||
apps = common.read_app_args(args, allapps, False)
|
||||
apps = common.read_app_args(options.appid, allapps, False)
|
||||
|
||||
filling_ucms = re.compile('^(Tags.*|RepoManifest.*)')
|
||||
|
||||
|
@ -23,7 +23,7 @@ import os
|
||||
import shutil
|
||||
import md5
|
||||
import glob
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -39,13 +39,14 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] "
|
||||
"[APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] "
|
||||
"[APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
@ -86,7 +87,7 @@ def main():
|
||||
# Nonetheless, to be sure, before publishing we check that there are no
|
||||
# collisions, and refuse to do any publishing if that's the case...
|
||||
allapps = metadata.read_metadata()
|
||||
vercodes = common.read_pkg_args(args, True)
|
||||
vercodes = common.read_pkg_args(options.appid, True)
|
||||
allaliases = []
|
||||
for appid in allapps:
|
||||
m = md5.new()
|
||||
|
@ -17,18 +17,18 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import common
|
||||
import metadata
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
parser = OptionParser(usage="Usage: %prog")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser = ArgumentParser(usage="%(prog)s")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.parse_args()
|
||||
common.read_config(None)
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
import common
|
||||
import metadata
|
||||
@ -33,18 +33,19 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID [APPID ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id in the form APPID")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
# Get all apps...
|
||||
allapps = metadata.read_metadata(xref=True)
|
||||
apps = common.read_app_args(args, allapps, False)
|
||||
apps = common.read_app_args(options.appid, allapps, False)
|
||||
|
||||
for appid, app in apps.iteritems():
|
||||
metadatapath = app['metadatapath']
|
||||
|
@ -20,7 +20,7 @@
|
||||
import os
|
||||
import re
|
||||
import traceback
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -249,18 +249,19 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
# Read all app and srclib metadata
|
||||
allapps = metadata.read_metadata()
|
||||
apps = common.read_app_args(args, allapps, True)
|
||||
apps = common.read_app_args(options.appid, allapps, True)
|
||||
|
||||
probcount = 0
|
||||
|
||||
|
@ -24,7 +24,7 @@ import os
|
||||
import paramiko
|
||||
import pwd
|
||||
import subprocess
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
import common
|
||||
|
||||
@ -195,28 +195,25 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--identity-file", default=None,
|
||||
help="Specify an identity file to provide to SSH for rsyncing")
|
||||
parser.add_option("--local-copy-dir", default=None,
|
||||
help="Specify a local folder to sync the repo to")
|
||||
parser.add_option("--sync-from-local-copy-dir", action="store_true", default=False,
|
||||
help="Before uploading to servers, sync from local copy dir")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("--no-checksum", action="store_true", default=False,
|
||||
help="Don't use rsync checksums")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("command", help="command to execute, either 'init' or 'update'")
|
||||
parser.add_argument("-i", "--identity-file", default=None,
|
||||
help="Specify an identity file to provide to SSH for rsyncing")
|
||||
parser.add_argument("--local-copy-dir", default=None,
|
||||
help="Specify a local folder to sync the repo to")
|
||||
parser.add_argument("--sync-from-local-copy-dir", action="store_true", default=False,
|
||||
help="Before uploading to servers, sync from local copy dir")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("--no-checksum", action="store_true", default=False,
|
||||
help="Don't use rsync checksums")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
if len(args) != 1:
|
||||
logging.critical("Specify a single command")
|
||||
sys.exit(1)
|
||||
|
||||
if args[0] != 'init' and args[0] != 'update':
|
||||
if options.command != 'init' and options.command != 'update':
|
||||
logging.critical("The only commands currently supported are 'init' and 'update'")
|
||||
sys.exit(1)
|
||||
|
||||
@ -288,7 +285,7 @@ def main():
|
||||
if config['per_app_repos']:
|
||||
repo_sections += common.get_per_app_repos()
|
||||
|
||||
if args[0] == 'init':
|
||||
if options.command == 'init':
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.load_system_host_keys()
|
||||
for serverwebroot in config.get('serverwebroot', []):
|
||||
@ -310,7 +307,7 @@ def main():
|
||||
sftp.mkdir(repo_path, mode=0755)
|
||||
sftp.close()
|
||||
ssh.close()
|
||||
elif args[0] == 'update':
|
||||
elif options.command == 'update':
|
||||
for repo_section in repo_sections:
|
||||
if local_copy_dir is not None:
|
||||
if config['sync_from_local_copy_dir'] and os.path.exists(repo_section):
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -34,12 +34,12 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import time
|
||||
import traceback
|
||||
import glob
|
||||
import json
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import paramiko
|
||||
import socket
|
||||
import logging
|
||||
@ -50,19 +50,19 @@ def main():
|
||||
global options, config
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-d", "--download", action="store_true", default=False,
|
||||
help="Download logs we don't have")
|
||||
parser.add_option("--recalc", action="store_true", default=False,
|
||||
help="Recalculate aggregate stats - use when changes "
|
||||
"have been made that would invalidate old cached data.")
|
||||
parser.add_option("--nologs", action="store_true", default=False,
|
||||
help="Don't do anything logs-related")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-d", "--download", action="store_true", default=False,
|
||||
help="Download logs we don't have")
|
||||
parser.add_argument("--recalc", action="store_true", default=False,
|
||||
help="Recalculate aggregate stats - use when changes "
|
||||
"have been made that would invalidate old cached data.")
|
||||
parser.add_argument("--nologs", action="store_true", default=False,
|
||||
help="Don't do anything logs-related")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
@ -29,7 +29,7 @@ import hashlib
|
||||
import pickle
|
||||
from datetime import datetime, timedelta
|
||||
from xml.dom.minidom import Document
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import time
|
||||
from pyasn1.error import PyAsn1Error
|
||||
from pyasn1.codec.der import decoder, encoder
|
||||
@ -1048,35 +1048,35 @@ def main():
|
||||
global config, options
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
parser.add_option("--create-key", action="store_true", default=False,
|
||||
help="Create a repo signing key in a keystore")
|
||||
parser.add_option("-c", "--create-metadata", action="store_true", default=False,
|
||||
help="Create skeleton metadata files that are missing")
|
||||
parser.add_option("--delete-unknown", action="store_true", default=False,
|
||||
help="Delete APKs without metadata from the repo")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_option("-b", "--buildreport", action="store_true", default=False,
|
||||
help="Report on build data status")
|
||||
parser.add_option("-i", "--interactive", default=False, action="store_true",
|
||||
help="Interactively ask about things that need updating.")
|
||||
parser.add_option("-I", "--icons", action="store_true", default=False,
|
||||
help="Resize all the icons exceeding the max pixel size and exit")
|
||||
parser.add_option("-e", "--editor", default="/etc/alternatives/editor",
|
||||
help="Specify editor to use in interactive mode. Default " +
|
||||
"is /etc/alternatives/editor")
|
||||
parser.add_option("-w", "--wiki", default=False, action="store_true",
|
||||
help="Update the wiki")
|
||||
parser.add_option("", "--pretty", action="store_true", default=False,
|
||||
help="Produce human-readable index.xml")
|
||||
parser.add_option("--clean", action="store_true", default=False,
|
||||
help="Clean update - don't uses caches, reprocess all apks")
|
||||
parser.add_option("--nosign", action="store_true", default=False,
|
||||
help="When configured for signed indexes, create only unsigned indexes at this stage")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("--create-key", action="store_true", default=False,
|
||||
help="Create a repo signing key in a keystore")
|
||||
parser.add_argument("-c", "--create-metadata", action="store_true", default=False,
|
||||
help="Create skeleton metadata files that are missing")
|
||||
parser.add_argument("--delete-unknown", action="store_true", default=False,
|
||||
help="Delete APKs without metadata from the repo")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
parser.add_argument("-b", "--buildreport", action="store_true", default=False,
|
||||
help="Report on build data status")
|
||||
parser.add_argument("-i", "--interactive", default=False, action="store_true",
|
||||
help="Interactively ask about things that need updating.")
|
||||
parser.add_argument("-I", "--icons", action="store_true", default=False,
|
||||
help="Resize all the icons exceeding the max pixel size and exit")
|
||||
parser.add_argument("-e", "--editor", default="/etc/alternatives/editor",
|
||||
help="Specify editor to use in interactive mode. Default " +
|
||||
"is /etc/alternatives/editor")
|
||||
parser.add_argument("-w", "--wiki", default=False, action="store_true",
|
||||
help="Update the wiki")
|
||||
parser.add_argument("--pretty", action="store_true", default=False,
|
||||
help="Produce human-readable index.xml")
|
||||
parser.add_argument("--clean", action="store_true", default=False,
|
||||
help="Clean update - don't uses caches, reprocess all apks")
|
||||
parser.add_argument("--nosign", action="store_true", default=False,
|
||||
help="When configured for signed indexes, create only unsigned indexes at this stage")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
import common
|
||||
@ -36,12 +36,13 @@ def main():
|
||||
global options, config
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser(usage="Usage: %prog [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_option("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
(options, args) = parser.parse_args()
|
||||
parser = ArgumentParser(usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||
parser.add_argument("appid", nargs='*', help="app-id with optional versioncode in the form APPID[:VERCODE]")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", default=False,
|
||||
help="Restrict output to warnings and errors")
|
||||
options = parser.parse_args()
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
@ -58,7 +59,7 @@ def main():
|
||||
verified = 0
|
||||
notverified = 0
|
||||
|
||||
vercodes = common.read_pkg_args(args, True)
|
||||
vercodes = common.read_pkg_args(options.appid, True)
|
||||
|
||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user