Commit d72ee999 authored by segfault's avatar segfault

ASP: Make code more readable (refs: #15983)

parent ba0967fe
......@@ -472,17 +472,18 @@ def apt_hook_post():
packages = json.load(f)
os.remove(ASP_STATE_PACKAGES)
additional_packages_names = set(map(
filter_package_details,
get_additional_packages(search_new_persistence=True)))
additional_packages_names = {
filter_package_details(pkg) for pkg in get_additional_packages(search_new_persistence=True)
}
apt_cache = apt.cache.Cache()
# Filter automatically installed packages and packages already configured
# as additional software
new_manually_installed_packages = set(filter(
lambda pkg: not apt_cache[pkg].is_auto_installed
and pkg not in additional_packages_names, # NOQA: E131
set(packages["installed"])))
new_manually_installed_packages = {
pkg for pkg in packages["installed"] if not apt_cache[pkg].is_auto_installed and
pkg not in additional_packages_names
}
if new_manually_installed_packages:
handle_installed_packages(new_manually_installed_packages)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment