#24 create temp directory for build wheel
Merged 4 years ago by churchyard. Opened 4 years ago by pkopkan.
rpms/ pkopkan/pyproject-rpm-macros master  into  master

file modified
+2 -1
@@ -33,6 +33,8 @@ 

      %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 @@ 

  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.

file modified
+4 -2
@@ -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__

file modified
+5 -1
@@ -6,7 +6,7 @@ 

  

  # 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 @@ 

  %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

  

Please rebase this on master, it conflicts and adds some of my old commits, so it is not clear what is actually changing

Not sure you can create shell variables in %build and reuse them in %install.

rebased onto 800170d127d8c14f3cb2aae22bb193e1da85418f

4 years ago

Right, so I will use some hardcoded path. Is it good idea to check if is is defined something like %pyproject_wheeldir and instead use that?

Yes, we can define it and let people redefine it if needed. I'd suggest naming it with an underscore, to signal it is not fully supported, such as %_pyproject_wheeldir.

I also suggest the directory to be in pwd, not in /tmp.

rebased onto ef9b632fbfa7050c8b4156d4e7b730892d0d11fa

4 years ago

no need for expand, you can make it a oneliner (like a "variable"):

%_pyproject_wheeldir ./pyproject-macros-wheeldir

Please don't forget:

  • changelog entry
  • update the README (it currently says we install all wheels in PWD)
  • reword the commit, add rationale (why is this change needed)

rebased onto e9da65d55ee4807470b8fb71afebd917307be6db

4 years ago

rebased onto 5fde0b5a684ea37686c73a56cf23583379804133

4 years ago

rebased onto 21ef0e898c5becafb7a95ce90c8fabd2f0fda910

4 years ago

the backslash is intentional or typo? capital I in If. redefine instead of define.

no need for () in %_pyproject_wheeldir

If you have macros in the changelog, the % needs to be escaped: %%_pyproject_wheeldir

rebased onto 2e9c1faf25823ecfa975f1d109337ae8672c7c07

4 years ago

rebased onto f9d93d0b41d042dda671ac9ead92896c4cc57a6d

4 years ago

rebased onto ab697b1dcaa88064c68481a3ee140cfb7a2341a8

4 years ago

rebased onto 54bfc46f3d2cd53eb84483aad55c116be5ad4434

4 years ago

rebased onto 49a323e

4 years ago

This looks good to me. I'll wait for the CI and merge.

Good job!

Metadata Update from @churchyard:
- Request assigned

4 years ago

Metadata Update from @churchyard:
- Request assigned

4 years ago

Pull-Request has been merged by churchyard

4 years ago