Skip to content

Commit 884f7ad

Browse files
authored
Fixing deprecating distutils (PEP 632) (#1730)
1 parent f4519f3 commit 884f7ad

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

redis/connection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from distutils.version import LooseVersion
1+
from packaging.version import Version
22
from itertools import chain
33
from time import time
44
from queue import LifoQueue, Empty, Full
@@ -55,13 +55,13 @@
5555
if HIREDIS_AVAILABLE:
5656
import hiredis
5757

58-
hiredis_version = LooseVersion(hiredis.__version__)
58+
hiredis_version = Version(hiredis.__version__)
5959
HIREDIS_SUPPORTS_CALLABLE_ERRORS = \
60-
hiredis_version >= LooseVersion('0.1.3')
60+
hiredis_version >= Version('0.1.3')
6161
HIREDIS_SUPPORTS_BYTE_BUFFER = \
62-
hiredis_version >= LooseVersion('0.1.4')
62+
hiredis_version >= Version('0.1.4')
6363
HIREDIS_SUPPORTS_ENCODING_ERRORS = \
64-
hiredis_version >= LooseVersion('1.0.0')
64+
hiredis_version >= Version('1.0.0')
6565

6666
HIREDIS_USE_BYTE_BUFFER = True
6767
# only use byte buffer if hiredis supports it

requirements.txt

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

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
author_email="[email protected]",
2525
python_requires=">=3.6",
2626
install_requires=[
27-
'deprecated'
27+
'deprecated==1.2.3',
28+
'packaging==21.3',
2829
],
2930
classifiers=[
3031
"Development Status :: 5 - Production/Stable",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extras =
108108
setenv =
109109
CLUSTER_URL = "redis://localhost:16379/0"
110110
commands =
111-
redis: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' {posargs}
111+
standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' {posargs}
112112
cluster: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} {posargs}
113113

114114
[testenv:devenv]

0 commit comments

Comments
 (0)