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/, doc/, catalyst/base/
Date: Sun, 30 Jan 2022 23:03:35
Message-Id: 1643583805.0b709ccc9136996e110d2299cddd1ee9b06e5fca.mattst88@gentoo
1 commit: 0b709ccc9136996e110d2299cddd1ee9b06e5fca
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:03:25 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=0b709ccc
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 | 4 ++--
17 doc/make_subarch_table_guidexml.py | 4 ++--
18 3 files changed, 6 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..fa668770 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,7 @@ 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 + config = tomli.load(config_file)
62 for key in config:
63 if key not in valid_config_file_values:
64 log.critical("Unknown option '%s' in config file %s",
65
66 diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py
67 index 67ed3ccc..54aa4307 100755
68 --- a/doc/make_subarch_table_guidexml.py
69 +++ b/doc/make_subarch_table_guidexml.py
70 @@ -5,7 +5,7 @@
71 import pathlib
72 import sys
73 import textwrap
74 -import toml
75 +import tomli
76
77
78 def write_guidexml(arch_to_subarch):
79 @@ -40,7 +40,7 @@ def main(_argv):
80 p = pathlib.Path('arch')
81
82 for file in p.glob('*.toml'):
83 - data = toml.load(file)
84 + data = tomli.load(file.open())
85
86 for arch in [x for x in data if x != 'setarch']:
87 arch_to_subarch.update({arch: list(data[arch].keys())})