Packages

class plinth.package.Packages(component_id: str, packages: list, skip_recommends: bool = False, conflicts: Optional[list] = None, conflicts_action: Optional[plinth.package.Packages.ConflictsAction] = None)[source]

Component to manage the packages of an app.

This component is responsible for installation, upgrades and uninstallation of packages required by an app.

class ConflictsAction(value)[source]

Action to take when a conflicting package is installed.

__init__(component_id: str, packages: list, skip_recommends: bool = False, conflicts: Optional[list] = None, conflicts_action: Optional[plinth.package.Packages.ConflictsAction] = None)[source]

Initialize a new packages component.

‘component_id’ should be a unique ID across all components of an app and across all components.

‘packages’ is the list of Debian packages managed by this component.

‘skip_recommends’ is a boolean specifying whether recommended packages should be installed along with the listed packages.

‘conflicts’ is the list of Debian packages that can’t simultaneously be installed with packages listed here. None if there are no known conflicting packages.

‘conflicts_action’ is a string representing the action to take when it is found that conflicting Debian packages are installed on the system. None if there are no known conflicting packages.

diagnose()[source]

Run diagnostics and return results.

find_conflicts() → Optional[list][source]

Return list of conflicting packages installed on the system.

get_actual_packages()list[source]

Return the computed list of packages to install.

Raise MissingPackageError if a required package is not available.

has_unavailable_packages() → Optional[bool][source]

Return whether any of the packages are not available.

Returns True if one or more of the packages is not available in the user’s Debian distribution or False otherwise. Returns None if it cannot be reliably determined whether the packages are available or not.

property package_expressions

Return the list of managed packages as expressions.

property possible_packages

Return the list of possible packages before resolving.

setup(old_version)[source]

Install the packages.

uninstall()[source]

Uninstall and purge the packages.