diff --git a/slpkg/binaries/install.py b/slpkg/binaries/install.py index 78589f0b..7a1a3efd 100644 --- a/slpkg/binaries/install.py +++ b/slpkg/binaries/install.py @@ -100,7 +100,7 @@ class Packages(Configs): for pkg in self.install_order: - if self.is_for_install(pkg): + if self.continue_install(pkg): mirror: str = BinQueries(pkg, self.repo).mirror() location: str = BinQueries(pkg, self.repo).location() package: str = BinQueries(pkg, self.repo).package_bin() @@ -117,8 +117,11 @@ class Packages(Configs): down.download() print() - def is_for_install(self, name) -> bool: - """ Skip installed package when the option --skip-installed is applied. """ + def continue_install(self, name) -> bool: + """ Skip installed package when the option --skip-installed is applied + and continue to install if the package is upgradable or the --reinstall option + applied. + """ if self.utils.is_option(self.flag_skip_installed, self.flags): return False diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index ebc99841..2b522725 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -7,7 +7,6 @@ import shutil import subprocess from pathlib import Path -from typing import Literal from collections import OrderedDict from multiprocessing import Process, cpu_count @@ -136,12 +135,19 @@ class Slackbuilds(Configs): self.view_message.question() - def is_not_for_skipped(self, sbo: str) -> Literal[True]: - """ Condition to check if slackbuild is for skipped. """ - return (not self.utils.is_package_installed(sbo) or - self.upgrade.is_package_upgradeable(sbo) or - self.mode == 'build' or - self.utils.is_option(self.flag_reinstall, self.flags)) + def continue_build_or_install(self, name) -> bool: + """ Skip installed package when the option --skip-installed is applied + and continue to install if the package is upgradable or the --reinstall option + applied. + """ + if self.mode == 'build': + return True + + if self.utils.is_option(self.flag_skip_installed, self.flags): + return False + + if self.upgrade.is_package_upgradeable(name) or self.utils.is_option(self.flag_reinstall, self.flags): + return True def prepare_slackbuilds_for_build(self) -> None: """ Downloads files and sources. """ @@ -150,7 +156,7 @@ class Slackbuilds(Configs): for sbo in self.install_order: - if self.is_not_for_skipped(sbo): + if self.continue_build_or_install(sbo): build_path: Path = Path(self.build_path, sbo) @@ -203,7 +209,7 @@ class Slackbuilds(Configs): """ Build the slackbuilds and install. """ for sbo in self.install_order: - if self.is_not_for_skipped(sbo): + if self.continue_build_or_install(sbo): self.build_the_script(self.build_path, sbo) if not self.mode == 'build':