use maturin when possible; simplify setuptools_rust patch
This commit is contained in:
parent
4d77fdb3c2
commit
7b6d29ed58
3 changed files with 49 additions and 34 deletions
|
|
@ -1,4 +1,4 @@
|
|||
From e9f52399252765535db5ed946b00c9ce0be11964 Mon Sep 17 00:00:00 2001
|
||||
From 8cb9c84fadfc490ec88665f0ab4871c2d7255738 Mon Sep 17 00:00:00 2001
|
||||
From: Maxwell G <gotmax@e.email>
|
||||
Date: Wed, 25 Jan 2023 20:30:13 -0600
|
||||
Subject: [PATCH] Remove unstable-simd feature
|
||||
|
|
@ -9,7 +9,7 @@ This feature requires nightly Rust.
|
|||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 8c7a50b..1a7a300 100644
|
||||
index fbd45a4..09724ce 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -32,12 +32,6 @@ crate-type = ["cdylib"]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
From 9aa0036fa5c5bbcc346ab54b100ced22460d0672 Mon Sep 17 00:00:00 2001
|
||||
From 37abb055e3435406156c6e4462b2a58923c9f11a Mon Sep 17 00:00:00 2001
|
||||
From: Maxwell G <gotmax@e.email>
|
||||
Date: Wed, 25 Jan 2023 13:47:35 -0600
|
||||
Subject: [PATCH] Use setuptools-rust instead of maturin
|
||||
|
|
@ -9,48 +9,72 @@ This requires setutpools >= 61.0 which is available on F37+. The
|
|||
metadata in the [project] table can be translated to a setup.cfg or
|
||||
added to setup.py for greater compatibility.
|
||||
---
|
||||
pyproject.toml | 6 +++---
|
||||
setup.py | 9 +++++++++
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
pyproject.toml | 9 ++++++---
|
||||
setup.py | 28 ++++++++++++++++++++++++++++
|
||||
2 files changed, 34 insertions(+), 3 deletions(-)
|
||||
create mode 100644 setup.py
|
||||
|
||||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index 8372fc8..9f07b95 100644
|
||||
index 8372fc8..1e48b88 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -1,6 +1,6 @@
|
||||
@@ -1,6 +1,5 @@
|
||||
[project]
|
||||
name = "orjson"
|
||||
-repository = "https://github.com/ijl/orjson"
|
||||
+version = "@@VERSION@@"
|
||||
requires-python = ">=3.7"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
@@ -24,8 +24,8 @@ classifiers = [
|
||||
@@ -22,10 +21,14 @@ classifiers = [
|
||||
"Programming Language :: Rust",
|
||||
"Typing :: Typed",
|
||||
]
|
||||
+dynamic = [
|
||||
+ # version is dynamically defined in setup.py
|
||||
+ "version",
|
||||
+]
|
||||
|
||||
[build-system]
|
||||
-build-backend = "maturin"
|
||||
-requires = ["maturin>=0.13,<2"]
|
||||
+build-backend = "setuptools.build_meta"
|
||||
+requires = ["setuptools>=61.0", "setuptools-rust"]
|
||||
+requires = ["setuptools>=61.0", "setuptools-rust", "tomli; python_version<'3.11'"]
|
||||
|
||||
[tool.maturin]
|
||||
python-source = "pysrc"
|
||||
diff --git a/setup.py b/setup.py
|
||||
new file mode 100644
|
||||
index 0000000..fb5a727
|
||||
index 0000000..63f263d
|
||||
--- /dev/null
|
||||
+++ b/setup.py
|
||||
@@ -0,0 +1,9 @@
|
||||
@@ -0,0 +1,28 @@
|
||||
+import sys
|
||||
+from pathlib import Path
|
||||
+
|
||||
+if sys.version_info[:2] >= (3, 11):
|
||||
+ import tomllib
|
||||
+else:
|
||||
+ import tomli as tomllib
|
||||
+
|
||||
+from setuptools import setup
|
||||
+from setuptools_rust import RustExtension, Binding
|
||||
+from setuptools_rust import Binding, RustExtension
|
||||
+
|
||||
+HERE = Path(__file__).resolve().parent
|
||||
+
|
||||
+with (HERE / "Cargo.toml").open("rb") as fp:
|
||||
+ DATA = tomllib.load(fp)["package"]
|
||||
+
|
||||
+setup(
|
||||
+ # Can be removed once we no longer need a minimal build for setuptools < 61.
|
||||
+ # This is duplicated in pyproject.toml's [project] table
|
||||
+ name="orjson",
|
||||
+ packages=["orjson"],
|
||||
+ #
|
||||
+ rust_extensions=[
|
||||
+ RustExtension("orjson.orjson", binding=Binding.NoBinding, args=["--offline"])
|
||||
+ ],
|
||||
+ package_dir={"": "pysrc"},
|
||||
+ version=DATA["version"],
|
||||
+)
|
||||
--
|
||||
2.40.1
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue