Use tomllib/python-tomli instead of dead upstream python-toml
This commit is contained in:
parent
b838f310fc
commit
7e8124989d
@ -6,7 +6,10 @@ from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from sys import exit, stderr
|
from sys import exit, stderr
|
||||||
|
|
||||||
import toml
|
try:
|
||||||
|
import tomllib
|
||||||
|
except ImportError:
|
||||||
|
import tomli as tomllib
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -124,7 +127,7 @@ considered an error, and the program returns with nonzero status.
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-x",
|
"-x",
|
||||||
"--exceptions",
|
"--exceptions",
|
||||||
type=FileType("r"),
|
type=FileType("rb"),
|
||||||
help="Manually audited package versions file",
|
help="Manually audited package versions file",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -149,7 +152,7 @@ considered an error, and the program returns with nonzero status.
|
|||||||
else:
|
else:
|
||||||
with args.exceptions as xfile:
|
with args.exceptions as xfile:
|
||||||
xname = getattr(xfile, "name", "<exceptions>")
|
xname = getattr(xfile, "name", "<exceptions>")
|
||||||
args.exceptions = toml.load(args.exceptions)
|
args.exceptions = tomllib.load(args.exceptions)
|
||||||
if not isinstance(args.exceptions, dict):
|
if not isinstance(args.exceptions, dict):
|
||||||
parser.error(f"Invalid format in {xname}: not an object")
|
parser.error(f"Invalid format in {xname}: not an object")
|
||||||
for tablename, table in args.exceptions.items():
|
for tablename, table in args.exceptions.items():
|
||||||
|
@ -71,7 +71,7 @@ BuildRequires: gcc-c++
|
|||||||
|
|
||||||
# For check-null-licenses
|
# For check-null-licenses
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: python3dist(toml)
|
BuildRequires: (python3dist(tomli) if python3 < 3.11)
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This project is a port of http_parser to TypeScript. llparse is used to
|
This project is a port of http_parser to TypeScript. llparse is used to
|
||||||
|
Loading…
Reference in New Issue
Block a user