From 7e8124989d6c679eab797b6ae0adde68ad2ea3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 25 Aug 2022 14:40:11 +0200 Subject: [PATCH] Use tomllib/python-tomli instead of dead upstream python-toml --- check-null-licenses | 9 ++++++--- llhttp.spec | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/check-null-licenses b/check-null-licenses index db2e0d3..bf3d7d4 100755 --- a/check-null-licenses +++ b/check-null-licenses @@ -6,7 +6,10 @@ from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter from pathlib import Path from sys import exit, stderr -import toml +try: + import tomllib +except ImportError: + import tomli as tomllib def main(): @@ -124,7 +127,7 @@ considered an error, and the program returns with nonzero status. parser.add_argument( "-x", "--exceptions", - type=FileType("r"), + type=FileType("rb"), help="Manually audited package versions file", ) parser.add_argument( @@ -149,7 +152,7 @@ considered an error, and the program returns with nonzero status. else: with args.exceptions as xfile: xname = getattr(xfile, "name", "") - args.exceptions = toml.load(args.exceptions) + args.exceptions = tomllib.load(args.exceptions) if not isinstance(args.exceptions, dict): parser.error(f"Invalid format in {xname}: not an object") for tablename, table in args.exceptions.items(): diff --git a/llhttp.spec b/llhttp.spec index 17950fc..0aeb872 100644 --- a/llhttp.spec +++ b/llhttp.spec @@ -71,7 +71,7 @@ BuildRequires: gcc-c++ # For check-null-licenses BuildRequires: python3-devel -BuildRequires: python3dist(toml) +BuildRequires: (python3dist(tomli) if python3 < 3.11) %description This project is a port of http_parser to TypeScript. llparse is used to