diff --git a/macros.pyproject b/macros.pyproject index bf412f7..31267ac 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -54,7 +54,7 @@ echo $(IFS=:; echo "${pyproject_build_lib[*]}") %pyproject_install() %{expand:\\\ specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/') -TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier +TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --prefix %{_prefix} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier if [ -d %{buildroot}%{_bindir} ]; then %py3_shebang_fix %{buildroot}%{_bindir}/* rm -rfv %{buildroot}%{_bindir}/__pycache__ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 1a8364a..5adefb8 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -10,7 +10,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.3.0 +Version: 1.3.1 Release: 1%{?dist} # Macro files @@ -124,6 +124,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Tue Jun 27 2022 Owen Taylor - 1.3.1-1 +- %%pyproject_install: pass %%{_prefix} explicitly to pip install + * Thu May 12 2022 Miro HronĨok - 1.3.0-1 - Use tomllib from the standard library on Python 3.11+ diff --git a/tests/tldr.spec b/tests/tldr.spec index 2924485..3788821 100644 --- a/tests/tldr.spec +++ b/tests/tldr.spec @@ -11,12 +11,19 @@ BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros +%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10 +# Internal check for our macros: test that we can install to a custom prefix +BuildRequires: python3-rpm-macros >= 3.10-18 +%global _prefix /app +%endif + %description A Python package containing executables. Building this tests: - there are no bytecompiled files in %%{_bindir} - the executable's shebang is adjusted properly - file direct_url.json isn't created +- installation to custom prefix works %prep %autosetup -n %{name}-%{version} @@ -48,6 +55,12 @@ test "%{pyproject_build_lib}" == "${PWD}/build/lib" test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib)" %endif +%if 0%{?fedora} >= 36 || 0%{?rhel} >= 10 +# Internal check for custom prefix +grep '^/usr' %{pyproject_files} && exit 1 || true +grep '^/app' %{pyproject_files} +%endif + %files -f %pyproject_files %license LICENSE %doc README.md