mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Sensible behavior when called for a non-existent package name
This commit is contained in:
parent
739279da3f
commit
7c9c7f2890
24
pm-helper
24
pm-helper
@ -91,8 +91,11 @@ def create_excuses_bug(launchpad, package, version):
|
|||||||
|
|
||||||
def has_excuses_bugs(launchpad, package):
|
def has_excuses_bugs(launchpad, package):
|
||||||
ubuntu = launchpad.distributions['ubuntu']
|
ubuntu = launchpad.distributions['ubuntu']
|
||||||
tasks = ubuntu.getSourcePackage(name=package).searchTasks(
|
pkg = ubuntu.getSourcePackage(name=package)
|
||||||
tags=['update-excuse'], order_by=['id'])
|
if not pkg:
|
||||||
|
raise ValueError(f"No such source package: {package}")
|
||||||
|
|
||||||
|
tasks = pkg.searchTasks(tags=['update-excuse'], order_by=['id'])
|
||||||
|
|
||||||
bugs = [task.bug for task in tasks]
|
bugs = [task.bug for task in tasks]
|
||||||
if not bugs:
|
if not bugs:
|
||||||
@ -131,13 +134,16 @@ def main():
|
|||||||
lzma_f.close()
|
lzma_f.close()
|
||||||
|
|
||||||
if args.package:
|
if args.package:
|
||||||
if not has_excuses_bugs(args.launchpad, args.package):
|
try:
|
||||||
proposed_version = get_proposed_version(excuses, args.package)
|
if not has_excuses_bugs(args.launchpad, args.package):
|
||||||
if not proposed_version:
|
proposed_version = get_proposed_version(excuses, args.package)
|
||||||
print("Package %s not found in -proposed." % args.package)
|
if not proposed_version:
|
||||||
sys.exit(1)
|
print("Package %s not found in -proposed." % args.package)
|
||||||
create_excuses_bug(args.launchpad, args.package,
|
sys.exit(1)
|
||||||
proposed_version)
|
create_excuses_bug(args.launchpad, args.package,
|
||||||
|
proposed_version)
|
||||||
|
except ValueError as e:
|
||||||
|
sys.stderr.write(f"{e}\n")
|
||||||
else:
|
else:
|
||||||
pass # for now
|
pass # for now
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user