[Pkg-libvirt-commits] [Git][libvirt-team/virt-manager][debian/sid] Drop the usage of distutils:
Pino Toscano (@pino)
gitlab at salsa.debian.org
Thu May 9 08:54:53 BST 2024
Pino Toscano pushed to branch debian/sid at Libvirt Packaging Team / virt-manager
Commits:
0b7b8cc3 by Pino Toscano at 2024-05-09T09:50:24+02:00
Drop the usage of distutils:
- backport upstream patches to fully use setuptools when it has all the
features needed
- drop the python3-distutils build dependency, no more explicitly used
Closes: #1066002
Gbp-Dch: Full
- - - - -
4 changed files:
- debian/control
- debian/patches/series
- + debian/patches/upstream_build-use-setuptools.command.build-when-available.patch
- + debian/patches/upstream_build-use-super.patch
Changes:
=====================================
debian/control
=====================================
@@ -15,7 +15,6 @@ Build-Depends:
dh-sequence-python3,
gettext,
python3,
- python3-distutils,
python3-docutils,
python3-setuptools,
# for the tests
=====================================
debian/patches/series
=====================================
@@ -1,3 +1,5 @@
upstream_tests-data-refresh-Fedora-tree-URLs-in-virt-install-.patch
upstream_tests-cli-Adjust-hotplug-test-for-latest-libvirt.patch
upstream_tests-Fix-host-copy-XML-with-libvirt-10.1.0.patch
+upstream_build-use-super.patch
+upstream_build-use-setuptools.command.build-when-available.patch
=====================================
debian/patches/upstream_build-use-setuptools.command.build-when-available.patch
=====================================
@@ -0,0 +1,51 @@
+From 231a3dbc875333c73347fc6be8b39d9fc5542460 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano at redhat.com>
+Date: Sun, 24 Mar 2024 10:19:28 +0100
+Subject: [PATCH] build: use setuptools.command.build when available
+
+Setuptools 62.4.0 adds setuptools.command.build to transparently replace
+the old distutils equivalent; hence, use it when available to fully
+switch away from distutils.
+
+Signed-off-by: Pino Toscano <ptoscano at redhat.com>
+---
+ setup.py | 23 ++++++++++++-----------
+ 1 file changed, 12 insertions(+), 11 deletions(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -22,14 +22,17 @@ import setuptools.command.install
+ import setuptools.command.install_egg_info
+
+
+-# distutils will be deprecated in python 3.12 in favor of setuptools,
+-# but as of this writing there's standard no setuptools way to extend the
+-# 'build' commands which are the only standard commands we trigger.
+-# https://github.com/pypa/setuptools/issues/2591
+-#
+-# Newer setuptools will transparently support 'import distutils' though.
+-# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
+-import distutils.command.build # pylint: disable=wrong-import-order
++try:
++ # Use the setuptools build command with setuptools >= 62.4.0
++ import setuptools.command.build
++ BUILD_COMMAND_CLASS = setuptools.command.build.build
++except ImportError:
++ # Use distutils with an older setuptools version
++ #
++ # Newer setuptools will transparently support 'import distutils' though.
++ # That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
++ import distutils.command.build # pylint: disable=wrong-import-order
++ BUILD_COMMAND_CLASS = distutils.command.build.build
+
+
+ SYSPREFIX = sysconfig.get_config_var("prefix")
+@@ -132,7 +135,7 @@ class my_build_i18n(setuptools.Command):
+ self.distribution.data_files.append((target, files_merged))
+
+
+-class my_build(distutils.command.build.build):
++class my_build(BUILD_COMMAND_CLASS):
+ def _make_bin_wrappers(self):
+ template = """#!/usr/bin/env python3
+
=====================================
debian/patches/upstream_build-use-super.patch
=====================================
@@ -0,0 +1,51 @@
+From 4f4e73d0170fdd7efdc552c7baebdf739b60df6a Mon Sep 17 00:00:00 2001
+From: Pino Toscano <ptoscano at redhat.com>
+Date: Sun, 24 Mar 2024 10:15:20 +0100
+Subject: [PATCH] build: use super()
+
+... rather than explicitly calling the parent class; this will make
+further changes easier.
+
+Signed-off-by: Pino Toscano <ptoscano at redhat.com>
+---
+ setup.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index d3872691..a30a5532 100755
+--- a/setup.py
++++ b/setup.py
+@@ -229,7 +229,7 @@ from %(pkgname)s import %(filename)s
+ self._make_bash_completion_files()
+
+ self.run_command("build_i18n")
+- distutils.command.build.build.run(self)
++ super().run()
+
+
+ class my_egg_info(setuptools.command.install_egg_info.install_egg_info):
+@@ -261,10 +261,10 @@ class my_install(setuptools.command.install.install):
+ (self.prefix, BuildConfig.prefix))
+ sys.exit(1)
+
+- setuptools.command.install.install.finalize_options(self)
++ super().finalize_options()
+
+ def run(self):
+- setuptools.command.install.install.run(self)
++ super().run()
+
+ if not self.distribution.no_update_icon_cache:
+ print("running gtk-update-icon-cache")
+@@ -429,7 +429,7 @@ class VMMDistribution(setuptools.dist.Distribution):
+ def __init__(self, *args, **kwargs):
+ self.no_update_icon_cache = False
+ self.no_compile_schemas = False
+- setuptools.dist.Distribution.__init__(self, *args, **kwargs)
++ super().__init__(*args, **kwargs)
+
+
+ class ExtractMessages(setuptools.Command):
+--
+2.43.0
+
View it on GitLab: https://salsa.debian.org/libvirt-team/virt-manager/-/commit/0b7b8cc3ef74c9cf788eff94d512084035293d45
--
View it on GitLab: https://salsa.debian.org/libvirt-team/virt-manager/-/commit/0b7b8cc3ef74c9cf788eff94d512084035293d45
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20240509/8895e5fa/attachment-0001.htm>
More information about the Pkg-libvirt-commits
mailing list