Updated for coding style

This commit is contained in:
Dimitris Zlatanidis 2023-04-01 19:39:11 +03:00
parent e3cd0543bc
commit b86e446721
2 changed files with 109 additions and 107 deletions

View file

@ -42,7 +42,7 @@ class RepoInfo(Configs):
print(f"{'Name:':<18}{'Status:':<15}{'Last Updated:':<35}{'Packages:':>12}")
print('=' * self.columns)
for repo, value in self.repos.repos_dict.items():
for repo, value in self.repos.repositories.items():
count: int = 0
status: str = 'Disabled'
color: str = self.red
@ -71,5 +71,5 @@ class RepoInfo(Configs):
f"{self.yellow}{count:>12}{self.endc}")
print('=' * self.columns)
print(f"{self.grey}Total of {enabled}/{len(self.repos.repos_dict)} "
print(f"{self.grey}Total of {enabled}/{len(self.repos.repositories)} "
f"repositories are enabled with {total_packages} packages available.\n")

View file

@ -18,12 +18,14 @@ class Repositories:
cyan: str = color['cyan']
endc: str = color['endc']
bred: str = f'{bold}{red}'
repositories_file_toml = Path(config.etc_path, 'repositories.toml')
repos = {}
binaries_repositories_dict = {}
repos_config = {}
repositories = {}
bin_repos_name = []
bin_enabled_repos = []
sbo_enabled: bool = True
sbo_enabled_repo: bool = True
sbo_repo_name: str = 'sbo'
sbo_repo_path: Path = Path(config.lib_path, 'repositories', sbo_repo_name)
@ -160,118 +162,118 @@ class Repositories:
try:
if repositories_file_toml.is_file():
with open(repositories_file_toml, 'rb') as repo:
repos = tomli.load(repo)['REPOSITORIES']
repos_config = tomli.load(repo)['REPOSITORIES']
sbo_repo_name: str = repos['SBO_REPO_NAME']
sbo_repo_mirror: str = repos['SBO_REPO_MIRROR']
sbo_repo_slackbuilds: str = repos['SBO_REPO_SLACKBUILDS']
sbo_repo_changelog: str = repos['SBO_REPO_CHANGELOG']
sbo_repo_tar_suffix: str = repos['SBO_REPO_TAR_SUFFIX']
sbo_repo_tag: str = repos['SBO_REPO_TAG']
sbo_repo_name: str = repos_config['SBO_REPO_NAME']
sbo_repo_mirror: str = repos_config['SBO_REPO_MIRROR']
sbo_repo_slackbuilds: str = repos_config['SBO_REPO_SLACKBUILDS']
sbo_repo_changelog: str = repos_config['SBO_REPO_CHANGELOG']
sbo_repo_tar_suffix: str = repos_config['SBO_REPO_TAR_SUFFIX']
sbo_repo_tag: str = repos_config['SBO_REPO_TAG']
ponce_repo: bool = repos['PONCE_REPO']
ponce_repo_name: str = repos['PONCE_REPO_NAME']
ponce_repo_mirror: str = repos['PONCE_REPO_MIRROR']
ponce_repo_slackbuilds: str = repos['PONCE_REPO_SLACKBUILDS']
ponce_repo_changelog: str = repos['PONCE_REPO_CHANGELOG']
ponce_repo_tag: str = repos['PONCE_REPO_TAG']
ponce_repo: bool = repos_config['PONCE_REPO']
ponce_repo_name: str = repos_config['PONCE_REPO_NAME']
ponce_repo_mirror: str = repos_config['PONCE_REPO_MIRROR']
ponce_repo_slackbuilds: str = repos_config['PONCE_REPO_SLACKBUILDS']
ponce_repo_changelog: str = repos_config['PONCE_REPO_CHANGELOG']
ponce_repo_tag: str = repos_config['PONCE_REPO_TAG']
alien_repo: bool = repos['ALIEN_REPO']
alien_repo_name: str = repos['ALIEN_REPO_NAME']
alien_repo_mirror: str = repos['ALIEN_REPO_MIRROR']
alien_repo_changelog_mirror: str = repos['ALIEN_REPO_CHANGELOG_MIRROR']
alien_repo_packages: str = repos['ALIEN_REPO_PACKAGES']
alien_repo_checksums: str = repos['ALIEN_REPO_CHECKSUMS']
alien_repo_changelog: str = repos['ALIEN_REPO_CHANGELOG']
alien_repo: bool = repos_config['ALIEN_REPO']
alien_repo_name: str = repos_config['ALIEN_REPO_NAME']
alien_repo_mirror: str = repos_config['ALIEN_REPO_MIRROR']
alien_repo_changelog_mirror: str = repos_config['ALIEN_REPO_CHANGELOG_MIRROR']
alien_repo_packages: str = repos_config['ALIEN_REPO_PACKAGES']
alien_repo_checksums: str = repos_config['ALIEN_REPO_CHECKSUMS']
alien_repo_changelog: str = repos_config['ALIEN_REPO_CHANGELOG']
multilib_repo: bool = repos['MULTILIB_REPO']
multilib_repo_name: str = repos['MULTILIB_REPO_NAME']
multilib_repo_mirror: str = repos['MULTILIB_REPO_MIRROR']
multilib_repo_changelog_mirror: str = repos['MULTILIB_REPO_CHANGELOG_MIRROR']
multilib_repo_packages: str = repos['MULTILIB_REPO_PACKAGES']
multilib_repo_checksums: str = repos['MULTILIB_REPO_CHECKSUMS']
multilib_repo_changelog: str = repos['MULTILIB_REPO_CHANGELOG']
multilib_repo: bool = repos_config['MULTILIB_REPO']
multilib_repo_name: str = repos_config['MULTILIB_REPO_NAME']
multilib_repo_mirror: str = repos_config['MULTILIB_REPO_MIRROR']
multilib_repo_changelog_mirror: str = repos_config['MULTILIB_REPO_CHANGELOG_MIRROR']
multilib_repo_packages: str = repos_config['MULTILIB_REPO_PACKAGES']
multilib_repo_checksums: str = repos_config['MULTILIB_REPO_CHECKSUMS']
multilib_repo_changelog: str = repos_config['MULTILIB_REPO_CHANGELOG']
restricted_repo: bool = repos['RESTRICTED_REPO']
restricted_repo_name: str = repos['RESTRICTED_REPO_NAME']
restricted_repo_mirror: str = repos['RESTRICTED_REPO_MIRROR']
restricted_repo_changelog_mirror: str = repos['RESTRICTED_REPO_CHANGELOG_MIRROR']
restricted_repo_packages: str = repos['RESTRICTED_REPO_PACKAGES']
restricted_repo_checksums: str = repos['RESTRICTED_REPO_CHECKSUMS']
restricted_repo_changelog: str = repos['RESTRICTED_REPO_CHANGELOG']
restricted_repo: bool = repos_config['RESTRICTED_REPO']
restricted_repo_name: str = repos_config['RESTRICTED_REPO_NAME']
restricted_repo_mirror: str = repos_config['RESTRICTED_REPO_MIRROR']
restricted_repo_changelog_mirror: str = repos_config['RESTRICTED_REPO_CHANGELOG_MIRROR']
restricted_repo_packages: str = repos_config['RESTRICTED_REPO_PACKAGES']
restricted_repo_checksums: str = repos_config['RESTRICTED_REPO_CHECKSUMS']
restricted_repo_changelog: str = repos_config['RESTRICTED_REPO_CHANGELOG']
gnome_repo: bool = repos['GNOME_REPO']
gnome_repo_name: str = repos['GNOME_REPO_NAME']
gnome_repo_mirror: str = repos['GNOME_REPO_MIRROR']
gnome_repo_packages: str = repos['GNOME_REPO_PACKAGES']
gnome_repo_checksums: str = repos['GNOME_REPO_CHECKSUMS']
gnome_repo_changelog: str = repos['GNOME_REPO_CHANGELOG']
gnome_repo: bool = repos_config['GNOME_REPO']
gnome_repo_name: str = repos_config['GNOME_REPO_NAME']
gnome_repo_mirror: str = repos_config['GNOME_REPO_MIRROR']
gnome_repo_packages: str = repos_config['GNOME_REPO_PACKAGES']
gnome_repo_checksums: str = repos_config['GNOME_REPO_CHECKSUMS']
gnome_repo_changelog: str = repos_config['GNOME_REPO_CHANGELOG']
msb_repo: bool = repos['MSB_REPO']
msb_repo_name: str = repos['MSB_REPO_NAME']
msb_repo_mirror: str = repos['MSB_REPO_MIRROR']
msb_repo_changelog_mirror: str = repos['MSB_REPO_CHANGELOG_MIRROR']
msb_repo_packages: str = repos['MSB_REPO_PACKAGES']
msb_repo_checksums: str = repos['MSB_REPO_CHECKSUMS']
msb_repo_changelog: str = repos['MSB_REPO_CHANGELOG']
msb_repo: bool = repos_config['MSB_REPO']
msb_repo_name: str = repos_config['MSB_REPO_NAME']
msb_repo_mirror: str = repos_config['MSB_REPO_MIRROR']
msb_repo_changelog_mirror: str = repos_config['MSB_REPO_CHANGELOG_MIRROR']
msb_repo_packages: str = repos_config['MSB_REPO_PACKAGES']
msb_repo_checksums: str = repos_config['MSB_REPO_CHECKSUMS']
msb_repo_changelog: str = repos_config['MSB_REPO_CHANGELOG']
csb_repo: bool = repos['CSB_REPO']
csb_repo_name: str = repos['CSB_REPO_NAME']
csb_repo_mirror: str = repos['CSB_REPO_MIRROR']
csb_repo_changelog_mirror: str = repos['CSB_REPO_CHANGELOG_MIRROR']
csb_repo_packages: str = repos['CSB_REPO_PACKAGES']
csb_repo_checksums: str = repos['CSB_REPO_CHECKSUMS']
csb_repo_changelog: str = repos['CSB_REPO_CHANGELOG']
csb_repo: bool = repos_config['CSB_REPO']
csb_repo_name: str = repos_config['CSB_REPO_NAME']
csb_repo_mirror: str = repos_config['CSB_REPO_MIRROR']
csb_repo_changelog_mirror: str = repos_config['CSB_REPO_CHANGELOG_MIRROR']
csb_repo_packages: str = repos_config['CSB_REPO_PACKAGES']
csb_repo_checksums: str = repos_config['CSB_REPO_CHECKSUMS']
csb_repo_changelog: str = repos_config['CSB_REPO_CHANGELOG']
conraid_repo: bool = repos['CONRAID_REPO']
conraid_repo_name: str = repos['CONRAID_REPO_NAME']
conraid_repo_mirror: str = repos['CONRAID_REPO_MIRROR']
conraid_repo_packages: str = repos['CONRAID_REPO_PACKAGES']
conraid_repo_checksums: str = repos['CONRAID_REPO_CHECKSUMS']
conraid_repo_changelog: str = repos['CONRAID_REPO_CHANGELOG']
conraid_repo: bool = repos_config['CONRAID_REPO']
conraid_repo_name: str = repos_config['CONRAID_REPO_NAME']
conraid_repo_mirror: str = repos_config['CONRAID_REPO_MIRROR']
conraid_repo_packages: str = repos_config['CONRAID_REPO_PACKAGES']
conraid_repo_checksums: str = repos_config['CONRAID_REPO_CHECKSUMS']
conraid_repo_changelog: str = repos_config['CONRAID_REPO_CHANGELOG']
slackonly_repo: bool = repos['SLACKONLY_REPO']
slackonly_repo_name: str = repos['SLACKONLY_REPO_NAME']
slackonly_repo_mirror: str = repos['SLACKONLY_REPO_MIRROR']
slackonly_repo_packages: str = repos['SLACKONLY_REPO_PACKAGES']
slackonly_repo_checksums: str = repos['SLACKONLY_REPO_CHECKSUMS']
slackonly_repo_changelog: str = repos['SLACKONLY_REPO_CHANGELOG']
slackonly_repo: bool = repos_config['SLACKONLY_REPO']
slackonly_repo_name: str = repos_config['SLACKONLY_REPO_NAME']
slackonly_repo_mirror: str = repos_config['SLACKONLY_REPO_MIRROR']
slackonly_repo_packages: str = repos_config['SLACKONLY_REPO_PACKAGES']
slackonly_repo_checksums: str = repos_config['SLACKONLY_REPO_CHECKSUMS']
slackonly_repo_changelog: str = repos_config['SLACKONLY_REPO_CHANGELOG']
ponce_bin_repo: bool = repos['PONCE_BIN_REPO']
ponce_bin_repo_name: str = repos['PONCE_BIN_REPO_NAME']
ponce_bin_repo_mirror: str = repos['PONCE_BIN_REPO_MIRROR']
ponce_bin_repo_packages: str = repos['PONCE_BIN_REPO_PACKAGES']
ponce_bin_repo_checksums: str = repos['PONCE_BIN_REPO_CHECKSUMS']
ponce_bin_repo_changelog: str = repos['PONCE_BIN_REPO_CHANGELOG']
ponce_bin_repo: bool = repos_config['PONCE_BIN_REPO']
ponce_bin_repo_name: str = repos_config['PONCE_BIN_REPO_NAME']
ponce_bin_repo_mirror: str = repos_config['PONCE_BIN_REPO_MIRROR']
ponce_bin_repo_packages: str = repos_config['PONCE_BIN_REPO_PACKAGES']
ponce_bin_repo_checksums: str = repos_config['PONCE_BIN_REPO_CHECKSUMS']
ponce_bin_repo_changelog: str = repos_config['PONCE_BIN_REPO_CHANGELOG']
salixos_repo: bool = repos['SALIXOS_REPO']
salixos_repo_name: str = repos['SALIXOS_REPO_NAME']
salixos_repo_mirror: str = repos['SALIXOS_REPO_MIRROR']
salixos_repo_packages: str = repos['SALIXOS_REPO_PACKAGES']
salixos_repo_checksums: str = repos['SALIXOS_REPO_CHECKSUMS']
salixos_repo_changelog: str = repos['SALIXOS_REPO_CHANGELOG']
salixos_repo: bool = repos_config['SALIXOS_REPO']
salixos_repo_name: str = repos_config['SALIXOS_REPO_NAME']
salixos_repo_mirror: str = repos_config['SALIXOS_REPO_MIRROR']
salixos_repo_packages: str = repos_config['SALIXOS_REPO_PACKAGES']
salixos_repo_checksums: str = repos_config['SALIXOS_REPO_CHECKSUMS']
salixos_repo_changelog: str = repos_config['SALIXOS_REPO_CHANGELOG']
salixos_extra_repo: bool = repos['SALIXOS_EXTRA_REPO']
salixos_extra_repo_name: str = repos['SALIXOS_EXTRA_REPO_NAME']
salixos_extra_repo_mirror: str = repos['SALIXOS_EXTRA_REPO_MIRROR']
salixos_extra_repo_packages_mirror: str = repos['SALIXOS_EXTRA_REPO_PACKAGES_MIRROR']
salixos_extra_repo_packages: str = repos['SALIXOS_EXTRA_REPO_PACKAGES']
salixos_extra_repo_checksums: str = repos['SALIXOS_EXTRA_REPO_CHECKSUMS']
salixos_extra_repo_changelog: str = repos['SALIXOS_EXTRA_REPO_CHANGELOG']
salixos_extra_repo: bool = repos_config['SALIXOS_EXTRA_REPO']
salixos_extra_repo_name: str = repos_config['SALIXOS_EXTRA_REPO_NAME']
salixos_extra_repo_mirror: str = repos_config['SALIXOS_EXTRA_REPO_MIRROR']
salixos_extra_repo_packages_mirror: str = repos_config['SALIXOS_EXTRA_REPO_PACKAGES_MIRROR']
salixos_extra_repo_packages: str = repos_config['SALIXOS_EXTRA_REPO_PACKAGES']
salixos_extra_repo_checksums: str = repos_config['SALIXOS_EXTRA_REPO_CHECKSUMS']
salixos_extra_repo_changelog: str = repos_config['SALIXOS_EXTRA_REPO_CHANGELOG']
slackel_repo: bool = repos['SLACKEL_REPO']
slackel_repo_name: str = repos['SLACKEL_REPO_NAME']
slackel_repo_mirror: str = repos['SLACKEL_REPO_MIRROR']
slackel_repo_packages: str = repos['SLACKEL_REPO_PACKAGES']
slackel_repo_checksums: str = repos['SLACKEL_REPO_CHECKSUMS']
slackel_repo_changelog: str = repos['SLACKEL_REPO_CHANGELOG']
slackel_repo: bool = repos_config['SLACKEL_REPO']
slackel_repo_name: str = repos_config['SLACKEL_REPO_NAME']
slackel_repo_mirror: str = repos_config['SLACKEL_REPO_MIRROR']
slackel_repo_packages: str = repos_config['SLACKEL_REPO_PACKAGES']
slackel_repo_checksums: str = repos_config['SLACKEL_REPO_CHECKSUMS']
slackel_repo_changelog: str = repos_config['SLACKEL_REPO_CHANGELOG']
slint_repo: bool = repos['SLINT_REPO']
slint_repo_name: str = repos['SLINT_REPO_NAME']
slint_repo_mirror: str = repos['SLINT_REPO_MIRROR']
slint_repo_packages: str = repos['SLINT_REPO_PACKAGES']
slint_repo_checksums: str = repos['SLINT_REPO_CHECKSUMS']
slint_repo_changelog: str = repos['SLINT_REPO_CHANGELOG']
slint_repo: bool = repos_config['SLINT_REPO']
slint_repo_name: str = repos_config['SLINT_REPO_NAME']
slint_repo_mirror: str = repos_config['SLINT_REPO_MIRROR']
slint_repo_packages: str = repos_config['SLINT_REPO_PACKAGES']
slint_repo_checksums: str = repos_config['SLINT_REPO_CHECKSUMS']
slint_repo_changelog: str = repos_config['SLINT_REPO_CHANGELOG']
except (tomli.TOMLDecodeError, KeyError) as error:
raise SystemExit(f'\n{config.prog_name} {bred}Error{endc}: {error}: in the configuration file '
@ -284,11 +286,11 @@ class Repositories:
if ponce_repo:
sbo_enabled_repository: str = ponce_repo_name
repo_tag: str = ponce_repo_tag
sbo_enabled: bool = False
sbo_enabled_repo: bool = False
# List of repositories.
repos_dict = {
sbo_repo_name: [sbo_enabled, sbo_repo_path, sbo_repo_changelog],
repositories = {
sbo_repo_name: [sbo_enabled_repo, sbo_repo_path, sbo_repo_changelog],
ponce_repo_name: [ponce_repo, ponce_repo_path, ponce_repo_changelog],
alien_repo_name: [alien_repo, alien_repo_path, alien_repo_changelog],
multilib_repo_name: [multilib_repo, multilib_repo_path, multilib_repo_changelog],
@ -306,10 +308,10 @@ class Repositories:
}
# All the binary repositories names.
bin_repos_names = list(repos_dict.keys())[2:]
bin_repos_names = list(repositories.keys())[2:]
# All the enabled binary repositories names.
for repo, enabled in repos_dict.items():
for repo, enabled in repositories.items():
if repo not in [sbo_repo_name, ponce_repo_name]:
if enabled[0]:
bin_enabled_repos.append(repo)