Updated for repo update

This commit is contained in:
Dimitris Zlatanidis 2023-03-28 19:37:29 +03:00
parent cb0946a162
commit 401a19c69f
2 changed files with 23 additions and 10 deletions

View file

@ -53,15 +53,19 @@ class UpdateRepository(Configs):
print()
if self.utils.is_option(self.flag_bin_repository, self.flags):
self.alien_repository()
self.gnome_repository()
self.conraid_repository()
if self.repository == self.repos.alien_repo_name or self.repository == '*':
self.alien_repository()
if self.repository == self.repos.gnome_repo_name or self.repository == '*':
self.gnome_repository()
if self.repository == self.repos.conraid_repo_name or self.repository == '*':
self.conraid_repository()
else:
self.slackbuild_repositories()
def alien_repository(self):
if (self.repos.alien_repo and self.repository == self.repos.alien_repo_name or
self.repos.alien_repo and self.repository == '*' or self.repos.alien_repo and not self.repository):
if self.repos.alien_repo:
urls: list = []
print('Updating the packages list...\n')
print(f"Downloading the '{self.green}{self.repos.alien_repo_name}{self.endc}' repository, please wait...\n")
@ -82,10 +86,11 @@ class UpdateRepository(Configs):
self.delete_binaries_data(self.repos.alien_repo_name)
self.data.install_alien_data()
print()
else:
self.not_enabled_message(self.repos.alien_repo_name)
def gnome_repository(self):
if (self.repos.gnome_repo and self.repository == self.repos.gnome_repo_name or
self.repos.conraid_repo and self.repository == '*' or self.repos.gnome_repo and not self.repository):
if self.repos.gnome_repo:
urls: list = []
print('Updating the packages list...\n')
print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}{self.endc}' repository, please wait...\n")
@ -106,10 +111,11 @@ class UpdateRepository(Configs):
self.delete_binaries_data(self.repos.gnome_repo_name)
self.data.install_gnome_data()
print()
else:
self.not_enabled_message(self.repos.gnome_repo_name)
def conraid_repository(self):
if (self.repos.conraid_repo and self.repository == self.repos.conraid_repo_name or
self.repos.conraid_repo and self.repository == '*' or self.repos.conraid_repo and not self.repository):
if self.repos.conraid_repo:
urls: list = []
print('Updating the packages list...\n')
print(f"Downloading the '{self.green}{self.repos.conraid_repo_name}{self.endc}' "
@ -131,6 +137,8 @@ class UpdateRepository(Configs):
self.delete_binaries_data(self.repos.conraid_repo_name)
self.data.install_conraid_data()
print()
else:
self.not_enabled_message(self.repos.conraid_repo_name)
def slackbuild_repositories(self):
""" Update the slackbuild repositories. """
@ -172,6 +180,10 @@ class UpdateRepository(Configs):
self.delete_sbo_data()
self.data.install_sbos_data()
def not_enabled_message(self, repo: str) -> None:
print(f"{self.prog_name}: {self.bred}Error{self.endc}: "
f"The repository '{self.green}{repo}{self.endc}' is not enabled.")
def make_dirs(self, repo):
""" Creating the repositories folders. """
path = Path(self.lib_path, 'repositories', repo)

View file

@ -172,7 +172,8 @@ class Utilities:
with open(file, 'r', encoding='utf-8') as f:
return f.readlines()
def process(self, command: str, stderr=None, stdout=None) -> None:
@staticmethod
def process(command: str, stderr=None, stdout=None) -> None:
""" Handle the processes. """
try:
subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)