Updated for lower and upper

This commit is contained in:
Dimitris Zlatanidis 2024-04-13 13:05:59 +03:00
parent 58f907e919
commit 8046b98027
3 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -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']

View file

@ -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