Deprecate the provisional %{pyproject_build_lib} macro
There is no scheduled removal. See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/HMLOPAU3RZLXD4BOJHTIPKI3I4U6U7OE/ Related: rhbz#2208971
This commit is contained in:
parent
fb9a851ec3
commit
ccc11a3af7
91
README.md
91
README.md
@ -336,91 +336,6 @@ These arguments are still required:
|
|||||||
Multiple subpackages are generated when multiple names are provided.
|
Multiple subpackages are generated when multiple names are provided.
|
||||||
|
|
||||||
|
|
||||||
PROVISIONAL: Importing just-built (extension) modules in %build
|
|
||||||
---------------------------------------------------------------
|
|
||||||
|
|
||||||
Sometimes, it is desired to be able to import the *just-built* extension modules
|
|
||||||
in the `%build` section, e.g. to build the documentation with Sphinx.
|
|
||||||
|
|
||||||
%build
|
|
||||||
%pyproject_wheel
|
|
||||||
... build the docs here ...
|
|
||||||
|
|
||||||
With pure Python packages, it might be possible to set `PYTHONPATH=${PWD}` or `PYTHONPATH=${PWD}/src`.
|
|
||||||
However, it is a bit more complicated with extension modules.
|
|
||||||
|
|
||||||
The location of just-built modules might differ depending on Python version, architecture, pip version, etc.
|
|
||||||
Hence, the macro `%{pyproject_build_lib}` exists to be used like this:
|
|
||||||
|
|
||||||
%build
|
|
||||||
%pyproject_wheel
|
|
||||||
PYTHONPATH=%{pyproject_build_lib} ... build the docs here ...
|
|
||||||
|
|
||||||
This macro is currently **provisional** and the behavior might change.
|
|
||||||
Please subscribe to Fedora's [python-devel list] if you use the macro.
|
|
||||||
|
|
||||||
The `%{pyproject_build_lib}` macro expands to an Shell `$(...)` expression and does not work when put into single quotes (`'`).
|
|
||||||
|
|
||||||
Depending on the pip version, the expanded value will differ:
|
|
||||||
|
|
||||||
[python-devel list]: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/
|
|
||||||
|
|
||||||
### New pip 21.3+ with in-tree-build and setuptools 62.1+ (Fedora 37+)
|
|
||||||
|
|
||||||
Always use the macro from the same directory where you called `%pyproject_wheel` from.
|
|
||||||
The value will expand to something like:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib.linux-x86_64-cpython-311` for wheels with extension modules
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib` for pure Python wheels
|
|
||||||
|
|
||||||
If multiple wheels were built from the same directory,
|
|
||||||
some pure Python and some with extension modules,
|
|
||||||
the expanded value will be combined with `:`:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib.linux-x86_64-cypthon-311:/builddir/build/BUILD/%{name}-%{version}/build/lib`
|
|
||||||
|
|
||||||
If multiple wheels were built from different directories,
|
|
||||||
the value will differ depending on the current directory.
|
|
||||||
|
|
||||||
|
|
||||||
### New pip 21.3+ with in-tree-build and older setuptools (Fedora 36)
|
|
||||||
|
|
||||||
Always use the macro from the same directory where you called `%pyproject_wheel` from.
|
|
||||||
The value will expand to something like:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib.linux-x86_64-3.10` for wheels with extension modules
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib` for pure Python wheels
|
|
||||||
|
|
||||||
If multiple wheels were built from the same directory,
|
|
||||||
some pure Python and some with extension modules,
|
|
||||||
the expanded value will be combined with `:`:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/build/lib.linux-x86_64-3.10:/builddir/build/BUILD/%{name}-%{version}/build/lib`
|
|
||||||
|
|
||||||
If multiple wheels were built from different directories,
|
|
||||||
the value will differ depending on the current directory.
|
|
||||||
|
|
||||||
|
|
||||||
### Older pip with out-of-tree-build (Fedora 35 and EL 9)
|
|
||||||
|
|
||||||
The value will expand to something like:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/.pyproject-builddir/pip-req-build-xxxxxxxx/build/lib.linux-x86_64-3.10` for wheels with extension modules
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/.pyproject-builddir/pip-req-build-xxxxxxxx/build/lib` for pure Python wheels
|
|
||||||
|
|
||||||
Note that the exact value is **not stable** between builds
|
|
||||||
(the `xxxxxxxx` part is randomly generated,
|
|
||||||
neither you should consider the `.pyproject-builddir` directory to remain stable).
|
|
||||||
|
|
||||||
If multiple wheels are built,
|
|
||||||
the expanded value will always be combined with `:` regardless of the current directory, e.g.:
|
|
||||||
|
|
||||||
* `/builddir/build/BUILD/%{name}-%{version}/.pyproject-builddir/pip-req-build-xxxxxxxx/build/lib.linux-x86_64-3.10:/builddir/build/BUILD/%{name}-%{version}/.pyproject-builddir/pip-req-build-yyyyyyyy/build/lib.linux-x86_64-3.10:/builddir/build/BUILD/%{name}-%{version}/.pyproject-builddir/pip-req-build-zzzzzzzz/build/lib`
|
|
||||||
|
|
||||||
**Note:** If you manage to build some wheels with in-tree-build and some with out-of-tree-build option,
|
|
||||||
the expanded value will contain all relevant directories.
|
|
||||||
|
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
@ -473,6 +388,12 @@ so be prepared for problems.
|
|||||||
[pip's documentation]: https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support
|
[pip's documentation]: https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support
|
||||||
|
|
||||||
|
|
||||||
|
Deprecated
|
||||||
|
----------
|
||||||
|
|
||||||
|
The `%{pyproject_build_lib}` macro is deprecated, don't use it.
|
||||||
|
|
||||||
|
|
||||||
Testing the macros
|
Testing the macros
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@ -34,7 +34,14 @@ CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" TMPDI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
%pyproject_build_lib %{expand:\\\
|
%pyproject_build_lib %{!?__pyproject_build_lib_warned:%{warn:The %%{pyproject_build_lib} macro is deprecated.
|
||||||
|
It only works with setuptools and is not build-backend-agnostic.
|
||||||
|
The macro is not scheduled for removal, but there is a possibility of incompatibilities with future versions of setuptools.
|
||||||
|
As a replacement for the macro for the setuptools backend on Fedora 37+, you can use $PWD/build/lib for pure Python packages,
|
||||||
|
or $PWD/build/lib.%%{python3_platform}-cpython-%%{python3_version_nodots} for packages with extension modules.
|
||||||
|
Other build backends and older distributions may need different paths.
|
||||||
|
See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/HMLOPAU3RZLXD4BOJHTIPKI3I4U6U7OE/ for details.
|
||||||
|
}%{global __pyproject_build_lib_warned 1}}%{expand:\\\
|
||||||
$(
|
$(
|
||||||
pyproject_build_lib=()
|
pyproject_build_lib=()
|
||||||
if [ -d build/lib.%{python3_platform}-cpython-%{python3_version_nodots} ]; then
|
if [ -d build/lib.%{python3_platform}-cpython-%{python3_version_nodots} ]; then
|
||||||
|
@ -12,7 +12,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.7.0
|
Version: 1.8.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|
||||||
# Macro files
|
# Macro files
|
||||||
@ -149,6 +149,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 18 2023 Miro Hrončok <mhroncok@redhat.com> - 1.8.0-1
|
||||||
|
- Deprecate the provisional %%{pyproject_build_lib} macro
|
||||||
|
- See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/HMLOPAU3RZLXD4BOJHTIPKI3I4U6U7OE/
|
||||||
|
|
||||||
* Fri Mar 31 2023 Miro Hrončok <mhroncok@redhat.com> - 1.7.0-1
|
* Fri Mar 31 2023 Miro Hrončok <mhroncok@redhat.com> - 1.7.0-1
|
||||||
- %%pyproject_buildrequires: Redirect stdout to stderr via Shell
|
- %%pyproject_buildrequires: Redirect stdout to stderr via Shell
|
||||||
- Dependencies are recorded to a text file that is catted at the end
|
- Dependencies are recorded to a text file that is catted at the end
|
||||||
|
Loading…
Reference in New Issue
Block a user