Updated for process message

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-04 18:29:14 +03:00
parent fd0f0917ab
commit e18cda64e7
2 changed files with 12 additions and 13 deletions

View file

@ -11,6 +11,7 @@ from slpkg.utilities import Utilities
from slpkg.views.asciibox import AsciiBox
from slpkg.repositories import Repositories
from slpkg.multi_process import MultiProcess
from slpkg.views.view_process import ViewProcess
class InstallData(Configs):
@ -18,12 +19,13 @@ class InstallData(Configs):
""" Installs data to the repositories path.
"""
def __init__(self):
def __init__(self, flags: list):
super(Configs, self).__init__()
self.utils = Utilities()
self.repos = Repositories()
self.ascii = AsciiBox()
self.multi_process = MultiProcess()
self.view_process = ViewProcess(flags)
def write_repo_info(self, changelog_file: Path, info: dict) -> None:
""" Reads the first date of the changelog file."""
@ -48,11 +50,6 @@ class InstallData(Configs):
self.repos.repos_information.write_text(json.dumps(repo_info, indent=4), encoding='utf-8')
def view_done_message(self) -> None:
""" Prints the done message.
"""
print(f'{self.bgreen}{self.ascii.done}{self.endc}\n')
def install_sbo_data(self, repo: str) -> None: # pylint: disable=[R0914]
""" Reads the SLACKBUILDS.TXT FILE and creates a json data file.
@ -62,8 +59,8 @@ class InstallData(Configs):
No Longer Returned:
None.
"""
print(f"Updating the database for '{self.cyan}{repo}{self.endc}'... ",
end='', flush=True)
print()
self.view_process.message(f'Updating the database for {repo}')
data: dict = {}
cache: list = []
@ -143,15 +140,16 @@ class InstallData(Configs):
data_file: Path = Path(self.repos.repositories[repo]['path'], self.repos.data_json)
data_file.write_text(json.dumps(data, indent=4), encoding='utf-8')
self.view_done_message()
self.view_process.done()
print()
def install_binary_data(self, repo: str) -> None: # pylint: disable=[R0912,R0914,R0915]
""" Installs the data for binary repositories.
Args:
repo (str): Description
"""
print(f"\nUpdating the database for '{self.cyan}{repo}{self.endc}'... ",
end='', flush=True)
print()
self.view_process.message(f'Updating the database for {repo}')
slack_repos: list = [self.repos.slack_patches_repo_name, self.repos.slack_extra_repo_name]
@ -275,4 +273,5 @@ class InstallData(Configs):
data_file: Path = Path(self.repos.repositories[repo]['path'], self.repos.data_json)
data_file.write_text(json.dumps(data, indent=4), encoding='utf-8')
self.view_done_message()
self.view_process.done()
print()

View file

@ -31,7 +31,7 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
self.multi_process = MultiProcess(flags)
self.repos = Repositories()
self.utils = Utilities()
self.data = InstallData()
self.data = InstallData(flags)
self.generate = SBoGenerate()
self.check_updates = CheckUpdates(flags, repository)
self.download = Downloader(flags)