From 589556411faaea5f9e85f494b40b04c2cd9fe596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 17 Jun 2022 09:03:18 +0000 Subject: [PATCH] %pyproject_buildrequires: Support Package information on ELF objects When extension modules are built in %pyproject_buildrequires, we need to create the package note file. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2097535 This is tested via python-ldap -- %pyproject_buildrequires -w fails without the fix. Neither python-markupsafe nor python-mistune can be used as a test because they only warn when the extension module cannot be built because they fallback to pure Python. Related: rhbz#2117571 --- macros.pyproject | 3 +++ pyproject-rpm-macros.spec | 2 ++ tests/python-ldap.spec | 7 +++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/macros.pyproject b/macros.pyproject index a67a3f7..ca1ca68 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -129,6 +129,9 @@ fi # The _auto_set_build_flags feature does not do this in %%generate_buildrequires section, # but we want to get an environment consistent with %%build: %{?_auto_set_build_flags:%set_build_flags} +# The default flags expect the package note file to exist +# see https://bugzilla.redhat.com/show_bug.cgi?id=2097535 +%{?_package_note_flags:%_generate_package_note_file} %{-R: %{-r:%{error:The -R and -r options are mutually exclusive}} %{-w:%{error:The -R and -w options are mutually exclusive}} diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index dcdd07b..b2c6a79 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -128,6 +128,8 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog * Wed Jun 15 2022 Benjamin A. Beasley - 1.3.2-1 - Update %%pyproject_build_lib to support setuptools 62.1.0 and later +- %%pyproject_buildrequires: When extension modules are built, + support https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects * Fri May 27 2022 Owen Taylor - 1.3.1-1 - %%pyproject_install: pass %%{_prefix} explicitly to pip install diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index a08b605..41a446e 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -28,6 +28,7 @@ Building this tests: - the proper files are installed in the proper places - module glob in %%pyproject_save_files (some modules are included, some not) - combined manual and generated Buildrequires +- building an extension module via %%pyproject_buildrequires -w %package -n python3-ldap @@ -48,11 +49,13 @@ rm Tests/t_ldapobject.py Tests/t_cext.py Tests/t_edit.py Tests/t_ldap_sasl.py Te %generate_buildrequires -%pyproject_buildrequires -t +# -w is not required with this package, but we test that we can use it anyway +%pyproject_buildrequires -t -w %build -%pyproject_wheel +#%%pyproject_wheel -- this is done via %%pyproject_buildrequires -w + # Internal check that we can import the built extension modules from %%{pyproject_build_lib} %{python3} -c 'import _ldap' && exit 1 || true PYTHONPATH=%{pyproject_build_lib} %{python3} -c 'import _ldap'