diff options
author | Matt Turner <mattst88@gentoo.org> | 2022-01-30 12:22:43 -0800 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2022-01-30 15:17:14 -0800 |
commit | 67e93e47d30280594c109b8153a83f0a19c027e5 (patch) | |
tree | 7a8cc1722b4a09002753fbafc80c5c47ccf21e36 /catalyst | |
parent | catalyst: generate .sha256 file if any digest is enabled (diff) | |
download | catalyst-67e93e47d30280594c109b8153a83f0a19c027e5.tar.gz catalyst-67e93e47d30280594c109b8153a83f0a19c027e5.tar.bz2 catalyst-67e93e47d30280594c109b8153a83f0a19c027e5.zip |
catalyst: Switch to tomli
The Python community is coalescing around tomli, and tomli is likely to
be integrated into the standard library per PEP680.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
Diffstat (limited to 'catalyst')
-rw-r--r-- | catalyst/base/stagebase.py | 6 | ||||
-rw-r--r-- | catalyst/main.py | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 4a1b4eb6..de1e30ef 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -10,7 +10,7 @@ from pathlib import Path import fasteners import libmount -import toml +import tomli from snakeoil import fileutils from snakeoil.osutils import pjoin @@ -123,8 +123,8 @@ class StageBase(TargetBase, ClearBase, GenBase): log.debug("\tTrying %s", x) name = x[:-len('.toml')] - with open(arch_dir + x) as file: - arch_config = toml.load(file) + with open(arch_dir + x, 'rb') as file: + arch_config = tomli.load(file) # Search for a subarchitecture in each arch in the arch_config for arch in [x for x in arch_config if x.startswith(name) and host in arch_config[x]]: diff --git a/catalyst/main.py b/catalyst/main.py index 0de1040f..6e9a2d3e 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -6,7 +6,7 @@ import os import sys import textwrap -import toml +import tomli from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, CONTENTS_DEFINITIONS) @@ -35,7 +35,8 @@ def parse_config(config_files): for config_file in config_files: log.notice('Loading configuration file: %s', config_file) try: - config = toml.load(config_file) + with open(config_file, 'rb') as f: + config = tomli.load(f) for key in config: if key not in valid_config_file_values: log.critical("Unknown option '%s' in config file %s", |