diff --git a/pyproject.toml b/pyproject.toml index a8b0f322..8cc64886 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ test = [ 'mypy>=0.800', ] dev = [ + 'packaging', 'setuptools>=60', 'Cython~=3.0', ] diff --git a/setup.py b/setup.py index 32d94ae8..7d4bb6c7 100644 --- a/setup.py +++ b/setup.py @@ -108,7 +108,8 @@ def finalize_options(self): need_cythonize = True if need_cythonize: - import pkg_resources + from packaging.requirements import Requirement + from packaging.version import Version # Double check Cython presence in case setup_requires # didn't go into effect (most likely because someone @@ -121,8 +122,8 @@ def finalize_options(self): 'please install {} to compile uvloop from source'.format( CYTHON_DEPENDENCY)) - cython_dep = pkg_resources.Requirement.parse(CYTHON_DEPENDENCY) - if Cython.__version__ not in cython_dep: + cython_dep = Requirement(CYTHON_DEPENDENCY) + if not cython_dep.specifier.contains(Version(Cython.__version__)): raise RuntimeError( 'uvloop requires {}, got Cython=={}'.format( CYTHON_DEPENDENCY, Cython.__version__