mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
syncpackage: Put command-line parsing in separate function.
This commit is contained in:
parent
bf5de3c686
commit
c401cbb150
20
syncpackage
20
syncpackage
@ -465,7 +465,9 @@ def close_bugs(bugs, package, version, changes):
|
|||||||
else:
|
else:
|
||||||
Logger.error(u"Cannot find any tasks on LP: #%i to close.", bug.id)
|
Logger.error(u"Cannot find any tasks on LP: #%i to close.", bug.id)
|
||||||
|
|
||||||
def main():
|
def parse():
|
||||||
|
"""Parse given command-line parameters."""
|
||||||
|
|
||||||
usage = "%prog [options] <.dsc URL/path or package name>"
|
usage = "%prog [options] <.dsc URL/path or package name>"
|
||||||
epilog = "See %s(1) for more info." % os.path.basename(sys.argv[0])
|
epilog = "See %s(1) for more info." % os.path.basename(sys.argv[0])
|
||||||
parser = optparse.OptionParser(usage=usage, epilog=epilog)
|
parser = optparse.OptionParser(usage=usage, epilog=epilog)
|
||||||
@ -560,6 +562,16 @@ def main():
|
|||||||
# --key, --dont-sign, --debian-mirror, and --ubuntu-mirror are just
|
# --key, --dont-sign, --debian-mirror, and --ubuntu-mirror are just
|
||||||
# ignored with options.lp, and do not require warnings.
|
# ignored with options.lp, and do not require warnings.
|
||||||
|
|
||||||
|
if options.lp:
|
||||||
|
if args[0].endswith('.dsc'):
|
||||||
|
parser.error('.dsc files can only be synced using --no-lp.')
|
||||||
|
|
||||||
|
return (options, args[0])
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
(options, package) = parse()
|
||||||
|
|
||||||
Logger.verbose = options.verbose
|
Logger.verbose = options.verbose
|
||||||
config = UDTConfig(options.no_conf)
|
config = UDTConfig(options.no_conf)
|
||||||
if options.debian_mirror is None:
|
if options.debian_mirror is None:
|
||||||
@ -571,10 +583,6 @@ def main():
|
|||||||
if options.uploader_email is None:
|
if options.uploader_email is None:
|
||||||
options.uploader_email = ubu_email(export=False)[1]
|
options.uploader_email = ubu_email(export=False)[1]
|
||||||
|
|
||||||
if options.lp:
|
|
||||||
if args[0].endswith('.dsc'):
|
|
||||||
parser.error('.dsc files can only be synced using --no-lp.')
|
|
||||||
|
|
||||||
if options.lpinstance is None:
|
if options.lpinstance is None:
|
||||||
options.lpinstance = config.get_value('LPINSTANCE')
|
options.lpinstance = config.get_value('LPINSTANCE')
|
||||||
try:
|
try:
|
||||||
@ -586,7 +594,7 @@ def main():
|
|||||||
ubuntu = Launchpad.distributions["ubuntu"]
|
ubuntu = Launchpad.distributions["ubuntu"]
|
||||||
options.release = ubuntu.current_series.name
|
options.release = ubuntu.current_series.name
|
||||||
|
|
||||||
src_pkg = fetch_source_pkg(args[0], options.dist, options.debversion,
|
src_pkg = fetch_source_pkg(package, options.dist, options.debversion,
|
||||||
options.component, options.release.split("-")[0],
|
options.component, options.release.split("-")[0],
|
||||||
options.debian_mirror)
|
options.debian_mirror)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user