[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, doc/, catalyst/base/

2022-01-30 Thread Matt Turner
commit: 67e93e47d30280594c109b8153a83f0a19c027e5
Author: Matt Turner  gentoo  org>
AuthorDate: Sun Jan 30 20:22:43 2022 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sun Jan 30 23:17:14 2022 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=67e93e47

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  gentoo.org>

 catalyst/base/stagebase.py | 6 +++---
 catalyst/main.py   | 5 +++--
 doc/make_subarch_table_guidexml.py | 5 +++--
 3 files changed, 9 insertions(+), 7 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",

diff --git a/doc/make_subarch_table_guidexml.py 
b/doc/make_subarch_table_guidexml.py
index 67ed3ccc..3c03f90c 100755
--- a/doc/make_subarch_table_guidexml.py
+++ b/doc/make_subarch_table_guidexml.py
@@ -5,7 +5,7 @@
 import pathlib
 import sys
 import textwrap
-import toml
+import tomli
 
 
 def write_guidexml(arch_to_subarch):
@@ -40,7 +40,8 @@ def main(_argv):
 p = pathlib.Path('arch')
 
 for file in p.glob('*.toml'):
-data = toml.load(file)
+with file.open('rb') as f:
+data = tomli.load(f)
 
 for arch in [x for x in data if x != 'setarch']:
 arch_to_subarch.update({arch: list(data[arch].keys())})



[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, doc/, catalyst/base/

2022-01-30 Thread Matt Turner
commit: 0b709ccc9136996e110d2299cddd1ee9b06e5fca
Author: Matt Turner  gentoo  org>
AuthorDate: Sun Jan 30 20:22:43 2022 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sun Jan 30 23:03:25 2022 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=0b709ccc

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  gentoo.org>

 catalyst/base/stagebase.py | 4 ++--
 catalyst/main.py   | 4 ++--
 doc/make_subarch_table_guidexml.py | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 4a1b4eb6..ad96beb7 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
@@ -124,7 +124,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 name = x[:-len('.toml')]
 
 with open(arch_dir + x) as file:
-arch_config = toml.load(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..fa668770 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,7 @@ 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)
+config = tomli.load(config_file)
 for key in config:
 if key not in valid_config_file_values:
 log.critical("Unknown option '%s' in config file %s",

diff --git a/doc/make_subarch_table_guidexml.py 
b/doc/make_subarch_table_guidexml.py
index 67ed3ccc..54aa4307 100755
--- a/doc/make_subarch_table_guidexml.py
+++ b/doc/make_subarch_table_guidexml.py
@@ -5,7 +5,7 @@
 import pathlib
 import sys
 import textwrap
-import toml
+import tomli
 
 
 def write_guidexml(arch_to_subarch):
@@ -40,7 +40,7 @@ def main(_argv):
 p = pathlib.Path('arch')
 
 for file in p.glob('*.toml'):
-data = toml.load(file)
+data = tomli.load(file.open())
 
 for arch in [x for x in data if x != 'setarch']:
 arch_to_subarch.update({arch: list(data[arch].keys())})



[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, doc/

2020-05-19 Thread Matt Turner
commit: 5b3e7b3b13bad7bb602c7e01eb8403821a286d46
Author: Matt Turner  gentoo  org>
AuthorDate: Mon May 18 22:38:51 2020 +
Commit: Matt Turner  gentoo  org>
CommitDate: Wed May 20 01:49:37 2020 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5b3e7b3b

catalyst: Drop --cli option

This confusingly named option allowed you to specify and entire spec
file on the command line. It seems that the addition of the --snapshot /
-s option in commit ac746eff5363 (new -s option for creating snapshots)
in 2004 removed all known uses, so let's remove it.

Signed-off-by: Matt Turner  gentoo.org>

 catalyst/main.py   |  5 +
 doc/catalyst.1.txt | 10 --
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/catalyst/main.py b/catalyst/main.py
index 4ca1aa5b..bad712fa 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -202,9 +202,6 @@ def get_parser():
help='read specfile')
 group.add_argument('-s', '--snapshot', type=str,
help='Make an ebuild repo snapshot')
-group.add_argument('-C', '--cli',
-   default=[], nargs=argparse.REMAINDER,
-   help='catalyst commandline (MUST BE LAST OPTION)')
 
 return parser
 
@@ -294,8 +291,8 @@ def _main(parser, opts):
 if not myconfigs:
 myconfigs = [DEFAULT_CONFIG_FILE]
 myspecfile = opts.file
-mycmdline = opts.cli[:]
 
+mycmdline = list()
 if opts.snapshot:
 mycmdline.append('target=snapshot')
 mycmdline.append('snapshot_treeish=' + opts.snapshot)

diff --git a/doc/catalyst.1.txt b/doc/catalyst.1.txt
index 46e21e63..90d5a24b 100644
--- a/doc/catalyst.1.txt
+++ b/doc/catalyst.1.txt
@@ -31,11 +31,6 @@ OPTIONS
 This option is to be used to clear any autoresume points that have been saved
 for this target. It is used in conjunction with *-f*, *-C*, or both.
 
-*--cli*|*-C* 'KEY'='VALUE' ...::
-This option is to be used in place of a specfile. All options are passed
-to *catalyst* on the commandline. Please note that this option must
-be the last option passed to *catalyst* for everything to work correctly.
-
 *--config*|*-c* 'FILE'::
 Tell *catalyst* to use a user-defined configuration file. A sample
 configuration file is installed at '/etc/catalyst/catalyst.conf'.
@@ -75,11 +70,6 @@ Print the version information and exit
 
 EXAMPLES
 
-Using the commandline option (*-C*, *--cli*) to build a Portage snapshot:

-# catalyst -C target=snapshot version_stamp=my_date

-
 Using the specfile option (*-f*, *--file*) to build a stage target:
 ---
 # catalyst -f stage1-specfile.spec