Skip to content

Commit a517bb4

Browse files
eli-schwartzdvarrazzo
authored andcommitted
build: avoid installing tomli on recent python
It is in the stdlib. No need to have wheel building require downloading yet another build dependency.
1 parent a063606 commit a517bb4

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎psycopg_c/build_backend/cython_backend.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010
from __future__ import annotations
1111

1212
import os
13+
import sys
1314
from typing import Any
1415

15-
import tomli
1616
from setuptools import build_meta
1717

18+
if sys.version_info >= (3, 11):
19+
import tomllib
20+
else:
21+
import tomli as tomllib
22+
1823

1924
def get_requires_for_build_wheel(config_settings: Any = None) -> list[str]:
2025
if not os.path.exists("psycopg_c/_psycopg.pyx"):
@@ -26,7 +31,7 @@ def get_requires_for_build_wheel(config_settings: Any = None) -> list[str]:
2631
# to build. Get the version from the pyproject itself to keep things in the
2732
# same place.
2833
with open("pyproject.toml", "rb") as f:
29-
pyprj = tomli.load(f)
34+
pyprj = tomllib.load(f)
3035

3136
rv: list[str] = pyprj["cython-backend"]["cython-requires"]
3237
return rv

‎psycopg_c/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools >= 49.2.0", "wheel >= 0.37", "tomli >= 2.0.1"]
2+
requires = ["setuptools >= 49.2.0", "wheel >= 0.37", "tomli >= 2.0.1 ; python_version<'3.11'"]
33

44
# The cython_backend is a build backend adding a Cython dependency if the c
55
# source must be build from pxd files (when building from git checkout), and

0 commit comments

Comments
 (0)