Updated for naming

This commit is contained in:
Dimitris Zlatanidis 2023-05-14 17:25:29 +03:00
parent e5e17b6969
commit 2a665c9d7d
4 changed files with 45 additions and 45 deletions

View file

@ -22,7 +22,7 @@ class InstallData(Configs):
def last_updated(self, repo_file: Path) -> str:
""" Reads the first date of the changelog file."""
lines: list = self.utils.read_file(repo_file)
lines: list = self.utils.read_text_file(repo_file)
days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
for line in lines:
if line.startswith(days):
@ -46,7 +46,7 @@ class InstallData(Configs):
path_slackbuilds: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
path_changelog: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
slackbuilds_txt: list = self.utils.read_file(path_slackbuilds)
slackbuilds_txt: list = self.utils.read_text_file(path_slackbuilds)
cache: list = [] # init cache
@ -95,7 +95,7 @@ class InstallData(Configs):
path_slackbuilds = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
path_changelog: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
slackbuilds_txt: list = self.utils.read_file(path_slackbuilds)
slackbuilds_txt: list = self.utils.read_text_file(path_slackbuilds)
cache: list = [] # init cache
@ -143,8 +143,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_packages)
path_checksums: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_checksums)
path_changelog: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slack_repo_mirror[0]
if self.repos.slack_repo_local[0].startswith('file'):
@ -234,8 +234,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_packages)
path_checksums: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_checksums)
path_changelog: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slack_extra_repo_mirror[0]
if self.repos.slack_extra_repo_local[0].startswith('file'):
@ -325,8 +325,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_packages)
path_checksums: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_checksums)
path_changelog: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slack_patches_repo_mirror[0]
if self.repos.slack_patches_repo_local[0].startswith('file'):
@ -416,8 +416,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_packages)
path_checksums: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_checksums)
path_changelog: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.alien_repo_mirror)
if self.repos.alien_repo_local[0].startswith('file'):
@ -512,8 +512,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_packages)
path_checksums: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_checksums)
path_changelog: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.multilib_repo_mirror)
if self.repos.multilib_repo_local[0].startswith('file'):
@ -603,8 +603,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_packages)
path_checksums: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_checksums)
path_changelog: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.restricted_repo_mirror)
if self.repos.restricted_repo_local[0].startswith('file'):
@ -695,8 +695,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_packages)
path_checksums: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_checksums)
path_changelog: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.gnome_repo_mirror[0]
if self.repos.gnome_repo_local[0].startswith('file'):
@ -786,8 +786,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_packages)
path_checksums: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_checksums)
path_changelog: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.msb_repo_mirror)
if self.repos.msb_repo_local[0].startswith('file'):
@ -877,8 +877,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_packages)
path_checksums: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_checksums)
path_changelog: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = ''.join(self.repos.csb_repo_mirror)
if self.repos.csb_repo_local[0].startswith('file'):
@ -969,8 +969,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_packages)
path_checksums: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_checksums)
path_changelog: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.conraid_repo_mirror[0]
if self.repos.conraid_repo_local[0].startswith('file'):
@ -1061,8 +1061,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_packages)
path_checksums: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_checksums)
path_changelog: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slackonly_repo_mirror[0]
if self.repos.slackonly_repo_local[0].startswith('file'):
@ -1158,8 +1158,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_packages)
path_checksums: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_checksums)
path_changelog: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.salixos_repo_mirror[0]
if self.repos.salixos_repo_local[0].startswith('file'):
@ -1264,8 +1264,8 @@ class InstallData(Configs):
path_checksums: Path = Path(self.repos.salixos_extra_repo_path, self.repos.salixos_extra_repo_checksums)
path_changelog: Path = Path(self.repos.salixos_extra_repo_path,
self.repos.salixos_extra_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.salixos_extra_repo_mirror[0]
if self.repos.salixos_extra_repo_local[0].startswith('file'):
@ -1370,8 +1370,8 @@ class InstallData(Configs):
path_checksums: Path = Path(self.repos.salixos_patches_repo_path, self.repos.salixos_patches_repo_checksums)
path_changelog: Path = Path(self.repos.salixos_patches_repo_path,
self.repos.salixos_patches_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.salixos_patches_repo_mirror[0]
if self.repos.salixos_patches_repo_local[0].startswith('file'):
@ -1475,8 +1475,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_packages)
path_checksums: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_checksums)
path_changelog: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slackel_repo_mirror[0]
if self.repos.slackel_repo_local[0].startswith('file'):
@ -1580,8 +1580,8 @@ class InstallData(Configs):
path_packages: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_packages)
path_checksums: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_checksums)
path_changelog: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
packages_txt: list = self.utils.read_file(path_packages)
checksums_md5: list = self.utils.read_file(path_checksums)
packages_txt: list = self.utils.read_text_file(path_packages)
checksums_md5: list = self.utils.read_text_file(path_checksums)
mirror: str = self.repos.slint_repo_mirror[0]
if self.repos.slint_repo_local[0].startswith('file'):

View file

@ -207,7 +207,7 @@ class Slackbuilds(Configs):
def patch_slackbuild_tag(self, sbo: str) -> None:
sbo_script: Path = Path(self.build_path, sbo, f'{sbo}.SlackBuild')
if sbo_script.is_file() and self.repo_tag:
lines: list = self.utils.read_file(sbo_script)
lines: list = self.utils.read_text_file(sbo_script)
with open(sbo_script, 'w') as script:
for line in lines:

View file

@ -99,7 +99,7 @@ class Utilities(Configs):
sbo_script = Path(self.repos.repositories[repository]['path'], location, sbo, f'{sbo}.SlackBuild')
if sbo_script.is_file():
lines = self.read_file(sbo_script)
lines = self.read_text_file(sbo_script)
for line in lines:
if line.startswith('BUILD=$'):
@ -130,7 +130,7 @@ class Utilities(Configs):
f'{self.__class__.read_packages_from_file.__name__}')
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20)
def read_file(self, file: Path) -> list:
def read_text_file(self, file: Path) -> list:
""" Reads the text file. """
try:
with open(file, 'r', encoding='utf-8', errors='replace') as text_file:
@ -138,7 +138,7 @@ class Utilities(Configs):
except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date_time)
logger.exception(f'{self.__class__.__name__}: '
f'{self.__class__.read_file.__name__}')
f'{self.__class__.read_text_file.__name__}')
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20)
def process(self, command: str, stderr=None, stdout=None) -> None:

View file

@ -35,13 +35,13 @@ class ViewPackage(Configs):
for name, item in data.items():
if sbo == name or sbo == '*':
path: Path = Path(self.repos.repositories[self.repository]['path'],
item['location'], name, 'README')
readme: list = self.utils.read_file(path)
path_file: Path = Path(self.repos.repositories[self.repository]['path'],
item['location'], name, 'README')
readme: list = self.utils.read_text_file(path_file)
path: Path = Path(self.repos.repositories[self.repository]['path'],
item['location'], name, f'{name}.info')
info_file: list = self.utils.read_file(path)
path_info: Path = Path(self.repos.repositories[self.repository]['path'],
item['location'], name, f'{name}.info')
info_file: list = self.utils.read_text_file(path_info)
repo_build_tag: str = self.utils.read_slackbuild_build_tag(
name, item['location'], self.repository)