use maturin when possible; simplify setuptools_rust patch

This commit is contained in:
Maxwell G 2023-05-18 22:41:43 +00:00
commit 7b6d29ed58
No known key found for this signature in database
GPG key ID: F79E4E25E8C661F8
3 changed files with 49 additions and 34 deletions

View file

@ -3,7 +3,10 @@
# Copyright (c) 2023 Maxwell G <maxwell@gtmx.me>
# Copyright (c) Fedora Project Authors
# Specfile compatability: EPEL >= 9 or Fedora >= 37 and RPM >= 4.16
%bcond tests 1
%bcond maturin %[ 0%{?fedora} >= 39 ]
Name: python-orjson
Version: 3.8.12
@ -14,10 +17,12 @@ License: Apache-2.0 OR MIT
URL: https://github.com/ijl/orjson
Source: %{pypi_source orjson}
# Ineligble for upstreaming
Patch: Use-setuptools-rust-instead-of-maturin.patch
# Ineligble for upstreaming
Patch: Remove-unstable-simd-feature.patch
# Ineligble for upstreaming
# Used when maturin bcond is disabled
Patch5000: Use-setuptools-rust-instead-of-maturin.patch
BuildRequires: python3-devel
BuildRequires: rust-packaging
@ -63,24 +68,9 @@ License: (Apache-2.0 OR MIT) AND (Apache-2.0 OR BSL-1.0) AND BSD-3-Clause
%prep
%autosetup -p1 -n orjson-%{version}
# Replaces @@VERSION@@ placeholder in pyproject.toml with the value of %%version.
%writevars -f pyproject.toml version
%if 0%{?fedora} && 0%{?fedora} <= 36
# Minimal setup.cfg for Fedora 36's old setuptools that doesn't support PEP 621
# (i.e. it doesn't understand metadata in pyproject.toml's [project] table)
cat <<EOF > setup.cfg
[metadata]
name = orjson
version = %{version}
[options]
packages = orjson
EOF
sed -i 's|setuptools>=61.0|setuptools|' pyproject.toml
%endif
%autosetup -p1 -n orjson-%{version} -N
%autopatch -M 4999
%{!?with_maturin:%autopatch -m5000 -M5000 -p1}
# Remove bundled yyjson.
rm -rv include/yyjson/
@ -120,6 +110,7 @@ export RUSTFLAGS='%{build_rustflags}'
%changelog
* Thu May 18 2023 Maxwell G <maxwell@gtmx.me> - 3.8.12-1
- Update to 3.8.12.
- Use maturin as a build system when available
* Fri May 5 2023 Maxwell G <maxwell@gtmx.me> - 3.8.11-1
- Update to 3.8.11. Fixes rhbz#2193468.