|
|
162b0ca |
pyproject RPM macros
|
|
|
162b0ca |
====================
|
|
|
162b0ca |
|
|
|
162b0ca |
This is a provisional implementation of pyproject RPM macros for Fedora 30+.
|
|
|
162b0ca |
|
|
|
162b0ca |
These macros are useful for packaging Python projects that use the [PEP 517] `pyproject.toml` file, which specifies the package's build dependencies (including the build system, such as setuptools, flit or poetry).
|
|
|
162b0ca |
|
|
|
162b0ca |
[PEP 517]: https://www.python.org/dev/peps/pep-0517/
|
|
|
162b0ca |
|
|
|
162b0ca |
|
|
|
162b0ca |
Usage
|
|
|
162b0ca |
-----
|
|
|
162b0ca |
|
|
|
162b0ca |
If your upstream sources include `pyproject.toml` and you want to use these macros, BuildRequire them:
|
|
|
162b0ca |
|
|
|
162b0ca |
BuildRequires: pyproject-rpm-macros
|
|
|
162b0ca |
|
|
|
162b0ca |
This will bring in python3-devel, so you don't need to require python3-devel explicitly.
|
|
|
162b0ca |
|
|
|
162b0ca |
Then, build a wheel in %build:
|
|
|
162b0ca |
|
|
|
162b0ca |
%build
|
|
|
162b0ca |
%pyproject_wheel
|
|
|
162b0ca |
|
|
|
162b0ca |
And install the wheel in %install:
|
|
|
162b0ca |
|
|
|
162b0ca |
%install
|
|
|
162b0ca |
%pyproject_install
|
|
|
162b0ca |
|
|
|
162b0ca |
|
|
|
162b0ca |
Limitations
|
|
|
162b0ca |
-----------
|
|
|
162b0ca |
|
|
|
48b8e40 |
`%pyproject_install` currently installs all wheels in `$PWD`. We are working on a more explicit solution.
|
|
|
162b0ca |
|
|
|
162b0ca |
This macro changes shebang lines of every Python script in `%{buildroot}%{_bindir}` to `#! %{__python3} %{py3_shbang_opt}` (`#! /usr/bin/python -s`).
|
|
|
162b0ca |
We plan to preserve exisiting Python flags in shebangs, but the work is not yet finished.
|
|
|
162b0ca |
|
|
|
162b0ca |
Currently, the macros do not automatically generate BuildRequires. We are working on that as well.
|
|
|
044c837 |
|