From 95ba8376f52fd586d421ce33642e2859ba6f036a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 16 Apr 2020 15:42:50 +0200 Subject: [PATCH] Handle extracting debuginfo from extension modules Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1806625 Upstream issue for a proper fix https://github.com/pypa/pip/issues/7555 Co-Authored-By: Petr Viktorin --- README.md | 2 +- macros.pyproject | 17 +++++++++++++++-- pyproject-rpm-macros.spec | 1 + tests/python-ldap.spec | 3 --- tests/python-mistune.spec | 3 --- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 32639e8..012bd0b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ And install the wheel in `%install` with `%pyproject_install`: %install %pyproject_install -`%pyproject_install` installs all wheels in `$PWD/pyproject-macros-wheeldir/`. If you would like to save wheels somewhere else redefine `%{_pyproject_wheeldir}`. +`%pyproject_install` installs all wheels in `$PWD/pyproject-wheeldir/`. If you would like to save wheels somewhere else redefine `%{_pyproject_wheeldir}`. Adding run-time and test-time dependencies diff --git a/macros.pyproject b/macros.pyproject index 3d607eb..6e05c27 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -1,14 +1,27 @@ -%_pyproject_wheeldir ./pyproject-macros-wheeldir +# This is a directory where wheels are stored and installed from, relative to PWD +%_pyproject_wheeldir pyproject-wheeldir + +# This is a directory used as TMPDIR, where pip copies sources to and builds from, relative to PWD +# For proper debugsource packages, we create TMPDIR within PWD +# See https://github.com/pypa/pip/issues/7555#issuecomment-595180864 +# +# This will be used in debugsource package paths (applies to extension modules only) +# NB: pytest collects tests from here if not hidden +# https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs +%_pyproject_builddir .pyproject-builddir %pyproject_files %{_builddir}/pyproject-files %pyproject_wheel() %{expand:\\\ +export TMPDIR="${PWD}/%{_pyproject_builddir}" +mkdir -p "${TMPDIR}" CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\\ -%{__python3} -m pip wheel --wheel-dir %{_pyproject_wheeldir} --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --progress-bar off --verbose . +%{__python3} -m pip wheel --wheel-dir %{_pyproject_wheeldir} --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --no-clean --progress-bar off --verbose . } %pyproject_install() %{expand:\\\ +export TMPDIR="${PWD}/%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location %{_pyproject_wheeldir}/*.whl if [ -d %{buildroot}%{_bindir} ]; then pathfix.py -pni "%{__python3}" -k%{?py3_shbang_opts: -a%{py3_shbang_opts_nodash}} %{buildroot}%{_bindir}/* diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index c55e972..a09556e 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -102,6 +102,7 @@ install -m 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/redhat/ %changelog * Wed Apr 15 2020 Patrik Kopkan - 0-14 - Add %%pyproject_save_file macro for generating file section +- Handle extracting debuginfo from extension modules (#1806625) * Mon Mar 02 2020 Miro HronĨok - 0-13 - Tox dependency generator: Handle deps read in from a text file (#1808601) diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index 0fc4c96..dd1d242 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -1,6 +1,3 @@ -# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1806625 -%global debug_package %{nil} - Name: python-ldap Version: 3.1.0 Release: 9%{?dist} diff --git a/tests/python-mistune.spec b/tests/python-mistune.spec index 79f7d5e..14102df 100644 --- a/tests/python-mistune.spec +++ b/tests/python-mistune.spec @@ -1,6 +1,3 @@ -# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1806625 -%global debug_package %{nil} - Name: python-mistune Version: 0.8.3 Release: 11%{?dist}