python-hatchling/python-hatchling.spec

84 lines
2.3 KiB
RPMSpec
Raw Normal View History

2022-02-20 16:17:55 +00:00
Name: python-hatchling
2022-02-23 20:56:54 +00:00
Version: 0.15.0
2022-02-20 16:17:55 +00:00
Release: %autorelease
Summary: The build backend used by Hatch
License: MIT
URL: https://pypi.org/project/hatchling
Source0: %{pypi_source hatchling}
2022-02-20 16:18:12 +00:00
# Man page in groff_man(7) format, hand-written for Fedora based on package
# metadata and --help output
2022-02-20 16:17:55 +00:00
Source1: hatchling.1
# Based on https://github.com/hukkin/tomli/blob/2.0.0/CHANGELOG.md#200, we
# should be able to use tomli 1.2.2 until
# https://bugzilla.redhat.com/show_bug.cgi?id=2032020 is closed.
#
# It doesnt make sense to upstream this, as it really would be better to use a
# current release.
Patch: hatchling-0.11.0-allow-tomli-1.2.2.patch
BuildArch: noarch
BuildRequires: python3-devel
%global common_description %{expand:
This is the extensible, standards compliant build backend used by Hatch.}
%description %{common_description}
%package -n python3-hatchling
Summary: %{summary}
%description -n python3-hatchling %{common_description}
%prep
%autosetup -n hatchling-%{version} -p1
%generate_buildrequires
# Cannot use -r (the default) with hatchling: “ValueError: build backend cannot
# provide build metadata (incl. runtime requirements) before build”. We work
# around this by writing the dependencies from src/hatchling/ourobororos.py
# into a text file.
PYTHONPATH="${PWD}/src" '%{python3}' <<EOF
from hatchling.ouroboros import CONFIG
deps = CONFIG['project']['dependencies']
with open('requirements.ouroboros.txt', 'w') as reqfile:
reqfile.writelines(f'{dep}\n' for dep in deps)
EOF
%pyproject_buildrequires -R requirements.ouroboros.txt
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files hatchling
install -t '%{buildroot}/%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}'
2022-02-20 16:17:55 +00:00
%check
# Its not yet clear how, or if, we can run the upstream tests.
# https://github.com/ofek/hatch/issues/120
%pyproject_check_import
%files -n python3-hatchling -f %{pyproject_files}
# The license file is installed in an unusual subdirectory:
%dir %{python3_sitelib}/hatchling-%{version}.dist-info/license_files
%license %{python3_sitelib}/hatchling-%{version}.dist-info/license_files/LICENSE.txt
%doc README.md
%{_bindir}/hatchling
%{_mandir}/man1/hatchling.1*
%changelog
%autochangelog