ci: update toml dependency
Switch from toml to tomllib when supported, Python 3.11+, and fallback to
using tomli instead of toml otherwise.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/ci/get_features.py b/ci/get_features.py
index 3220dc3..50da557 100755
--- a/ci/get_features.py
+++ b/ci/get_features.py
@@ -16,7 +16,10 @@
import argparse
import os.path
-import toml
+try:
+ import tomllib
+except ModuleNotFoundError:
+ import tomli as tomllib
parser = argparse.ArgumentParser(description='Print features from a Cargo.toml.')
parser.add_argument('infile', help='Input file to parse')
@@ -32,7 +35,7 @@
print("Error reading \"{}\"".format(args.infile))
exit(1)
-config = toml.loads(cargo_toml)
+config = tomllib.loads(cargo_toml)
if 'features' not in config:
print("Missing \"[features]\" section")
exit(1)
diff --git a/ci/requirements.txt b/ci/requirements.txt
index bd79a65..aab392a 100644
--- a/ci/requirements.txt
+++ b/ci/requirements.txt
@@ -1 +1 @@
-toml
+tomli