Skip to content

Commit 24ffa84

Browse files
committed
build: use packaging.version.Version
This avoids a deprecation warning on the distutils class.
1 parent fc727e5 commit 24ffa84

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

ci/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
cffi
2+
packaging
23
wheel

ci/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ cffi==1.17.1 \
6969
--hash=sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87 \
7070
--hash=sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b
7171
# via -r ci/requirements.in
72+
packaging==25.0 \
73+
--hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
74+
--hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
75+
# via -r ci/requirements.in
7276
pycparser==2.22 \
7377
--hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \
7478
--hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc

setup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@
1212
import sys
1313
import sysconfig
1414

15+
from packaging.version import Version
1516
from setuptools import setup
1617

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

6256
# PyPy (and possibly other distros) have CFFI distributed as part of
6357
# them.
64-
cffi_version = LooseVersion(cffi.__version__)
65-
if cffi_version < LooseVersion(MINIMUM_CFFI_VERSION):
58+
cffi_version = Version(Version(cffi.__version__).base_version)
59+
if cffi_version < Version(MINIMUM_CFFI_VERSION):
6660
print(
6761
"CFFI %s or newer required (%s found); "
6862
"not building CFFI backend" % (MINIMUM_CFFI_VERSION, cffi_version),

0 commit comments

Comments
 (0)