From 8046b980276a62997eceadd648786a9fc71e0d7f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 13 Apr 2024 13:05:59 +0300 Subject: [PATCH] Updated for lower and upper --- ChangeLog.txt | 4 ++++ slpkg/repositories.py | 4 ++++ slpkg/utilities.py | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1c271761..041a2ead 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,9 @@ ## slpkg - ChangeLog +### 5.0.6 - 13/04/2024 +- Update: + * Updated to read repositories.toml values file even they are lower or uppercase + ### 5.0.5 - 12/04/2024 - Added: * Added maximum parallel for downloading in the config file diff --git a/slpkg/repositories.py b/slpkg/repositories.py index bfc2435f..22583357 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -11,12 +11,14 @@ from pathlib import Path from dataclasses import dataclass from slpkg.configs import Configs +from slpkg.utilities import Utilities from slpkg.toml_errors import TomlErrors @dataclass class Repositories: toml_errors = TomlErrors() + utils = Utilities() repositories_toml_file: Path = Path(Configs.etc_path, 'repositories.toml') repositories_path: Path = Path(Configs.lib_path, 'repos') @@ -221,6 +223,8 @@ class Repositories: with open(repositories_toml_file, 'rb') as repo: repos_config = tomli.load(repo) + repos_config = utils.convert_dict_keys_to_upper(repos_config) + default_repository: str = repos_config['DEFAULT']['REPO'].lower() sbo_repo: bool = repos_config['SBO']['ENABLE'] diff --git a/slpkg/utilities.py b/slpkg/utilities.py index b555e426..8bc19c68 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -221,3 +221,12 @@ class Utilities(Configs): pattern: str = '|'.join(blacklist) matching_packages: list = [pkg for pkg in packages if re.search(pattern, pkg)] return matching_packages + + def convert_dict_keys_to_upper(self, d): + new_dict = {} + for key, value in d.items(): + if isinstance(value, dict): + value = self.convert_dict_keys_to_upper(value) + new_dict[key.upper()] = value + return new_dict +