Remove setuptools_rust patch

maturin is now packaged for all stable Fedora releases.
This commit is contained in:
Maxwell G 2023-07-04 19:51:05 +00:00 committed by Tomáš Hrnčiar
commit 0ceb97925f
2 changed files with 1 additions and 89 deletions

View file

@ -1,81 +0,0 @@
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
Maturin is not packaged for Fedora. We can use setuptools-rust instead.
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 | 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..1e48b88 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,5 @@
[project]
name = "orjson"
-repository = "https://github.com/ijl/orjson"
requires-python = ">=3.7"
classifiers = [
"Development Status :: 5 - Production/Stable",
@@ -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", "tomli; python_version<'3.11'"]
[tool.maturin]
python-source = "pysrc"
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..63f263d
--- /dev/null
+++ b/setup.py
@@ -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 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

View file

@ -6,7 +6,6 @@
# 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.14
@ -19,10 +18,6 @@ Source: %{pypi_source orjson}
# 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
@ -68,9 +63,7 @@ License: (Apache-2.0 OR MIT) AND (Apache-2.0 OR BSL-1.0) AND BSD-3-Clause
%prep
%autosetup -p1 -n orjson-%{version} -N
%autopatch -M 4999
%{!?with_maturin:%autopatch -m5000 -M5000 -p1}
%autosetup -p1 -n orjson-%{version}
# Remove bundled yyjson.
rm -rv include/yyjson/