Skip to content

Commit

Permalink
deps: use packaging instead of deprecated distutils (#2931)
Browse files Browse the repository at this point in the history
Replace `distutils.Version` (deprecated) with `packaging.Version`

Signed-off-by: Francesco Casalegno <francesco.casalegno@gmail.com>
  • Loading branch information
FrancescoCasalegno committed Jul 26, 2022
1 parent 4e19cc4 commit 2e6dad7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docker/transport/ssladapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
import sys

from distutils.version import StrictVersion
from packaging.version import Version
from requests.adapters import HTTPAdapter

from docker.transport.basehttpadapter import BaseHTTPAdapter
Expand Down Expand Up @@ -70,4 +70,4 @@ def can_override_ssl_version(self):
return False
if urllib_ver == 'dev':
return True
return StrictVersion(urllib_ver) > StrictVersion('1.5')
return Version(urllib_ver) > Version('1.5')
6 changes: 3 additions & 3 deletions docker/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import shlex
import string
from datetime import datetime
from distutils.version import StrictVersion
from packaging.version import Version

from .. import errors
from ..constants import DEFAULT_HTTP_HOST
Expand Down Expand Up @@ -55,8 +55,8 @@ def compare_version(v1, v2):
>>> compare_version(v2, v2)
0
"""
s1 = StrictVersion(v1)
s2 = StrictVersion(v2)
s1 = Version(v1)
s2 = Version(v2)
if s1 == s2:
return 0
elif s1 > s2:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cryptography==3.4.7
enum34==1.1.6
idna==2.5
ipaddress==1.0.18
packaging==16.8
packaging==21.3
paramiko==2.10.1
pycparser==2.17
pyOpenSSL==18.0.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
SOURCE_DIR = os.path.join(ROOT_DIR)

requirements = [
'packaging',
'websocket-client >= 0.32.0',
'requests >= 2.14.2, != 2.18.0',
]
Expand Down

0 comments on commit 2e6dad7

Please sign in to comment.