Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check dependencies for all xlets, check if already installed and only…
… ask for installation if there are packages missing
  • Loading branch information
schorschii committed Jan 7, 2024
commit 2e906d7b74c2688a5051a0ca93ba62caf1d775bc
19 changes: 19 additions & 0 deletions files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
try:
from gi.repository import Gio, Gtk, GObject, Gdk, GdkPixbuf, GLib
import mintcommon.aptdaemon
import apt_pkg
import tempfile
import zipfile
import shutil
Expand Down Expand Up @@ -850,7 +851,25 @@ def _ui_error_message(self, msg, detail=None):
def errorMessage(self, msg, detail=None):
ui_thread_do(self._ui_error_message, msg, detail)

def _check_dependencies(self, uuid):
dependencies = self.meta_map[uuid].get('dependencies', [])
if isinstance(dependencies, list) and len(dependencies) > 0:
apt_pkg.init()
self.apt_cache = apt_pkg.Cache(None)
missing_packages = []
for dependency in dependencies:
if dependency in self.apt_cache:
if (dependency not in missing_packages
and self.apt_cache[dependency].has_versions
and self.apt_cache[dependency].current_state != apt_pkg.CURSTATE_INSTALLED):
missing_packages.append(dependency)
if len(missing_packages) > 0:
self.apt = mintcommon.aptdaemon.APT(None)
self.apt.install_packages(dependencies)

def enable_extension(self, uuid, panel=1, box='right', position=0):
self._check_dependencies(uuid)

if self.collection_type == 'applet':
entries = []
applet_id = self.settings.get_int('next-applet-id')
Expand Down