mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 05:54:15 +02:00
[debian] initial Debian package management support
This commit is contained in:
@@ -14,7 +14,7 @@ class ApplicationContext:
|
||||
def __init__(self, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: I18n,
|
||||
cache_factory: MemoryCacheFactory, disk_loader_factory: DiskCacheLoaderFactory,
|
||||
logger: logging.Logger, file_downloader: FileDownloader, distro: str, app_name: str,
|
||||
internet_checker: InternetChecker, root_user: bool):
|
||||
internet_checker: InternetChecker, root_user: bool, screen_width: int = -1, screen_height: int = -1):
|
||||
"""
|
||||
:param download_icons: if packages icons should be downloaded
|
||||
:param http_client: a shared instance of http client
|
||||
@@ -27,6 +27,8 @@ class ApplicationContext:
|
||||
:param distro
|
||||
:param app_name
|
||||
:param internet_checker
|
||||
:param screen_width
|
||||
:param screen_height
|
||||
"""
|
||||
self.download_icons = download_icons
|
||||
self.http_client = http_client
|
||||
@@ -44,6 +46,8 @@ class ApplicationContext:
|
||||
self.root_user = root_user
|
||||
self.root_password = None
|
||||
self.internet_checker = internet_checker
|
||||
self.screen_width = screen_width
|
||||
self.screen_height = screen_height
|
||||
|
||||
def is_system_x86_64(self):
|
||||
return self.arch_x86_64
|
||||
|
||||
@@ -4,7 +4,7 @@ import shutil
|
||||
from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import List, Set, Type, Tuple, Optional, Generator
|
||||
from typing import List, Set, Type, Tuple, Optional, Generator, TypeVar
|
||||
|
||||
import yaml
|
||||
|
||||
@@ -15,10 +15,12 @@ from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHisto
|
||||
CustomSoftwareAction
|
||||
from bauh.api.abstract.view import ViewComponent
|
||||
|
||||
P = TypeVar('P', bound=SoftwarePackage)
|
||||
|
||||
|
||||
class SearchResult:
|
||||
|
||||
def __init__(self, installed: Optional[List[SoftwarePackage]], new: Optional[List[SoftwarePackage]], total: int):
|
||||
def __init__(self, installed: Optional[List[P]], new: Optional[List[P]], total: int):
|
||||
"""
|
||||
:param installed: already installed packages
|
||||
:param new: new packages found
|
||||
@@ -40,9 +42,19 @@ class SearchResult:
|
||||
self.total = total
|
||||
|
||||
@classmethod
|
||||
def empty(cls):
|
||||
def empty(cls) -> "SearchResult":
|
||||
return cls(installed=[], new=[], total=0)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, SearchResult):
|
||||
if self.installed == other.installed:
|
||||
return self.new == other.new
|
||||
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.installed) + hash(self.new)
|
||||
|
||||
|
||||
class UpgradeRequirement:
|
||||
|
||||
@@ -69,7 +81,7 @@ class UpgradeRequirement:
|
||||
class UpgradeRequirements:
|
||||
|
||||
def __init__(self, to_install: Optional[List[UpgradeRequirement]], to_remove: Optional[List[UpgradeRequirement]],
|
||||
to_upgrade: List[UpgradeRequirement], cannot_upgrade: Optional[List[UpgradeRequirement]]):
|
||||
to_upgrade: Optional[List[UpgradeRequirement]], cannot_upgrade: Optional[List[UpgradeRequirement]]):
|
||||
"""
|
||||
:param to_install: additional packages that must be installed with the upgrade
|
||||
:param to_remove: non upgrading packages that should be removed due to conflicts with upgrading packages
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class NoInternetException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user