Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/
Date: Sun, 30 Jan 2022 23:07:29
Message-Id: 1643584020.91cedd2f94909500a97a9a70ee262170b222b668.mattst88@gentoo
1 commit: 91cedd2f94909500a97a9a70ee262170b222b668
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 30 20:22:43 2022 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 30 23:07:00 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=91cedd2f
7
8 catalyst: Switch to tomli
9
10 The Python community is coalescing around tomli, and tomli is likely to
11 be integrated into the standard library per PEP680.
12
13 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
14
15 catalyst/base/stagebase.py | 4 ++--
16 catalyst/main.py | 5 +++--
17 doc/make_subarch_table_guidexml.py | 5 +++--
18 3 files changed, 8 insertions(+), 6 deletions(-)
19
20 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
21 index 4a1b4eb6..ad96beb7 100644
22 --- a/catalyst/base/stagebase.py
23 +++ b/catalyst/base/stagebase.py
24 @@ -10,7 +10,7 @@ from pathlib import Path
25
26 import fasteners
27 import libmount
28 -import toml
29 +import tomli
30
31 from snakeoil import fileutils
32 from snakeoil.osutils import pjoin
33 @@ -124,7 +124,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
34 name = x[:-len('.toml')]
35
36 with open(arch_dir + x) as file:
37 - arch_config = toml.load(file)
38 + arch_config = tomli.load(file)
39
40 # Search for a subarchitecture in each arch in the arch_config
41 for arch in [x for x in arch_config if x.startswith(name) and host in arch_config[x]]:
42
43 diff --git a/catalyst/main.py b/catalyst/main.py
44 index 0de1040f..e51be9d1 100644
45 --- a/catalyst/main.py
46 +++ b/catalyst/main.py
47 @@ -6,7 +6,7 @@ import os
48 import sys
49 import textwrap
50
51 -import toml
52 +import tomli
53
54 from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
55 CONTENTS_DEFINITIONS)
56 @@ -35,7 +35,8 @@ def parse_config(config_files):
57 for config_file in config_files:
58 log.notice('Loading configuration file: %s', config_file)
59 try:
60 - config = toml.load(config_file)
61 + with open(config_file) as f:
62 + config = tomli.load(f)
63 for key in config:
64 if key not in valid_config_file_values:
65 log.critical("Unknown option '%s' in config file %s",
66
67 diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py
68 index 67ed3ccc..3c03f90c 100755
69 --- a/doc/make_subarch_table_guidexml.py
70 +++ b/doc/make_subarch_table_guidexml.py
71 @@ -5,7 +5,7 @@
72 import pathlib
73 import sys
74 import textwrap
75 -import toml
76 +import tomli
77
78
79 def write_guidexml(arch_to_subarch):
80 @@ -40,7 +40,8 @@ def main(_argv):
81 p = pathlib.Path('arch')
82
83 for file in p.glob('*.toml'):
84 - data = toml.load(file)
85 + with file.open('rb') as f:
86 + data = tomli.load(f)
87
88 for arch in [x for x in data if x != 'setarch']:
89 arch_to_subarch.update({arch: list(data[arch].keys())})