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>
This commit is contained in:
Fabio Utzig 2023-04-27 11:08:28 -03:00 committed by Fabio Utzig
parent 0a1ef37263
commit 86dba4d6c1
2 changed files with 6 additions and 3 deletions

View File

@ -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 @@ except Exception:
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)

View File

@ -1 +1 @@
toml
tomli