chore: use tomllib on Python 3.11 (#1047)
* Use tomllib on Python 3.11 * delint Co-authored-by: hauntsaninja <>
This commit is contained in:
co-authored by
hauntsaninja <>
parent
9ae6ae2756
commit
6d4431306e
@@ -1,6 +1,11 @@
|
||||
import sys
|
||||
from typing import Dict, List
|
||||
|
||||
import tomli
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
else:
|
||||
import tomli as tomllib
|
||||
|
||||
from packaging.version import Version
|
||||
|
||||
from cibuildwheel.extra import Printable, dump_python_configurations
|
||||
@@ -12,7 +17,7 @@ def test_compare_configs():
|
||||
txt = f1.read()
|
||||
|
||||
with open(resources_dir / "build-platforms.toml", "rb") as f2:
|
||||
dict_txt = tomli.load(f2)
|
||||
dict_txt = tomllib.load(f2)
|
||||
|
||||
new_txt = dump_python_configurations(dict_txt)
|
||||
print(new_txt)
|
||||
|
||||
@@ -3,7 +3,11 @@ from fnmatch import fnmatch
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import tomli
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
else:
|
||||
import tomli as tomllib
|
||||
|
||||
from cibuildwheel.__main__ import main
|
||||
from cibuildwheel.environment import ParsedEnvironment
|
||||
@@ -314,7 +318,7 @@ def test_defaults(platform, intercepted_build_args):
|
||||
build_options: BuildOptions = intercepted_build_args.args[0].build_options(identifier=None)
|
||||
defaults_config_path = resources_dir / "defaults.toml"
|
||||
with defaults_config_path.open("rb") as f:
|
||||
defaults_toml = tomli.load(f)
|
||||
defaults_toml = tomllib.load(f)
|
||||
|
||||
root_defaults = defaults_toml["tool"]["cibuildwheel"]
|
||||
platform_defaults = defaults_toml["tool"]["cibuildwheel"][platform]
|
||||
|
||||
Reference in New Issue
Block a user