Skip to content

Commit 1640d6e

Browse files
committed
fix: use packaging instead of relying on pkg_resources
1 parent a308f75 commit 1640d6e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ test = [
4545
'mypy>=0.800',
4646
]
4747
dev = [
48+
'packaging>=20',
4849
'setuptools>=60',
49-
'Cython~=3.0',
50+
'Cython~=3.1',
5051
]
5152
docs = [
5253
'Sphinx~=4.1.2',
@@ -56,6 +57,7 @@ docs = [
5657

5758
[build-system]
5859
requires = [
60+
"packaging>=20",
5961
"setuptools>=60",
6062
"wheel",
6163
"Cython~=3.1",

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from setuptools.command.sdist import sdist
2222

2323

24-
CYTHON_DEPENDENCY = 'Cython~=3.0'
24+
CYTHON_DEPENDENCY = 'Cython~=3.1'
2525
MACHINE = platform.machine()
2626
MODULES_CFLAGS = [os.getenv('UVLOOP_OPT_CFLAGS', '-O2')]
2727
_ROOT = pathlib.Path(__file__).parent
@@ -108,7 +108,7 @@ def finalize_options(self):
108108
need_cythonize = True
109109

110110
if need_cythonize:
111-
import pkg_resources
111+
from packaging.requirements import Requirement
112112

113113
# Double check Cython presence in case setup_requires
114114
# didn't go into effect (most likely because someone
@@ -121,8 +121,8 @@ def finalize_options(self):
121121
'please install {} to compile uvloop from source'.format(
122122
CYTHON_DEPENDENCY))
123123

124-
cython_dep = pkg_resources.Requirement.parse(CYTHON_DEPENDENCY)
125-
if Cython.__version__ not in cython_dep:
124+
cython_dep = Requirement(CYTHON_DEPENDENCY)
125+
if not cython_dep.specifier.contains(Cython.__version__):
126126
raise RuntimeError(
127127
'uvloop requires {}, got Cython=={}'.format(
128128
CYTHON_DEPENDENCY, Cython.__version__

0 commit comments

Comments
 (0)