%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/ Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
This commit is contained in:
parent
e31d5d5683
commit
946c8726cf
@ -54,7 +54,7 @@ echo $(IFS=:; echo "${pyproject_build_lib[*]}")
|
|||||||
|
|
||||||
%pyproject_install() %{expand:\\\
|
%pyproject_install() %{expand:\\\
|
||||||
specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/')
|
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
|
if [ -d %{buildroot}%{_bindir} ]; then
|
||||||
%py3_shebang_fix %{buildroot}%{_bindir}/*
|
%py3_shebang_fix %{buildroot}%{_bindir}/*
|
||||||
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
||||||
|
@ -10,7 +10,7 @@ License: MIT
|
|||||||
# Increment Y and reset Z when new macros or features are added
|
# Increment Y and reset Z when new macros or features are added
|
||||||
# Increment Z when this is a bugfix or a cosmetic change
|
# Increment Z when this is a bugfix or a cosmetic change
|
||||||
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|
||||||
# Macro files
|
# Macro files
|
||||||
@ -124,6 +124,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
|
||||||
%changelog
|
%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
|
* Thu May 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-1
|
||||||
- Use tomllib from the standard library on Python 3.11+
|
- Use tomllib from the standard library on Python 3.11+
|
||||||
|
|
||||||
|
@ -11,12 +11,19 @@ BuildArch: noarch
|
|||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: pyproject-rpm-macros
|
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
|
%description
|
||||||
A Python package containing executables.
|
A Python package containing executables.
|
||||||
Building this tests:
|
Building this tests:
|
||||||
- there are no bytecompiled files in %%{_bindir}
|
- there are no bytecompiled files in %%{_bindir}
|
||||||
- the executable's shebang is adjusted properly
|
- the executable's shebang is adjusted properly
|
||||||
- file direct_url.json isn't created
|
- file direct_url.json isn't created
|
||||||
|
- installation to custom prefix works
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version}
|
%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)"
|
test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib)"
|
||||||
%endif
|
%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
|
%files -f %pyproject_files
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.md
|
%doc README.md
|
||||||
|
Loading…
Reference in New Issue
Block a user