From 8db2bc06df5bc3e7ca7da93a9f9edd4154012cb9 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Sun, 21 Nov 2021 10:00:29 +0200 Subject: [PATCH 1/2] Deprecating distutils (PEP 632) by adding packaging --- redis/connection.py | 10 +++++----- requirements.txt | 1 + setup.py | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/redis/connection.py b/redis/connection.py index e01742d70e..68f6824365 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 @@ -54,13 +54,13 @@ 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 9f8d5502da..f1e7e7ecdc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ deprecated +packaging diff --git a/setup.py b/setup.py index 6c712bd1d4..9acb501633 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,8 @@ 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", From 1dbade736b48cf2aaaf11554abe5c02d63a9cedc Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 25 Nov 2021 16:10:28 +0200 Subject: [PATCH 2/2] fixing tox standalone --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 33c397194d..dd68274f2d 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]