summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChayim <chayim@users.noreply.github.com>2021-11-25 16:32:28 +0200
committerGitHub <noreply@github.com>2021-11-25 16:32:28 +0200
commit884f7adc871fbae352dfea099a57a1534a8588c6 (patch)
treefcd9a0c49823f681cc8baff4f0381a5f1bb042b4
parentf4519f3b7f1f7314b5d342be989df1c4365954b9 (diff)
downloadredis-py-884f7adc871fbae352dfea099a57a1534a8588c6.tar.gz
Fixing deprecating distutils (PEP 632) (#1730)
-rwxr-xr-xredis/connection.py10
-rw-r--r--requirements.txt1
-rw-r--r--setup.py3
-rw-r--r--tox.ini2
4 files changed, 9 insertions, 7 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 2f91fae..6ff3650 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -1,4 +1,4 @@
-from distutils.version import LooseVersion
+from packaging.version import Version
from itertools import chain
from time import time
from queue import LifoQueue, Empty, Full
@@ -55,13 +55,13 @@ NONBLOCKING_EXCEPTIONS = tuple(NONBLOCKING_EXCEPTION_ERROR_NUMBERS.keys())
if HIREDIS_AVAILABLE:
import hiredis
- hiredis_version = LooseVersion(hiredis.__version__)
+ hiredis_version = Version(hiredis.__version__)
HIREDIS_SUPPORTS_CALLABLE_ERRORS = \
- hiredis_version >= LooseVersion('0.1.3')
+ hiredis_version >= Version('0.1.3')
HIREDIS_SUPPORTS_BYTE_BUFFER = \
- hiredis_version >= LooseVersion('0.1.4')
+ hiredis_version >= Version('0.1.4')
HIREDIS_SUPPORTS_ENCODING_ERRORS = \
- hiredis_version >= LooseVersion('1.0.0')
+ hiredis_version >= Version('1.0.0')
HIREDIS_USE_BYTE_BUFFER = True
# only use byte buffer if hiredis supports it
diff --git a/requirements.txt b/requirements.txt
index 9f8d550..f1e7e7e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,2 @@
deprecated
+packaging
diff --git a/setup.py b/setup.py
index 6c712bd..9acb501 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,8 @@ setup(
author_email="oss@redis.com",
python_requires=">=3.6",
install_requires=[
- 'deprecated'
+ 'deprecated==1.2.3',
+ 'packaging==21.3',
],
classifiers=[
"Development Status :: 5 - Production/Stable",
diff --git a/tox.ini b/tox.ini
index 33c3971..dd68274 100644
--- a/tox.ini
+++ b/tox.ini
@@ -108,7 +108,7 @@ extras =
setenv =
CLUSTER_URL = "redis://localhost:16379/0"
commands =
- redis: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' {posargs}
+ standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' {posargs}
cluster: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} {posargs}
[testenv:devenv]