Updated for comments

This commit is contained in:
Dimitris Zlatanidis 2023-03-30 16:56:43 +03:00
parent cdd28f0197
commit 02fd803fd0
2 changed files with 21 additions and 12 deletions

View file

@ -100,7 +100,7 @@ class Packages(Configs):
for pkg in self.install_order: for pkg in self.install_order:
if self.is_for_install(pkg): if self.continue_install(pkg):
mirror: str = BinQueries(pkg, self.repo).mirror() mirror: str = BinQueries(pkg, self.repo).mirror()
location: str = BinQueries(pkg, self.repo).location() location: str = BinQueries(pkg, self.repo).location()
package: str = BinQueries(pkg, self.repo).package_bin() package: str = BinQueries(pkg, self.repo).package_bin()
@ -117,8 +117,11 @@ class Packages(Configs):
down.download() down.download()
print() print()
def is_for_install(self, name) -> bool: def continue_install(self, name) -> bool:
""" Skip installed package when the option --skip-installed is applied. """ """ 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): if self.utils.is_option(self.flag_skip_installed, self.flags):
return False return False

View file

@ -7,7 +7,6 @@ import shutil
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from typing import Literal
from collections import OrderedDict from collections import OrderedDict
from multiprocessing import Process, cpu_count from multiprocessing import Process, cpu_count
@ -136,12 +135,19 @@ class Slackbuilds(Configs):
self.view_message.question() self.view_message.question()
def is_not_for_skipped(self, sbo: str) -> Literal[True]: def continue_build_or_install(self, name) -> bool:
""" Condition to check if slackbuild is for skipped. """ """ Skip installed package when the option --skip-installed is applied
return (not self.utils.is_package_installed(sbo) or and continue to install if the package is upgradable or the --reinstall option
self.upgrade.is_package_upgradeable(sbo) or applied.
self.mode == 'build' or """
self.utils.is_option(self.flag_reinstall, self.flags)) 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: def prepare_slackbuilds_for_build(self) -> None:
""" Downloads files and sources. """ """ Downloads files and sources. """
@ -150,7 +156,7 @@ class Slackbuilds(Configs):
for sbo in self.install_order: 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) build_path: Path = Path(self.build_path, sbo)
@ -203,7 +209,7 @@ class Slackbuilds(Configs):
""" Build the slackbuilds and install. """ """ Build the slackbuilds and install. """
for sbo in self.install_order: 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) self.build_the_script(self.build_path, sbo)
if not self.mode == 'build': if not self.mode == 'build':