public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Drop setup.py based Python build (#2135561, #2149762)
Date: Mon, 23 Nov 2026 09:34:37 GMT [thread overview]
Message-ID: <179542647711.1.14675259140617203314.rpms-rpm-56868f0f9b01@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 56868f0f9b01c9eae6c465e4258ebd81b1018b3a
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2023-01-09T14:02:40+02:00
Stats : +91/-11 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/56868f0f9b01c9eae6c465e4258ebd81b1018b3a?branch=pmatilai-v6
Log:
Drop setup.py based Python build (#2135561, #2149762)
The setup.py build was only really added for dealing with parallel
installable Python 2 and 3 builds, and has been quite a PITA otherwise
because it's not what the upstream builds and tests use. Now that
the 2to3 transition is thankfully over, we can go back to building the
extension by ourselves. Only, in the meanwhile people have come to
depend on the egg-info data so create that from automake, that format is
not exactly rocket science.
This fixes us accidentally shipping two slightly different Python
modules for years (#2135719) and building with Python >= 3.12 where
distutils has been dropped, and does so in upstream compatible manner
(where a similar approach was taken when transitioning to cmake based
build system)
---
diff --git a/0001-Generate-Python-egg-info-from-automake-builds.patch b/0001-Generate-Python-egg-info-from-automake-builds.patch
new file mode 100644
index 0000000..539f67c
--- /dev/null
+++ b/0001-Generate-Python-egg-info-from-automake-builds.patch
@@ -0,0 +1,82 @@
+From de0b9d142ad8bada4d49afeee95616fee265d44f Mon Sep 17 00:00:00 2001
+Message-Id: <de0b9d142ad8bada4d49afeee95616fee265d44f.1673264828.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 9 Jan 2023 12:56:34 +0200
+Subject: [PATCH] Generate Python egg-info from automake builds
+
+To compensate for the loss of egg-info from the python distutils build,
+create one ourselves.
+
+This is effectively a backport of e31fb5b75898bfa09180dba02475c6d01764d94f
+which dismissed the need for an automake version, but unfortunately Python
+3.12 and automake-based rpm versions do co-exist in the same time-space
+continuum and we'll have to deal with this in rpm 4.18 as well.
+
+As to why not just use distutils from python-setuptools: that variant
+turns the egg-info into a directory, which in rpm is a one-way street.
+And we don't need that multi megabyte Python library to fill in these
+couple of values, really.
+---
+ configure.ac | 1 +
+ python/Makefile.am | 9 ++++++++-
+ python/rpm.egg-info.in | 10 ++++++++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+ create mode 100644 python/rpm.egg-info.in
+
+diff --git a/configure.ac b/configure.ac
+index fbbfead89..5f5842590 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -964,5 +964,6 @@ AC_CONFIG_FILES([Makefile
+ tests/Makefile
+ plugins/Makefile
+ python/setup.py
++ python/rpm.egg-info
+ ])
+ AC_OUTPUT
+diff --git a/python/Makefile.am b/python/Makefile.am
+index ec3608134..04168406d 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -3,14 +3,21 @@
+ include $(top_srcdir)/rpm.am
+ AM_CFLAGS = @RPMCFLAGS@
+
+-EXTRA_DIST = rpm/__init__.py rpm/transaction.py
++CLEANFILES =
++EXTRA_DIST = rpm/__init__.py rpm/transaction.py rpm.egg-info.in
+
+ AM_CPPFLAGS = -I$(top_srcdir)/include/
+ AM_CPPFLAGS += -I$(top_srcdir)/python
+ AM_CPPFLAGS += @PYTHON_CFLAGS@
+
++egginfo = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
++$(egginfo):
++ cat rpm.egg-info > $(egginfo)
++CLEANFILES += $(egginfo)
++
+ pkgpyexec_LTLIBRARIES = _rpm.la
+ pkgpyexec_DATA = rpm/__init__.py rpm/transaction.py
++pyexec_DATA = $(egginfo)
+
+ _rpm_la_LDFLAGS = -module -avoid-version -shared
+ _rpm_la_LIBADD = \
+diff --git a/python/rpm.egg-info.in b/python/rpm.egg-info.in
+new file mode 100644
+index 000000000..838ce5854
+--- /dev/null
++++ b/python/rpm.egg-info.in
+@@ -0,0 +1,10 @@
++Metadata-Version: 1.0
++Name: @PACKAGE_NAME@
++Version: @PACKAGE_VERSION@
++Summary: Python bindings for rpm
++Home-page: @PACKAGE_URL@
++Author: Rpm community
++Author-email: rpm-maint@lists.rpm.org
++License: GNU General Public License v2
++Description: Python bindings for rpm
++Platform: UNKNOWN
+--
+2.39.0
+
diff --git a/rpm.spec b/rpm.spec
index 2b0851d..10d10b5 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -136,6 +136,7 @@ rpm-4.9.90-no-man-dirs.patch
# Patches already upstream:
# ...
0001-Fix-potential-uninitialized-variable-use-in-rpmtsImp.patch
+0001-Generate-Python-egg-info-from-automake-builds.patch
# These are not yet upstream
rpm-4.7.1-geode-i686.patch
@@ -384,19 +385,9 @@ done;
%make_build
-pushd python
-%py3_build
-popd
-
%install
%make_install
-# We need to build with --enable-python for the self-test suite, but we
-# actually package the bindings built with setup.py (#531543#c26)
-pushd python
-%py3_install
-popd
-
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/%{_unitdir}
install -m 644 %{SOURCE20} $RPM_BUILD_ROOT/%{_unitdir}
@@ -604,8 +595,11 @@ fi
%{_mandir}/man8/rpmsign.8*
%files -n python3-%{name}
-%{python3_sitearch}/rpm/
%{python3_sitearch}/rpm-%{rpmver}*.egg-info
+%{python3_sitearch}/rpm/__init__.py
+%{python3_sitearch}/rpm/transaction.py
+%{python3_sitearch}/rpm/_rpm.so
+%artifact %{python3_sitearch}/rpm/__pycache__/
%files devel
%{_mandir}/man8/rpmgraph.8*
@@ -623,6 +617,10 @@ fi
%doc docs/librpm/html/*
%changelog
+* Mon Jan 09 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-9
+- Generate Python egg-info from automake (#2135561)
+- Drop setup.py-based Python build (#2135719)
+
* Wed Dec 07 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-8
- Fix hang-up on failed key import (related to #2149762)
reply other threads:[~2026-11-23 9:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542647711.1.14675259140617203314.rpms-rpm-56868f0f9b01@fedoraproject.org \
--to=pmatilai@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox