mirror of
https://github.com/kewlfft/ansible-aur.git
synced 2025-07-27 05:53:50 +03:00
optimize check_packages lists construction
This commit is contained in:
@@ -138,18 +138,8 @@ def check_packages(module, packages):
|
|||||||
"""
|
"""
|
||||||
Inform the user what would change if the module were run
|
Inform the user what would change if the module were run
|
||||||
"""
|
"""
|
||||||
would_be_changed = []
|
would_be_changed = [package for package in packages if not package_installed(module, package)]
|
||||||
diff = {
|
diff = {'before': '', 'after': '\n'.join(package for package in would_be_changed if module._diff)}
|
||||||
'before': '',
|
|
||||||
'after': '',
|
|
||||||
}
|
|
||||||
|
|
||||||
for package in packages:
|
|
||||||
installed = package_installed(module, package)
|
|
||||||
if not installed:
|
|
||||||
would_be_changed.append(package)
|
|
||||||
if module._diff:
|
|
||||||
diff['after'] += package + "\n"
|
|
||||||
|
|
||||||
if would_be_changed:
|
if would_be_changed:
|
||||||
status = True
|
status = True
|
||||||
|
Reference in New Issue
Block a user