Fixed for failed build message

This commit is contained in:
Dimitris Zlatanidis 2023-04-02 09:07:57 +03:00
parent 17a4c03048
commit aceb844afd

View file

@ -46,7 +46,6 @@ class Slackbuilds(Configs):
self.install_order: list = []
self.dependencies: list = []
self.sbos: dict = {}
self.output: int = 0
self.stderr = None
self.stdout = None
self.process_message: str = ''
@ -271,14 +270,19 @@ class Slackbuilds(Configs):
def package_for_install(self, name: str) -> str:
""" Returns the package for install. """
package_to_install: str = ''
version: str = SBoQueries(name).version()
pattern: str = f'{name}-{version}*{self.repos.repo_tag}*'
tmp = Path(self.tmp_path)
packages: list = [file.name for file in tmp.glob(pattern)]
return max(packages)
try:
package_to_install: str = max(packages)
except ValueError:
self.utils.raise_error_message(f"Package '{name}' not found for install")
return package_to_install
def build_the_script(self, path: Path, name: str) -> None:
""" Run the .SlackBuild script. """
@ -326,11 +330,10 @@ class Slackbuilds(Configs):
if not p1.is_alive():
if p1.exitcode != 0:
done: str = f' {self.bred} Failed{self.endc}'
self.output: int = p1.exitcode # type: ignore
done: str = f'{self.bred}Failed: {self.endc}{self.process_message}'
print(f'{self.endc}{done}', end='')
p2.terminate()
print(f'{self.endc}{done}', end='')
# Wait until process 2 finish
p2.join()
@ -340,13 +343,6 @@ class Slackbuilds(Configs):
else:
self.utils.process(command, self.stderr, self.stdout)
self.print_error()
def print_error(self) -> None:
""" Stop the process and print the error message. """
if self.output != 0:
self.utils.raise_error_message(f"{self.output}: {self.process_message}")
def choose_dependencies(self, dependencies: list) -> list:
""" Choose packages for install. """
height: int = 10