Skip to content

Use packaging instead of distutils for Version #2931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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