From 74be03c8903167dc5499a752cedb1512c85b929f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 6 Dec 2022 13:13:31 +0200 Subject: [PATCH] Updated configs Signed-off-by: Dimitris Zlatanidis --- slpkg/find_installed.py | 13 ++++++------- slpkg/main.py | 9 +++++---- slpkg/queries.py | 4 ++-- slpkg/remove_packages.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index f4f19bd2..584df426 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -11,9 +11,9 @@ class FindInstalled: ''' Find installed packages. ''' def __init__(self): - self.log_packages: str = Configs.log_packages - self.colors: dict = Configs.colour - self.sbo_repo_tag: str = Configs.sbo_repo_tag + self.configs: str = Configs + colors = self.configs.colour + self.color = colors() def find(self, packages: list): matching = [] @@ -22,15 +22,14 @@ class FindInstalled: f'that contains \'{", ".join([p for p in packages])}\' files:\n') for pkg in packages: - for package in os.listdir(self.log_packages): - if pkg in package and self.sbo_repo_tag in package: + for package in os.listdir(self.configs.log_packages): + if pkg in package and self.configs.sbo_repo_tag in package: matching.append(package) self.matched(matching) def matched(self, matching: list): - color = self.colors() if matching: for package in matching: - print(f'{color["CYAN"]}{package}{color["ENDC"]}') + print(f'{self.color["CYAN"]}{package}{self.color["ENDC"]}') else: print('\nDoes not match any package.\n') diff --git a/slpkg/main.py b/slpkg/main.py index ceb694fc..f91eaa4a 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -9,6 +9,7 @@ from slpkg.upgrade import Upgrade from slpkg.configs import Configs from slpkg.utilities import Utilities from slpkg.search import SearchPackage +from slpkg.views.cli_menu import Usage from slpkg.views.version import Version from slpkg.download_only import Download from slpkg.slackbuild import Slackbuilds @@ -17,7 +18,6 @@ from slpkg.find_installed import FindInstalled from slpkg.views.view_package import ViewPackage from slpkg.remove_packages import RemovePackages from slpkg.clean_logs import CleanLogsDependencies -from slpkg.views.cli_menu import Usage from slpkg.update_repository import UpdateRepository @@ -26,6 +26,7 @@ class Argparse: def __init__(self, args): self.args: list = args + self.configs = Configs self.usage = Usage() self.flag() self.check = Check() @@ -197,9 +198,9 @@ class Argparse: def clean_tmp(self): if len(self.args) == 1 and not self.flags: - path = Configs.tmp_path - tmp_slpkg = Configs.tmp_slpkg - folder = Configs.prog_name + path = self.configs.tmp_path + tmp_slpkg = self.configs.tmp_slpkg + folder = self.configs.prog_name utils = Utilities() utils.remove_folder_if_exists(path, folder) diff --git a/slpkg/queries.py b/slpkg/queries.py index 157609ed..95aa3cc7 100644 --- a/slpkg/queries.py +++ b/slpkg/queries.py @@ -14,7 +14,7 @@ class SBoQueries: def __init__(self, name): self.name: str = name self.session: str = Session - self.os_arch: str = Configs.os_arch + self.configs: str = Configs self.black = Blacklist() if self.name in self.black.get(): @@ -104,7 +104,7 @@ class SBoQueries: return '' def _chose_arch(self, arch, arch64): - if self.os_arch == 'x86_64' and arch64: + if self.configs.os_arch == 'x86_64' and arch64: return arch64 return arch diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index e57c7ff1..0208a22a 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -17,7 +17,7 @@ class RemovePackages: self.packages: str = packages self.flags: list = flags self.session: str = Session - self.removepkg: str = Configs.removepkg + self.configs: str = Configs def remove(self): ''' Removes package with dependencies. ''' @@ -40,7 +40,7 @@ class RemovePackages: def remove_packages(self): ''' Run Slackware command to remove the packages. ''' for package in self.installed_packages: - command = f'{self.removepkg} {package}' + command = f'{self.configs.removepkg} {package}' subprocess.call(command, shell=True) def delete_main_logs(self):