From 49a323e46eb34f7e729f573f06c18df093c7ae7a Mon Sep 17 00:00:00 2001 From: Patrik Kopkan Date: Wed, 13 Nov 2019 12:39:36 +0100 Subject: [PATCH] create directory in `$PWD` for built wheel It is little bit more explicit than installing wheels from $PWD. --- README.md | 3 ++- macros.pyproject | 6 ++++-- pyproject-rpm-macros.spec | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9b4d416..04acf40 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/macros.pyproject b/macros.pyproject index 2c553a4..056e76c 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -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__ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index a3c91ce..43d7a34 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -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 - 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 - 0-9 - Remove stray __pycache__ directory from /usr/bin when running %%pyproject_install