#24 create temp directory for build wheel
Merged 23 days ago by churchyard. Opened a month 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 800170d

a month 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 ef9b632

a month 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 e9da65d

a month ago

rebased onto 5fde0b5

a month ago

rebased onto 21ef0e8

a month 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 2e9c1fa

a month ago

rebased onto f9d93d0

a month ago

rebased onto ab697b1

a month ago

rebased onto 54bfc46

a month ago

rebased onto 49a323e

23 days ago

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

Good job!

Metadata Update from @churchyard:
- Request assigned

23 days ago

Metadata Update from @churchyard:
- Request assigned

23 days ago

Pull-Request has been merged by churchyard

23 days ago