From a215c1847450b54079d2b7b0673a707eb7f9416b Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 28 Feb 2023 23:23:57 +0200 Subject: [PATCH] Updated for ponce --- configs/slpkg.toml | 2 +- slpkg/configs.py | 4 ++-- slpkg/form_configs.py | 15 ++++++++------- slpkg/slackbuild.py | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 559892ad..b14382e1 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -86,7 +86,7 @@ # include in the ponce repository. # ######################################################################### PONCE_REPO = false - PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain" + PONCE_URL = "https://cgit.ponce.cc/slackbuilds/plain" SLACK_CURRENT_MIRROR = "https://mirrors.slackware.com/slackware/slackware64-current" SLACK_CHGLOG_TXT = "ChangeLog.txt" SLACK_CHGLOG_PATH = "/var/lib/slpkg/repository/slack_current" \ No newline at end of file diff --git a/slpkg/configs.py b/slpkg/configs.py index ab3f7be5..25910325 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -56,7 +56,7 @@ class Configs: # Ponce repo configs. ponce_repo: bool = False - ponce_repo_url: str = 'https://cgit.ponce.cc/slackbuilds/plain' + ponce_url: str = 'https://cgit.ponce.cc/slackbuilds/plain' slack_current_mirror: str = 'https://mirrors.slackware.com/slackware/slackware64-current' slack_chglog_txt: str = 'ChangeLog.txt' slack_chglog_path: str = Path('/var/lib/slpkg/repository/slack_current') @@ -116,7 +116,7 @@ class Configs: # Ponce repo configs. ponce_repo: bool = config['PONCE_REPO'] - ponce_repo_url: str = config['PONCE_REPO_URL'] + ponce_url: str = config['PONCE_URL'] slack_current_mirror: str = config['SLACK_CURRENT_MIRROR'] slack_chglog_txt: str = config['SLACK_CHGLOG_TXT'] slack_chglog_path: str = config['SLACK_CHGLOG_PATH'] diff --git a/slpkg/form_configs.py b/slpkg/form_configs.py index 25d44b4a..d2f27600 100644 --- a/slpkg/form_configs.py +++ b/slpkg/form_configs.py @@ -12,6 +12,7 @@ from slpkg.dialog_box import DialogBox class FormConfigs(Configs): def __init__(self): + super(Configs).__init__() self.orig_configs = None self.load_configs = LoadConfigs() self.dialogbox = DialogBox() @@ -27,7 +28,7 @@ class FormConfigs(Configs): configs = self.load_configs.file(self.etc_path, self.prog_name) # Creating the elements for the dialog form. - for i, (key, value) in enumerate(configs['configs'].items(), start=1): + for i, (key, value) in enumerate(configs['CONFIGS'].items(), start=1): if value is True: value = 'true' elif value is False: @@ -36,7 +37,7 @@ class FormConfigs(Configs): (key, i, 1, value, i, 17, 47, 200, '0x0') ] - height = 28 + height = 35 width = 70 text = f'Edit the configuration file: {config_file}' title = ' Configuration File ' @@ -62,13 +63,13 @@ class FormConfigs(Configs): def check_configs(self, configs: dict, tags: list) -> bool: """ Check for true of false values. """ - for key, value in zip(configs['configs'].keys(), tags): + for key, value in zip(configs['CONFIGS'].keys(), tags): - if key in ['colors', 'dialog', 'silent_mode', 'ascii_characters'] and value not in ['true', 'false']: + if key in ['COLORS', 'DIALOG', 'SILENT_MODE', 'ASCII_CHARACTERS', 'PONCE_REPO'] and value not in ['true', 'false']: self.dialogbox.msgbox(f"\nError value for {key}. It must be 'true' or 'false'\n", height=7, width=60) return False - if key in ['downloader'] and value not in ['wget', 'curl']: + if key in ['DOWNLOADER'] and value not in ['wget', 'curl']: self.dialogbox.msgbox(f"\nError value for {key}. It must be 'wget' or 'curl'\n", height=7, width=60) return False @@ -84,9 +85,9 @@ class FormConfigs(Configs): self.read_configs() with open(self.config_file, 'w') as patch_toml: for line in self.orig_configs: - for key, value in zip(configs['configs'].keys(), tags): + for key, value in zip(configs['CONFIGS'].keys(), tags): if line.lstrip().startswith(key): line = f' {key} = "{value}"\n' - if line.lstrip().startswith(('colors =', 'dialog =', 'silent_mode =', 'ascii_characters =')): + if line.lstrip().startswith(('COLORS =', 'DIALOG =', 'SILENT_MODE =', 'ASCII_CHARACTERS =', 'PONCE_REPO =')): line = line.replace('"', '') patch_toml.write(line) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 4f0b57f6..4d71a9ea 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -139,9 +139,9 @@ class Slackbuilds(Configs): location = SBoQueries(sbo).location() sbo_url = f'{self.sbo_repo_url}/{location}/{file}' - ponce_url = f'{self.ponce_repo_url}/{location}/{sbo}' + ponce_url = f'{self.ponce_url}/{location}/{sbo}' - if self.ponce_repo and self.ponce_repo_url: + if self.ponce_repo and self.ponce_url: path = Path(self.build_path, sbo) lftp = Downloader(path, ponce_url, self.flags) lftp.download()