Fixed for done message

This commit is contained in:
Dimitris Zlatanidis 2023-05-18 11:39:17 +03:00
parent abad7e7dbc
commit 124f9362a1

View file

@ -6,6 +6,7 @@ from pathlib import Path
from slpkg.configs import Configs
from slpkg.utilities import Utilities
from slpkg.views.asciibox import AsciiBox
from slpkg.repositories import Repositories
from slpkg.models.models import session as Session
from slpkg.models.models import (SBoTable, PonceTable,
@ -19,6 +20,7 @@ class InstallData(Configs):
self.session = Session
self.utils = Utilities()
self.repos = Repositories()
self.ascii = AsciiBox()
def last_updated(self, repo_file: Path) -> str:
""" Reads the first date of the changelog file."""
@ -28,6 +30,9 @@ class InstallData(Configs):
if line.startswith(days):
return line.replace('\n', '')
def view_done_message(self):
print(f'{self.yellow}{self.ascii.done}{self.endc}\n')
def install_sbo_data(self) -> None:
""" Install the data for SBo repository. """
sbo_tags = [
@ -72,11 +77,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.sbo_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_ponce_data(self) -> None:
""" Install the data for SBo repository. """
sbo_tags = [
@ -121,11 +125,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.ponce_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slack_data(self) -> None:
""" Install the data for slackware repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slack_repo_name}{self.endc}'... ",
@ -212,11 +215,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slack_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slack_extra_data(self) -> None:
""" Install the data for slackware extra repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slack_extra_repo_name}{self.endc}'... ",
@ -303,11 +305,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slack_extra_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slack_patches_data(self) -> None:
""" Install the data for slackware patches repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slack_patches_repo_name}{self.endc}'... ",
@ -394,11 +395,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slack_patches_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_alien_data(self) -> None:
""" Install the data for alien repository. """
print(f"Updating the database for '{self.cyan}{self.repos.alien_repo_name}{self.endc}'... ",
@ -491,11 +491,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.alien_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_multilib_data(self) -> None:
""" Install the data for multilib repository. """
print(f"Updating the database for '{self.cyan}{self.repos.multilib_repo_name}{self.endc}'... ",
@ -582,11 +581,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.multilib_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_restricted_data(self) -> None:
""" Install the data for multilib repository. """
print(f"Updating the database for '{self.cyan}{self.repos.restricted_repo_name}{self.endc}'... ",
@ -673,11 +671,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.restricted_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_gnome_data(self) -> None:
""" Install the data for gnome repository. """
print(f"Updating the database for '{self.cyan}{self.repos.gnome_repo_name}{self.endc}'... ",
@ -765,11 +762,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.gnome_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_msb_data(self) -> None:
""" Install the data for msb repository. """
print(f"Updating the database for '{self.cyan}{self.repos.msb_repo_name}{self.endc}'... ",
@ -856,11 +852,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.msb_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_csb_data(self) -> None:
""" Install the data for csb repository. """
print(f"Updating the database for '{self.cyan}{self.repos.csb_repo_name}{self.endc}'... ",
@ -947,11 +942,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.csb_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_conraid_data(self) -> None:
""" Install the data for conraid repository. """
print(f"Updating the database for '{self.cyan}{self.repos.conraid_repo_name}{self.endc}'... ",
@ -1039,11 +1033,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.conraid_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slackonly_data(self) -> None:
""" Install the data for slackonly repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slackonly_repo_name}{self.endc}'... ",
@ -1136,11 +1129,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slackonly_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_salixos_data(self) -> None:
""" Install the data for salixos repository. """
print(f"Updating the database for '{self.cyan}{self.repos.salixos_repo_name}{self.endc}'... ",
@ -1241,11 +1233,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.salixos_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_salixos_extra_data(self) -> None:
""" Install the data for salixos_extra repository. """
print(f"Updating the database for '{self.cyan}{self.repos.salixos_extra_repo_name}{self.endc}'... ",
@ -1347,11 +1338,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.salixos_extra_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_salixos_patches_data(self) -> None:
""" Install the data for salixos_patches repository. """
print(f"Updating the database for '{self.cyan}{self.repos.salixos_patches_repo_name}{self.endc}'... ",
@ -1453,11 +1443,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.salixos_patches_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slackel_data(self) -> None:
""" Install the data for slackel repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slackel_repo_name}{self.endc}'... ",
@ -1558,11 +1547,10 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slackel_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()
def install_slint_data(self) -> None:
""" Install the data for slint repository. """
print(f"Updating the database for '{self.cyan}{self.repos.slint_repo_name}{self.endc}'... ",
@ -1663,7 +1651,6 @@ class InstallData(Configs):
last_updated: str = self.last_updated(path_changelog)
date: str = LastRepoUpdated(repo=self.repos.slint_repo_name, date=last_updated)
self.session.add(date)
print(f'{self.byellow}Done{self.endc}\n')
self.session.commit()
self.view_done_message()