Updated for colors

This commit is contained in:
Dimitris Zlatanidis 2023-03-07 23:49:58 +02:00
parent 7b8ea29180
commit b761b04c40
2 changed files with 13 additions and 7 deletions

View file

@ -17,6 +17,13 @@ class Check(Configs, Utilities):
super(Utilities, self).__init__()
self.black = Blacklist()
self.color = self.colour()
self.bold: str = self.color['bold']
self.red: str = self.color['red']
self.endc: str = self.color['endc']
self.byellow: str = f'{self.bold}{self.yellow}'
self.bred: str = f'{self.bold}{self.red}'
def exists(self, slackbuilds: list) -> list:
""" Checking if the slackbuild exists in the repository. """
@ -31,19 +38,18 @@ class Check(Configs, Utilities):
not_packages.append(sbo)
if not_packages:
raise SystemExit(f'\nError: Packages \'{", ".join(not_packages)}\' '
raise SystemExit(f'\n[{self.bred}Error{self.endc}]: Packages \'{", ".join(not_packages)}\' '
'does not exists.\n')
return slackbuilds
@staticmethod
def unsupported(slackbuilds: list) -> None:
def unsupported(self, slackbuilds: list) -> None:
""" Checking for unsupported slackbuilds. """
for sbo in slackbuilds:
sources = SBoQueries(sbo).sources()
if 'UNSUPPORTED' in sources:
raise SystemExit(f"\nError: Package '{sbo}' unsupported by arch.\n")
raise SystemExit(f"\n[{self.bred}Error{self.endc}]: Package '{sbo}' unsupported by arch.\n")
def installed(self, slackbuilds: list, file_pattern: str) -> list:
""" Checking for installed packages. """
@ -58,7 +64,7 @@ class Check(Configs, Utilities):
not_found.append(sbo)
if not_found:
raise SystemExit(f'\nError: Not found \'{", ".join(not_found)}\' '
raise SystemExit(f'\n[{self.bred}Error{self.endc}]: Not found \'{", ".join(not_found)}\' '
'installed packages.\n')
return found

View file

@ -152,7 +152,7 @@ class Slackbuilds(Configs):
slackbuild = Path(path_build_package, f'{sbo}.SlackBuild')
os.chmod(slackbuild, 0o775)
else:
print(f"[{self.red}Error{self.endc}]: package "
print(f"[{self.bred}Error{self.endc}]: package "
f"'{self.cyan}{sbo}{self.endc}' not found in the repository.")
self.view_message.question()
self.install_order.remove(sbo)
@ -337,7 +337,7 @@ class Slackbuilds(Configs):
def print_error(self) -> None:
""" Stop the process and print the error message. """
if self.output != 0:
raise SystemExit(f"\n[{self.red}FAILED{self.endc}]: {self.output}: {self.process_message}.\n")
raise SystemExit(f"\n[{self.bred}FAILED{self.endc}]: {self.output}: {self.process_message}.\n")
def choose_dependencies(self, dependencies: list) -> list:
""" Choose packages for install. """