%pyproject_install: pass %{_prefix} explicitly to pip install
This makes things work for %{_prefix} other than user, when combined with a change in python-rpm-macros to the definition of python3_sitelib/python3_sitearch. https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/KEQMMNJ4HTTHSQLK6P4DJJTVPA36SS3W/ Related: rhbz#2117571 Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
This commit is contained in:
parent
e082e4a71a
commit
681cc65e49
@ -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__
|
||||
|
@ -12,7 +12,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
|
||||
@ -126,6 +126,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
%license LICENSE
|
||||
|
||||
%changelog
|
||||
* Tue Jun 27 2022 Owen Taylor <otaylor@redhat.com> - 1.3.1-1
|
||||
- %%pyproject_install: pass %%{_prefix} explicitly to pip install
|
||||
|
||||
* Thu May 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-1
|
||||
- Use tomllib from the standard library on Python 3.11+
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user