Switch for generator

This commit is contained in:
Dimitris Zlatanidis 2023-01-20 18:12:46 +02:00
parent 16da4eec5a
commit 3afe3145b2

View file

@ -25,7 +25,7 @@ class Utilities:
def is_installed(self, name: str) -> str: def is_installed(self, name: str) -> str:
""" Returns the installed package name. """ """ Returns the installed package name. """
installed = self.all_installed() installed = list(self.all_installed())
for package in installed: for package in installed:
pkg = self.split_installed_pkg(package)[0] pkg = self.split_installed_pkg(package)[0]
@ -37,15 +37,12 @@ class Utilities:
def all_installed(self) -> list: def all_installed(self) -> list:
""" Return all installed SBo packages from /val/log/packages folder. """ """ Return all installed SBo packages from /val/log/packages folder. """
installed = []
pattern = f'*{self.configs.sbo_repo_tag}' pattern = f'*{self.configs.sbo_repo_tag}'
var_log_packages = Path(self.configs.log_packages) var_log_packages = Path(self.configs.log_packages)
for file in var_log_packages.glob(pattern): for file in var_log_packages.glob(pattern):
if self.split_installed_pkg(file.name) not in self.black.get(): if self.split_installed_pkg(file.name) not in self.black.get():
installed.append(file.name) yield file.name
return installed
@staticmethod @staticmethod
def untar_archive(path: str, archive: str, ext_path: str): def untar_archive(path: str, archive: str, ext_path: str):