create directory in $PWD for built wheel

It is little bit more explicit than installing wheels from $PWD.
This commit is contained in:
Patrik Kopkan 2019-11-13 12:39:36 +01:00
parent f2dfb52b9f
commit 49a323e46e
3 changed files with 11 additions and 4 deletions

View File

@ -33,6 +33,8 @@ 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}`.
Adding run-time and test-time dependencies
------------------------------------------
@ -131,7 +133,6 @@ in `%generate_buildrequires`. If not, you need to add:
Limitations
-----------
`%pyproject_install` currently installs all wheels in `$PWD`. We are working on a more explicit solution.
This macro changes shebang lines of every Python script in `%{buildroot}%{_bindir}` to `#! %{__python3} %{py3_shbang_opt}` (`#! /usr/bin/python3 -s`).
We plan to preserve existing Python flags in shebangs, but the work is not yet finished.

View File

@ -1,11 +1,13 @@
%_pyproject_wheeldir ./pyproject-macros-wheeldir
%pyproject_wheel() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\\
%{__python3} -m pip wheel --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 --progress-bar off --verbose .
}
%pyproject_install() %{expand:\\\
%{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location ./*.whl
%{__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} %{py3_shbang_opts}" %{buildroot}%{_bindir}/*
rm -rfv %{buildroot}%{_bindir}/__pycache__

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release
Version: 0
Release: 9%{?dist}
Release: 10%{?dist}
Source0: macros.pyproject
Source1: pyproject_buildrequires.py
@ -87,6 +87,10 @@ install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
%license LICENSE
%changelog
* Fri Nov 15 2019 Patrik Kopkan <pkopkan@redhat.com> - 0-10
- Install wheel in '$PWD/pyproject-macros-wheeldir' to have more explicit path from which we install.
- The path can be changed by redefining %%_pyproject_wheeldir.
* Wed Nov 13 2019 Anna Khaitovich <akhaitov@redhat.com> - 0-9
- Remove stray __pycache__ directory from /usr/bin when running %%pyproject_install