Dear maintainer,

I am planning a NMU for docker-compose package to remove
python3-distutils package from dependency. I tested the patch and it
work for me and is attached to this bug report. I'm going to upload to
DELAYED/3-days, to give you time to review it and provide feedback if it
needed.

If you have any objections or would you like to make the changes
yourself please let me know.

-- 
cheers,
        Emmanuel Arias

 ⢀⣴⠾⠻⢶⣦⠀
 ⣾⠁⢠⠒⠀⣿⡁  eam...@debian.org
 ⢿⡄⠘⠷⠚⠋⠀  OpenPGP: 13796755BBC72BB8ABE2AEB5 FA9DEC5DE11C63F1                    
 
 ⠈⠳⣄
diff -Nru docker-compose-1.29.2/debian/changelog docker-compose-1.29.2/debian/changelog
--- docker-compose-1.29.2/debian/changelog	2023-08-11 12:05:52.000000000 -0300
+++ docker-compose-1.29.2/debian/changelog	2024-07-08 12:49:42.000000000 -0300
@@ -1,3 +1,13 @@
+docker-compose (1.29.2-6.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * d/patches/remove_distutils.patch: Add patch to remove the use of
+    python3-distutils.
+  * d/control: Remove python3-distutils from binary packages Dependency.
+    Replaced by python3-packaging (Closes: #1065848).
+
+ -- Emmanuel Arias <eam...@debian.org>  Mon, 08 Jul 2024 12:49:42 -0300
+
 docker-compose (1.29.2-6) unstable; urgency=medium
 
   * Source-only rebuild.
diff -Nru docker-compose-1.29.2/debian/control docker-compose-1.29.2/debian/control
--- docker-compose-1.29.2/debian/control	2023-08-11 12:05:52.000000000 -0300
+++ docker-compose-1.29.2/debian/control	2024-07-08 12:49:12.000000000 -0300
@@ -33,8 +33,8 @@
 Depends:
  ${misc:Depends},
  ${python3:Depends},
- python3-distutils,
  python3-compose (= ${binary:Version}),
+ python3-packaging,
 Recommends: docker.io (>= 1.9.0)
 Description: define and run multi-container Docker applications with YAML
  docker-compose is a service management software built on top of docker. Define
@@ -48,7 +48,7 @@
 Depends:
  ${misc:Depends},
  ${python3:Depends},
- python3-distutils,
+ python3-packaging,
 Replaces: docker-compose (<< 1.29.2-4~)
 Breaks: docker-compose (<< 1.29.2-4~)
 Description: Python implementation of docker-compose file specification
diff -Nru docker-compose-1.29.2/debian/patches/remove_distutils.patch docker-compose-1.29.2/debian/patches/remove_distutils.patch
--- docker-compose-1.29.2/debian/patches/remove_distutils.patch	1969-12-31 21:00:00.000000000 -0300
+++ docker-compose-1.29.2/debian/patches/remove_distutils.patch	2024-07-08 12:49:42.000000000 -0300
@@ -0,0 +1,87 @@
+Description: Remove use of distutils
+ distutils is deprecated. This patch remove the references to distutils. In the project
+ was used by the find_executable call that was replaced by shutil.which. In the other
+ hand, LooseVersion was replaced by packaging.version.Version.
+Author: Emmanuel Arias <eam...@debian.org>
+Bug-Debian: https://bugs.debian.org/1065848
+Forwarded: no
+Last-Update: 2024-07-08
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/compose/cli/errors.py
++++ b/compose/cli/errors.py
+@@ -1,7 +1,7 @@
+ import contextlib
+ import logging
+ import socket
+-from distutils.spawn import find_executable
++from shutil import which
+ from textwrap import dedent
+ 
+ from docker.errors import APIError
+@@ -114,11 +114,11 @@
+ 
+ def get_conn_error_message(url):
+     try:
+-        if find_executable('docker') is None:
++        if which('docker') is None:
+             return docker_not_found_msg("Couldn't connect to Docker daemon.")
+         if is_docker_for_mac_installed():
+             return conn_error_docker_for_mac
+-        if find_executable('docker-machine') is not None:
++        if which('docker-machine') is not None:
+             return conn_error_docker_machine
+     except UnicodeDecodeError:
+         # https://github.com/docker/compose/issues/5442
+--- a/compose/cli/main.py
++++ b/compose/cli/main.py
+@@ -6,7 +6,7 @@
+ import re
+ import subprocess
+ import sys
+-from distutils.spawn import find_executable
++from shutil import which
+ from inspect import getdoc
+ from operator import attrgetter
+ 
+@@ -1547,7 +1547,7 @@
+ 
+ 
+ def call_docker(args, dockeropts, environment):
+-    executable_path = find_executable('docker')
++    executable_path = which('docker')
+     if not executable_path:
+         raise UserError(errors.docker_not_found_msg("Couldn't find `docker` binary."))
+ 
+--- a/compose/version.py
++++ b/compose/version.py
+@@ -1,7 +1,7 @@
+-from distutils.version import LooseVersion
++from packaging.version import Version
+ 
+ 
+-class ComposeVersion(LooseVersion):
++class ComposeVersion(Version):
+     """ A hashable version object """
+     def __hash__(self):
+         return hash(self.vstring)
+--- a/tests/integration/service_test.py
++++ b/tests/integration/service_test.py
+@@ -2,7 +2,7 @@
+ import re
+ import shutil
+ import tempfile
+-from distutils.spawn import find_executable
++from shutil import which
+ from io import StringIO
+ from os import path
+ 
+@@ -171,7 +171,7 @@
+     @pytest.mark.xfail(True, reason='Option has been removed in Engine 17.06.0')
+     def test_create_container_with_init_path(self):
+         self.require_api_version('1.25')
+-        docker_init_path = find_executable('docker-init')
++        docker_init_path = which('docker-init')
+         service = self.create_service('db', init=docker_init_path)
+         container = service.create_container()
+         service.start_container(container)
diff -Nru docker-compose-1.29.2/debian/patches/series docker-compose-1.29.2/debian/patches/series
--- docker-compose-1.29.2/debian/patches/series	1969-12-31 21:00:00.000000000 -0300
+++ docker-compose-1.29.2/debian/patches/series	2024-07-08 12:45:53.000000000 -0300
@@ -0,0 +1 @@
+remove_distutils.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to