From: Eli Schwartz Date: Wed, 26 Jun 2024 03:22:17 +0000 (-0400) Subject: build: avoid installing tomli on recent python X-Git-Tag: 3.1.20~2^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28938d576c3de9a90494aa06a5a39ce2b00119a2;p=thirdparty%2Fpsycopg.git build: avoid installing tomli on recent python It is in the stdlib. No need to have wheel building require downloading yet another build dependency. --- diff --git a/psycopg_c/build_backend/cython_backend.py b/psycopg_c/build_backend/cython_backend.py index 97bd2af88..267707c7c 100644 --- a/psycopg_c/build_backend/cython_backend.py +++ b/psycopg_c/build_backend/cython_backend.py @@ -8,11 +8,16 @@ otherwise it only relies on the c files to have been precompiled. # Copyright (C) 2023 The Psycopg Team import os +import sys from typing import Any, List -import tomli from setuptools import build_meta +if sys.version_info >= (3, 11): + import tomllib +else: + import tomli as tomllib + def get_requires_for_build_wheel(config_settings: Any = None) -> List[str]: if not os.path.exists("psycopg_c/_psycopg.pyx"): @@ -24,7 +29,7 @@ def get_requires_for_build_wheel(config_settings: Any = None) -> List[str]: # to build. Get the version from the pyproject itself to keep things in the # same place. with open("pyproject.toml", "rb") as f: - pyprj = tomli.load(f) + pyprj = tomllib.load(f) rv: List[str] = pyprj["cython-backend"]["cython-requires"] return rv diff --git a/psycopg_c/pyproject.toml b/psycopg_c/pyproject.toml index 831e030df..1b27b44d5 100644 --- a/psycopg_c/pyproject.toml +++ b/psycopg_c/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 49.2.0", "wheel >= 0.37", "tomli >= 2.0.1"] +requires = ["setuptools >= 49.2.0", "wheel >= 0.37", "tomli >= 2.0.1 ; python_version<'3.11'"] # The cython_backend is a build backend adding a Cython dependency if the c # source must be build from pxd files (when building from git checkout), and