Skip to content

Commit 99ab56d

Browse files
committed
build: use packaging.version.Version
This avoids a deprecation warning on the distutils class.
1 parent 4a1dc25 commit 99ab56d

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

setup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@
1111
import platform
1212
import sys
1313

14+
from packaging.version import Version
1415
from setuptools import setup
1516

16-
# Python 3.12 dropped distutils from the stdlib. Try to access it via
17-
# setuptools.
18-
try:
19-
from setuptools._distutils.version import LooseVersion
20-
except ImportError:
21-
from distutils.version import LooseVersion
22-
2317
if sys.version_info[0:2] < (3, 9):
2418
print("Python 3.9+ is required", file=sys.stderr)
2519
sys.exit(1)
@@ -59,8 +53,8 @@
5953

6054
# PyPy (and possibly other distros) have CFFI distributed as part of
6155
# them.
62-
cffi_version = LooseVersion(cffi.__version__)
63-
if cffi_version < LooseVersion(MINIMUM_CFFI_VERSION):
56+
cffi_version = Version(cffi.__version__)
57+
if cffi_version < Version(MINIMUM_CFFI_VERSION):
6458
print(
6559
"CFFI %s or newer required (%s found); "
6660
"not building CFFI backend" % (MINIMUM_CFFI_VERSION, cffi_version),

0 commit comments

Comments
 (0)