improved error message when pkg not found thanks @juergenhoetzel

pull/25/head
kewl fft 2019-04-11 19:05:57 +01:00
parent 8f8af5fa5f
commit b462d9893f
1 changed files with 2 additions and 2 deletions

4
aur.py
View File

@ -109,7 +109,7 @@ def check_packages(module, packages):
if would_be_changed: if would_be_changed:
status = True status = True
if (len(packages) > 1): if (len(packages) > 1):
message = '%s package(s) would be installed' % str(len(would_be_changed)) message = '{} package(s) would be installed'.format(len(would_be_changed))
else: else:
message = 'package would be installed' message = 'package would be installed'
else: else:
@ -129,7 +129,7 @@ def install_with_makepkg(module, package):
f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(package)) f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(package))
result = json.loads(f.read().decode('utf8')) result = json.loads(f.read().decode('utf8'))
if result['resultcount'] != 1: if result['resultcount'] != 1:
return (1, '', 'package not found') return (1, '', 'package {} not found'.format(package))
result = result['results'][0] result = result['results'][0]
f = open_url('https://aur.archlinux.org/{}'.format(result['URLPath'])) f = open_url('https://aur.archlinux.org/{}'.format(result['URLPath']))
current_path = os.getcwd() current_path = os.getcwd()