Updated for ticked on/off #181

This commit is contained in:
Dimitris Zlatanidis 2024-03-31 20:06:17 +03:00
parent 1f3c9084a3
commit c47870e706
3 changed files with 13 additions and 6 deletions

View file

@ -4,6 +4,7 @@
- Updated: - Updated:
* Updated for coding style * Updated for coding style
* Updated tomli import for -current version * Updated tomli import for -current version
* Updated for "ticked on/off" packages if they are already up-to-date #181
- Bugfixes: - Bugfixes:
* Check for custom upgrade packages (Thanks to Marav) * Check for custom upgrade packages (Thanks to Marav)

View file

@ -7,6 +7,7 @@ import json
from pathlib import Path from pathlib import Path
from collections import OrderedDict from collections import OrderedDict
from slpkg.upgrade import Upgrade
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.checksum import Md5sum from slpkg.checksum import Md5sum
from slpkg.views.views import View from slpkg.views.views import View
@ -35,6 +36,7 @@ class Packages(Configs):
self.view = View(flags, repository, data) self.view = View(flags, repository, data)
self.check_md5 = Md5sum(flags) self.check_md5 = Md5sum(flags)
self.download = Downloader(flags) self.download = Downloader(flags)
self.upgrade = Upgrade(repository, data)
self.ascii = AsciiBox() self.ascii = AsciiBox()
self.gpg = GPGVerify() self.gpg = GPGVerify()
@ -179,7 +181,7 @@ class Packages(Configs):
def set_progress_message(self) -> None: def set_progress_message(self) -> None:
if self.mode == 'upgrade' or self.option_for_reinstall: if self.mode == 'upgrade' or self.option_for_reinstall:
self.progress_message: str = f'{self.cyan}Upgrading{self.endc}' self.progress_message: str = f'{self.violet}Upgrading{self.endc}'
def choose_package_dependencies(self) -> None: def choose_package_dependencies(self) -> None:
if self.dependencies and self.dialog: if self.dependencies and self.dialog:
@ -194,14 +196,15 @@ class Packages(Configs):
repo_ver: str = self.data[package]['version'] repo_ver: str = self.data[package]['version']
help_text: str = f'Package: {package} {repo_ver}' help_text: str = f'Package: {package} {repo_ver}'
installed: str = self.utils.is_package_installed(package) installed: str = self.utils.is_package_installed(package)
upgradeable: bool = self.upgrade.is_package_upgradeable(installed)
if installed: if installed:
status: bool = False status: bool = False
if self.option_for_reinstall: if self.mode == 'upgrade' and upgradeable:
status: bool = True status: bool = True
if self.mode == 'upgrade': if self.option_for_reinstall:
status: bool = True status: bool = True
choices.extend([(package, repo_ver, status, help_text)]) choices.extend([(package, repo_ver, status, help_text)])

View file

@ -9,6 +9,7 @@ import shutil
from pathlib import Path from pathlib import Path
from collections import OrderedDict from collections import OrderedDict
from slpkg.upgrade import Upgrade
from slpkg.checksum import Md5sum from slpkg.checksum import Md5sum
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.views.views import View from slpkg.views.views import View
@ -41,6 +42,7 @@ class Slackbuilds(Configs):
self.view = View(flags, repository, data) self.view = View(flags, repository, data)
self.check_md5 = Md5sum(flags) self.check_md5 = Md5sum(flags)
self.download = Downloader(flags) self.download = Downloader(flags)
self.upgrade = Upgrade(repository, data)
self.gpg = GPGVerify() self.gpg = GPGVerify()
self.sources: dict = {} self.sources: dict = {}
@ -247,7 +249,7 @@ class Slackbuilds(Configs):
def set_progress_message(self) -> None: def set_progress_message(self) -> None:
if self.mode == 'upgrade' or self.option_for_reinstall: if self.mode == 'upgrade' or self.option_for_reinstall:
self.progress_message: str = f'{self.cyan}Upgrading{self.endc}' self.progress_message: str = f'{self.violet}Upgrading{self.endc}'
def set_makeflags(self) -> None: def set_makeflags(self) -> None:
os.environ['MAKEFLAGS'] = f'-j {self.makeflags}' os.environ['MAKEFLAGS'] = f'-j {self.makeflags}'
@ -266,14 +268,15 @@ class Slackbuilds(Configs):
description: str = self.data[package]['description'] description: str = self.data[package]['description']
help_text: str = f'Description: {description}' help_text: str = f'Description: {description}'
installed: str = self.utils.is_package_installed(package) installed: str = self.utils.is_package_installed(package)
upgradeable: bool = self.upgrade.is_package_upgradeable(installed)
if installed: if installed:
status: bool = False status: bool = False
if self.option_for_reinstall: if self.mode == 'upgrade' and upgradeable:
status: bool = True status: bool = True
if self.mode == 'upgrade': if self.option_for_reinstall:
status: bool = True status: bool = True
choices.extend( choices.extend(