a9bc99e47f
RHEL does not include individual Rust crate dependencies. Also, python-hypothesis is not available in RHEL, but the tests proceed without it.
88 lines
2.0 KiB
RPMSpec
88 lines
2.0 KiB
RPMSpec
%global srcname rpds-py
|
|
%global modname rpds_py
|
|
|
|
Name: python-rpds-py
|
|
Version: 0.9.2
|
|
Release: %autorelease
|
|
Summary: Python bindings to the Rust rpds crate
|
|
# Full license breakdown in LICENSES.dependencies
|
|
License: MIT AND Apache-2.0 AND (MIT OR Apache-2.0) AND MPL-2.0
|
|
URL: https://github.com/crate-py/rpds
|
|
Source0: %{pypi_source %{modname}}
|
|
# To create the vendor tarball:
|
|
# tar xf %%{name}-%%{version}.crate ; pushd %%{name}-%%{version} ; \
|
|
# patch -p1 < ../bump-dependencies.patch && \
|
|
# cargo vendor && tar Jcvf ../%%{name}-%%{version}-vendor.tar.xz vendor/ ; pushd
|
|
Source1: %{modname}-%{version}-vendor.tar.xz
|
|
|
|
# Bump archery and rpds dependencies to v1.0.0
|
|
Patch: bump-dependencies.patch
|
|
|
|
%if 0%{?rhel}
|
|
BuildRequires: rust-toolset
|
|
%else
|
|
BuildRequires: cargo-rpm-macros
|
|
%endif
|
|
BuildRequires: dos2unix
|
|
BuildRequires: python3-devel
|
|
BuildRequires: python3-pytest
|
|
|
|
%global _description %{expand:
|
|
Python bindings to the Rust rpds crate.}
|
|
|
|
%description %_description
|
|
|
|
%package -n python3-%{srcname}
|
|
Summary: %{summary}
|
|
|
|
%description -n python3-%{srcname} %_description
|
|
|
|
|
|
%prep
|
|
%autosetup -p1 -n %{modname}-%{version}
|
|
|
|
# Fix line terminations
|
|
dos2unix README* LICENSE* *.pyi
|
|
|
|
# Remove an unused test dependency on hypothesis
|
|
# Namely to avoid pulling it in RHEL,
|
|
# but also to avoid an unnecessary build dependency in general
|
|
# Proposed upstream as https://github.com/crate-py/rpds/pull/25
|
|
# The patch does not apply cleanly, we sed it out instead
|
|
sed -i '/hypothesis/d' tests/requirements.in
|
|
|
|
%cargo_prep %{?rhel:-V 1}
|
|
|
|
|
|
%generate_buildrequires
|
|
%pyproject_buildrequires tests/requirements.in
|
|
%if %{undefined rhel}
|
|
%cargo_generate_buildrequires
|
|
%endif
|
|
|
|
|
|
%build
|
|
export RUSTFLAGS='%{build_rustflags}'
|
|
%{?cargo_license_summary}
|
|
%{?cargo_license} > LICENSES.dependencies
|
|
%pyproject_wheel
|
|
|
|
|
|
%install
|
|
%pyproject_install
|
|
|
|
%pyproject_save_files rpds
|
|
|
|
|
|
%check
|
|
%pytest -vv
|
|
|
|
|
|
%files -n python3-%{srcname} -f %{pyproject_files}
|
|
%license LICENSE LICENSES.dependencies
|
|
%doc README.rst
|
|
|
|
|
|
%changelog
|
|
%autochangelog
|