pyproject-rpm-macros/tests/python-userpath.spec
Miro Hrončok 235e0c94a6 Allow building wheels in %pyproject_buildrequires to support other build backends
The hook is optional, see https://www.python.org/dev/peps/pep-0517/#prepare-metadata-for-build-wheel

> If a build frontend needs this information and the method is not defined,
> it should call build_wheel and look at the resulting metadata directly.

This is not yet automatically detected because the feature is provisional.
Use `%pyproject_buildrequires -w` to opt-in.

Resolves: rhbz#2060109
2022-05-06 12:19:26 +02:00

60 lines
1.3 KiB
RPMSpec

Name: python-userpath
Version: 1.8.0
Release: 1%{?dist}
Summary: Cross-platform tool for adding locations to the user PATH
License: MIT
URL: https://github.com/ofek/userpath
Source: %{pypi_source userpath}
BuildArch: noarch
BuildRequires: python3-devel
%description
This package uses hatchling as build backend.
This package is tested because:
- the prepare_metadata_for_build_wheel hook does not exist,
%%pyproject_buildrequires -w is used
https://github.com/ofek/hatch/issues/128
- the licenses are stored in a dist-info subdirectory
https://bugzilla.redhat.com/1985340
(as of hatchling 0.22.0, not yet marked as License-File)
%package -n python3-userpath
Summary: %{summary}
%description -n python3-userpath
...
%if 0%{?fedora} > 35
# On Fedora 35 or EPEL, we don't have hatchling yet, so this entire spec file builds nothing
%prep
%autosetup -p1 -n userpath-%{version}
sed -Ei '/^(coverage)$/d' requirements-dev.txt
%generate_buildrequires
%pyproject_buildrequires requirements-dev.txt -w
## %%pyproject_buildrequires -w makes this redundant:
# %%build
# %%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files userpath
%check
%pytest
%files -n python3-userpath -f %{pyproject_files}
%{_bindir}/userpath
%endif