Skip to content

Commit

Permalink
Use packaging.version instead of distutils
Browse files Browse the repository at this point in the history
distutils was deprecated in Python 3.11 and removed in Python 3.12

Signed-off-by: Nghia Tran <tcnghia@gmail.com>
  • Loading branch information
tcnghia authored and rnc committed Feb 6, 2024
1 parent 756819b commit 44b6105
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker_squash/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def run(self):
parser.add_argument(
"-m",
"--message",
default="",
help="Specify a commit message (comment) for the new image.",
)
parser.add_argument(
Expand Down
6 changes: 4 additions & 2 deletions docker_squash/squash.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

import os
from distutils.version import StrictVersion

import docker
from packaging import version as packaging_version

from docker_squash.errors import SquashError
from docker_squash.lib import common
Expand Down Expand Up @@ -64,7 +64,9 @@ def run(self):
% self.output_path
)

if StrictVersion(docker_version["ApiVersion"]) >= StrictVersion("1.22"):
if packaging_version.parse(
docker_version["ApiVersion"]
) >= packaging_version.parse("1.22"):
image = V2Image(
self.log,
self.docker,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
docker
packaging

0 comments on commit 44b6105

Please sign in to comment.