Initial package (rhbz#2184237).

This commit is contained in:
Maxwell G 2023-04-13 13:59:15 +00:00
commit 005d4fc347
No known key found for this signature in database
GPG key ID: F79E4E25E8C661F8
6 changed files with 246 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/orjson-3.8.10.tar.gz

View file

@ -0,0 +1,30 @@
From 9fdfb7e06d1f8c193c476a8bb7b12e3ba7952b51 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
This feature requires nightly Rust.
---
Cargo.toml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 1822ce4..511acb0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,12 +32,6 @@ crate-type = ["cdylib"]
[features]
default = []
-# Use SIMD intrinsics. This requires Rust on the nightly channel.
-unstable-simd = [
- "bytecount/generic-simd",
- "encoding_rs/simd-accel",
-]
-
# Build yyjson as a backend and panic if it fails. The default is to attempt
# to build and on failure fall back to another backend.
yyjson = []
--
2.39.2

View file

@ -0,0 +1,59 @@
From d464faa67a06b4277e315e2ea0c35c32f6832025 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 | 6 +++---
setup.py | 11 +++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
create mode 100644 setup.py
diff --git a/pyproject.toml b/pyproject.toml
index 8372fc8..9f07b95 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[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 = [
]
[build-system]
-build-backend = "maturin"
-requires = ["maturin>=0.13,<2"]
+build-backend = "setuptools.build_meta"
+requires = ["setuptools>=61.0", "setuptools-rust"]
[tool.maturin]
python-source = "pysrc"
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..98c881f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,11 @@
+import sys
+
+from setuptools import setup
+from setuptools_rust import RustExtension, Binding
+
+setup(
+ rust_extensions=[
+ RustExtension("orjson.orjson", binding=Binding.NoBinding, args=["--offline"])
+ ],
+ package_dir={"": "pysrc"},
+)
--
2.39.2

View file

@ -0,0 +1,34 @@
From be3e97b9899bd8d37ffc664ab8c7d876c0a2ac2e Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
Date: Wed, 12 Apr 2023 14:53:32 +0000
Subject: [PATCH] don't use vendored pyo3-build-config and pyo3-ffi
---
Cargo.toml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 511acb0..db08a4e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -48,7 +48,7 @@ encoding_rs = { version = "0.8", default_features = false }
itoa = { version = "1", default_features = false }
itoap = { version = "1", features = ["std", "simd"] }
once_cell = { version = "1", default_features = false, features = ["race"] }
-pyo3-ffi = { path = "local_dependencies/pyo3-ffi", default_features = false, features = ["extension-module"]}
+pyo3-ffi = { version="0.18.2", default_features = false, features = ["extension-module"] }
ryu = { version = "1", default_features = false }
serde = { version = "1", default_features = false }
serde_json = { version = "1", default_features = false, features = ["std", "float_roundtrip"] }
@@ -57,7 +57,7 @@ smallvec = { version = "^1.10", default_features = false, features = ["union", "
[build-dependencies]
cc = { version = "1" }
-pyo3-build-config = { path = "local_dependencies/pyo3-build-config" }
+pyo3-build-config = { version = "0.18.2" }
version_check = { version = "0.9" }
[profile.release]
--
2.39.2

121
python-orjson.spec Normal file
View file

@ -0,0 +1,121 @@
# SPDX-License-Identifier: MIT
# License text: https://spdx.org/licenses/MIT.html
# Copyright (c) 2023 Maxwell G <maxwell@gtmx.me>
# Copyright (c) Fedora Project Authors
%bcond tests 1
Name: python-orjson
Version: 3.8.10
Release: 1%{?dist}
Summary: Fast, correct Python JSON library
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
# https://github.com/ijl/orjson/issues/373
Patch: don-t-use-vendored-pyo3-build-config-and-pyo3-ffi.patch
BuildRequires: python3-devel
BuildRequires: rust-packaging
%global _description %{expand:
orjosn is a fast, correct Python JSON library supporting dataclasses,
datetimes, and numpy}
%description %{_description}
%package -n python3-orjson
Summary: %{summary}
# Apache-2.0 OR MIT: orjson itself
# (Apache-2.0 OR MIT) AND BSD-3-Clause: encoding_rs v0.8.32
# Apache-2.0 OR BSL-1.0: ryu v1.0.13
# Apache-2.0 OR MIT: bytecount v0.6.3
# Apache-2.0 OR MIT: orjson v3.8.9
# Apache-2.0: pyo3-ffi v0.18.2
# MIT OR Apache-2.0: ahash v0.8.3
# MIT OR Apache-2.0: arrayvec v0.7.2
# MIT OR Apache-2.0: associative-cache v1.0.1
# MIT OR Apache-2.0: beef v0.5.2
# MIT OR Apache-2.0: cfg-if v1.0.0
# MIT OR Apache-2.0: chrono v0.4.24
# MIT OR Apache-2.0: itoa v1.0.6
# MIT OR Apache-2.0: libc v0.2.140
# MIT OR Apache-2.0: num-integer v0.1.45
# MIT OR Apache-2.0: num-traits v0.2.15
# MIT OR Apache-2.0: once_cell v1.17.1
# MIT OR Apache-2.0: serde v1.0.159
# MIT OR Apache-2.0: serde_json v1.0.95
# MIT OR Apache-2.0: simdutf8 v0.1.4
# MIT OR Apache-2.0: smallvec v1.10.0
# MIT OR Apache-2.0: static_assertions v1.1.0
License: (Apache-2.0 OR MIT) AND (Apache-2.0 OR BSL-1.0) AND BSD-3-Clause AND Apache-2.0
%description -n python3-orjson %{_description}
%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
# Remove bundled yyjson.
rm -rv include/yyjson/
%cargo_prep
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:test/requirements.txt}
%cargo_generate_buildrequires
%build
export RUSTFLAGS='%{build_rustflags}'
%cargo_license_summary
%{cargo_license} > LICENSES.dependencies
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files orjson
%check
%pyproject_check_import
%if %{with tests}
%pytest -vv
%endif
%files -n python3-orjson -f %{pyproject_files}
%license LICENSE-MIT LICENSE-APACHE LICENSES.dependencies
%doc README.md
%changelog
* Wed Apr 12 2023 Maxwell G <maxwell@gtmx.me> - 3.8.10-1
- Initial package (rhbz#2184237).

1
sources Normal file
View file

@ -0,0 +1 @@
SHA512 (orjson-3.8.10.tar.gz) = 68828e9b4dc2c8e2c8675ece61e366e38f027a7eb3058d0ed1f3a65916964ae67bbb11fcea3414c330841b79208fe52b2c18263493f09092c50d73ac0b549720