Skip to content

Commit 4015245

Browse files
committed
Replace pkg_resources with packaging
setuptools 82.0.0 removed pkg_resources, breaking the build. Use packaging.requirements.Requirement instead, and switch the Cython dependency string to PEP 508 format (no parentheses).
1 parent 7b5ce07 commit 4015245

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ docs = [
6262
[build-system]
6363
requires = [
6464
"setuptools>=77.0.3",
65-
"Cython(>=3.2.1,<4.0.0)"
65+
"Cython>=3.2.1,<4.0.0"
6666
]
6767
build-backend = "setuptools.build_meta"
6868

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from setuptools.command import build_ext as setuptools_build_ext
2626

2727

28-
CYTHON_DEPENDENCY = 'Cython(>=3.2.1,<4.0.0)'
28+
CYTHON_DEPENDENCY = 'Cython>=3.2.1,<4.0.0'
2929

3030
CFLAGS = ['-O2']
3131
LDFLAGS = []
@@ -186,7 +186,8 @@ def finalize_options(self):
186186
need_cythonize = True
187187

188188
if need_cythonize:
189-
import pkg_resources
189+
# 'packaging' gets installed by 'wheel'
190+
from packaging.requirements import Requirement
190191

191192
# Double check Cython presence in case setup_requires
192193
# didn't go into effect (most likely because someone
@@ -199,8 +200,8 @@ def finalize_options(self):
199200
'please install {} to compile asyncpg from source'.format(
200201
CYTHON_DEPENDENCY))
201202

202-
cython_dep = pkg_resources.Requirement.parse(CYTHON_DEPENDENCY)
203-
if Cython.__version__ not in cython_dep:
203+
cython_dep = Requirement(CYTHON_DEPENDENCY)
204+
if Cython.__version__ not in cython_dep.specifier:
204205
raise RuntimeError(
205206
'asyncpg requires {}, got Cython=={}'.format(
206207
CYTHON_DEPENDENCY, Cython.__version__

0 commit comments

Comments
 (0)