Panu Matilainen 56868f
From de0b9d142ad8bada4d49afeee95616fee265d44f Mon Sep 17 00:00:00 2001
Panu Matilainen 56868f
Message-Id: <de0b9d142ad8bada4d49afeee95616fee265d44f.1673264828.git.pmatilai@redhat.com>
Panu Matilainen 56868f
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 56868f
Date: Mon, 9 Jan 2023 12:56:34 +0200
Panu Matilainen 56868f
Subject: [PATCH] Generate Python egg-info from automake builds
Panu Matilainen 56868f
Panu Matilainen 56868f
To compensate for the loss of egg-info from the python distutils build,
Panu Matilainen 56868f
create one ourselves.
Panu Matilainen 56868f
Panu Matilainen 56868f
This is effectively a backport of e31fb5b75898bfa09180dba02475c6d01764d94f
Panu Matilainen 56868f
which dismissed the need for an automake version, but unfortunately Python
Panu Matilainen 56868f
3.12 and automake-based rpm versions do co-exist in the same time-space
Panu Matilainen 56868f
continuum and we'll have to deal with this in rpm 4.18 as well.
Panu Matilainen 56868f
Panu Matilainen 56868f
As to why not just use distutils from python-setuptools: that variant
Panu Matilainen 56868f
turns the egg-info into a directory, which in rpm is a one-way street.
Panu Matilainen 56868f
And we don't need that multi megabyte Python library to fill in these
Panu Matilainen 56868f
couple of values, really.
Panu Matilainen 56868f
---
Panu Matilainen 56868f
 configure.ac           |  1 +
Panu Matilainen 56868f
 python/Makefile.am     |  9 ++++++++-
Panu Matilainen 56868f
 python/rpm.egg-info.in | 10 ++++++++++
Panu Matilainen 56868f
 3 files changed, 19 insertions(+), 1 deletion(-)
Panu Matilainen 56868f
 create mode 100644 python/rpm.egg-info.in
Panu Matilainen 56868f
Panu Matilainen 56868f
diff --git a/configure.ac b/configure.ac
Panu Matilainen 56868f
index fbbfead89..5f5842590 100644
Panu Matilainen 56868f
--- a/configure.ac
Panu Matilainen 56868f
+++ b/configure.ac
Panu Matilainen 56868f
@@ -964,5 +964,6 @@ AC_CONFIG_FILES([Makefile
Panu Matilainen 56868f
  	tests/Makefile
Panu Matilainen 56868f
  	plugins/Makefile
Panu Matilainen 56868f
 	python/setup.py
Panu Matilainen 56868f
+	python/rpm.egg-info
Panu Matilainen 56868f
   ])
Panu Matilainen 56868f
 AC_OUTPUT
Panu Matilainen 56868f
diff --git a/python/Makefile.am b/python/Makefile.am
Panu Matilainen 56868f
index ec3608134..04168406d 100644
Panu Matilainen 56868f
--- a/python/Makefile.am
Panu Matilainen 56868f
+++ b/python/Makefile.am
Panu Matilainen 56868f
@@ -3,14 +3,21 @@
Panu Matilainen 56868f
 include $(top_srcdir)/rpm.am
Panu Matilainen 56868f
 AM_CFLAGS = @RPMCFLAGS@
Panu Matilainen 56868f
 
Panu Matilainen 56868f
-EXTRA_DIST = rpm/__init__.py rpm/transaction.py
Panu Matilainen 56868f
+CLEANFILES =
Panu Matilainen 56868f
+EXTRA_DIST = rpm/__init__.py rpm/transaction.py rpm.egg-info.in
Panu Matilainen 56868f
 
Panu Matilainen 56868f
 AM_CPPFLAGS = -I$(top_srcdir)/include/
Panu Matilainen 56868f
 AM_CPPFLAGS += -I$(top_srcdir)/python
Panu Matilainen 56868f
 AM_CPPFLAGS += @PYTHON_CFLAGS@
Panu Matilainen 56868f
 
Panu Matilainen 56868f
+egginfo = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
Panu Matilainen 56868f
+$(egginfo):
Panu Matilainen 56868f
+	cat rpm.egg-info > $(egginfo)
Panu Matilainen 56868f
+CLEANFILES += $(egginfo)
Panu Matilainen 56868f
+
Panu Matilainen 56868f
 pkgpyexec_LTLIBRARIES = _rpm.la
Panu Matilainen 56868f
 pkgpyexec_DATA = rpm/__init__.py rpm/transaction.py
Panu Matilainen 56868f
+pyexec_DATA = $(egginfo)
Panu Matilainen 56868f
 
Panu Matilainen 56868f
 _rpm_la_LDFLAGS = -module -avoid-version -shared
Panu Matilainen 56868f
 _rpm_la_LIBADD = \
Panu Matilainen 56868f
diff --git a/python/rpm.egg-info.in b/python/rpm.egg-info.in
Panu Matilainen 56868f
new file mode 100644
Panu Matilainen 56868f
index 000000000..838ce5854
Panu Matilainen 56868f
--- /dev/null
Panu Matilainen 56868f
+++ b/python/rpm.egg-info.in
Panu Matilainen 56868f
@@ -0,0 +1,10 @@
Panu Matilainen 56868f
+Metadata-Version: 1.0
Panu Matilainen 56868f
+Name: @PACKAGE_NAME@
Panu Matilainen 56868f
+Version: @PACKAGE_VERSION@
Panu Matilainen 56868f
+Summary: Python bindings for rpm
Panu Matilainen 56868f
+Home-page: @PACKAGE_URL@
Panu Matilainen 56868f
+Author: Rpm community
Panu Matilainen 56868f
+Author-email: rpm-maint@lists.rpm.org
Panu Matilainen 56868f
+License: GNU General Public License v2
Panu Matilainen 56868f
+Description: Python bindings for rpm
Panu Matilainen 56868f
+Platform: UNKNOWN
Panu Matilainen 56868f
-- 
Panu Matilainen 56868f
2.39.0
Panu Matilainen 56868f