summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2024-03-13 18:30:53 +0200
committerGitHub <noreply@github.com>2024-03-13 18:30:53 +0200
commit213c9e34bff3ef72ac9fdc83863dd77db8193f0f (patch)
tree2fba2dc8d762ab0da0aa8f9523a4ee5109ccfaf5
parent1639080e893a9fcc735cf2ebfd92cf7ab6f90b70 (diff)
parentf3b585e6447dbb875af96623eb16da0501812e27 (diff)
downloadvyos-build-213c9e34bff3ef72ac9fdc83863dd77db8193f0f.tar.gz
vyos-build-213c9e34bff3ef72ac9fdc83863dd77db8193f0f.zip
Merge pull request #531 from dmbaturin/T6119-tomli-sagitta
docker, build: T6119: use python3-tomli instead of python3-toml
-rw-r--r--docker/Dockerfile1
-rwxr-xr-xscripts/build-vyos-image20
-rwxr-xr-xscripts/check-qemu-install6
3 files changed, 14 insertions, 13 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index b6006400..325241d7 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -101,6 +101,7 @@ RUN apt-get update && apt-get install -y \
python3-pip \
python3-flake8 \
python3-autopep8 \
+ python3-tomli \
yq \
debootstrap \
live-build
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image
index 389f54a4..6bfe3faa 100755
--- a/scripts/build-vyos-image
+++ b/scripts/build-vyos-image
@@ -32,12 +32,12 @@ import functools
import json
try:
- import toml
+ import tomli
import jinja2
import git
except ModuleNotFoundError as e:
print(f"Cannot load a required library: {e}")
- print("Please make sure the following Python3 modules are installed: toml jinja2 git")
+ print("Please make sure the following Python3 modules are installed: tomli jinja2 git")
import vyos_build_utils as utils
import vyos_build_defaults as defaults
@@ -120,8 +120,8 @@ if __name__ == "__main__":
## Load the file with default build configuration options
try:
- with open(defaults.DEFAULTS_FILE, 'r') as f:
- build_defaults = toml.load(f)
+ with open(defaults.DEFAULTS_FILE, 'rb') as f:
+ build_defaults = tomli.load(f)
except Exception as e:
print("Failed to open the defaults file {0}: {1}".format(defaults.DEFAULTS_FILE, e))
sys.exit(1)
@@ -213,16 +213,16 @@ if __name__ == "__main__":
build_config = merge_dicts(args, build_defaults)
## Load the flavor file and mix-ins
- with open(make_toml_path(defaults.BUILD_TYPES_DIR, build_config["build_type"]), 'r') as f:
- build_type_config = toml.load(f)
+ with open(make_toml_path(defaults.BUILD_TYPES_DIR, build_config["build_type"]), 'rb') as f:
+ build_type_config = tomli.load(f)
build_config = merge_dicts(build_type_config, build_config)
- with open(make_toml_path(defaults.BUILD_ARCHES_DIR, build_config["architecture"]), 'r') as f:
- build_arch_config = toml.load(f)
+ with open(make_toml_path(defaults.BUILD_ARCHES_DIR, build_config["architecture"]), 'rb') as f:
+ build_arch_config = tomli.load(f)
build_config = merge_dicts(build_arch_config, build_config)
- with open(make_toml_path(defaults.BUILD_FLAVORS_DIR, build_config["build_flavor"]), 'r') as f:
- flavor_config = toml.load(f)
+ with open(make_toml_path(defaults.BUILD_FLAVORS_DIR, build_config["build_flavor"]), 'rb') as f:
+ flavor_config = tomli.load(f)
build_config = merge_dicts(flavor_config, build_config)
## Rename and merge some fields for simplicity
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install
index aa729c6d..086eeab2 100755
--- a/scripts/check-qemu-install
+++ b/scripts/check-qemu-install
@@ -42,7 +42,7 @@ import random
import traceback
import logging
import re
-import toml
+import tomli
from io import BytesIO
from io import StringIO
@@ -78,8 +78,8 @@ parser.add_argument('--qemu-cmd', help='Only generate QEMU launch command',
args = parser.parse_args()
-with open('data/defaults.toml') as f:
- vyos_defaults = toml.load(f)
+with open('data/defaults.toml', 'rb') as f:
+ vyos_defaults = tomli.load(f)
class StreamToLogger(object):
"""