mirror of
https://github.com/kiviktnm/decman.git
synced 2026-09-19 12:08:28 +00:00
Extended the flatpak functionality to modules. All works as expected.
This commit is contained in:
@@ -380,6 +380,13 @@ class Module:
|
|||||||
"""
|
"""
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def flatpak_packages(self) -> list[str]:
|
||||||
|
"""
|
||||||
|
Override this method to return flatpak packages that should be installed as a part of this
|
||||||
|
Module.
|
||||||
|
"""
|
||||||
|
return []
|
||||||
|
|
||||||
def systemd_units(self) -> list[str]:
|
def systemd_units(self) -> list[str]:
|
||||||
"""
|
"""
|
||||||
Override this method to return systemd units that should be enabled as a part of this
|
Override this method to return systemd units that should be enabled as a part of this
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ class Source:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
result: list[str] = []
|
result: list[str] = []
|
||||||
for pkg in self.flatpak_packages:
|
for pkg in self._all_flatpak_packages():
|
||||||
if pkg in self.ignored_flatpak_packages:
|
if pkg in self.ignored_flatpak_packages:
|
||||||
continue
|
continue
|
||||||
if pkg not in currently_installed_packages:
|
if pkg not in currently_installed_packages:
|
||||||
@@ -668,7 +668,7 @@ class Source:
|
|||||||
for package in currently_installed_packages:
|
for package in currently_installed_packages:
|
||||||
if package in self.ignored_flatpak_packages:
|
if package in self.ignored_flatpak_packages:
|
||||||
continue
|
continue
|
||||||
if package not in self.flatpak_packages:
|
if package not in self._all_flatpak_packages():
|
||||||
result.append(package)
|
result.append(package)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@@ -702,6 +702,15 @@ class Source:
|
|||||||
result.update(module.pacman_packages())
|
result.update(module.pacman_packages())
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def _all_flatpak_packages(self) -> set[str]:
|
||||||
|
result = set()
|
||||||
|
result.update(self.flatpak_packages)
|
||||||
|
for module in self.modules:
|
||||||
|
if module.enabled:
|
||||||
|
result.update(module.flatpak_packages())
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def _all_foreign_pkgs(self) -> set[str]:
|
def _all_foreign_pkgs(self) -> set[str]:
|
||||||
result = set()
|
result = set()
|
||||||
result.update(self.aur_packages)
|
result.update(self.aur_packages)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
|
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
|
||||||
|
|
||||||
|
from typing import override
|
||||||
import unittest
|
import unittest
|
||||||
from decman.lib import Source, Store
|
from decman.lib import Source, Store
|
||||||
from decman import UserPackage, Module
|
from decman import UserPackage, Module
|
||||||
@@ -73,6 +74,9 @@ class EnabledTestModule(Module):
|
|||||||
def systemd_user_units(self) -> dict[str, list[str]]:
|
def systemd_user_units(self) -> dict[str, list[str]]:
|
||||||
return {"muser": ["M_u1.service"]}
|
return {"muser": ["M_u1.service"]}
|
||||||
|
|
||||||
|
def flatpak_packages(self) -> list[str]:
|
||||||
|
return ["M_f1", "M_f2"]
|
||||||
|
|
||||||
|
|
||||||
class DisabledTestModule(Module):
|
class DisabledTestModule(Module):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user