Updated configs

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-12-06 13:13:31 +02:00
parent 422f518cf7
commit 74be03c890
4 changed files with 15 additions and 15 deletions

View file

@ -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')

View file

@ -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)

View file

@ -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

View file

@ -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):