Updated for process message

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-09-24 23:07:01 +03:00
parent d35934cd21
commit 677e9d5d2b

View file

@ -5,6 +5,7 @@
from pathlib import Path
from slpkg.configs import Configs
from slpkg.views.asciibox import AsciiBox
from slpkg.views.view_process import ViewProcess
class SBoGenerate(Configs):
@ -13,6 +14,7 @@ class SBoGenerate(Configs):
def __init__(self):
super(Configs, self).__init__()
self.ascii = AsciiBox()
self.view_process = ViewProcess()
def slackbuild_file(self, repo_path: Path, repo_slackbuild_txt: str) -> None: # pylint: disable=[R0914]
"""Create a SLACKBUILDS.TXT file.
@ -21,8 +23,6 @@ class SBoGenerate(Configs):
repo_path (Path): Path to file.
repo_slackbuild_txt (str): Name of file to create.
"""
print(f'Generating the {repo_slackbuild_txt} file... ', end='', flush=True)
# slackbuild.info variables
info_var: dict = {
1: 'PRGNAM=',
@ -37,6 +37,8 @@ class SBoGenerate(Configs):
10: 'EMAIL='
}
self.view_process.message(f'Generating the {repo_slackbuild_txt} file')
with open(Path(repo_path, repo_slackbuild_txt), 'w', encoding='utf-8') as sbo:
for path in repo_path.glob('**/*'):
if path.name.endswith('.info'):
@ -83,7 +85,8 @@ class SBoGenerate(Configs):
sbo.write(f'SLACKBUILD SHORT DESCRIPTION: {short_description}\n')
sbo.write('\n')
print(f'{self.bgreen}{self.ascii.done}{self.endc}\n')
self.view_process.done()
print()
@staticmethod
def read_short_description(path: Path, name: str) -> str: