diff --git a/.gitignore b/.gitignore index 8d7ae02..bff7676 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1 @@ /orjson-3.8.10.tar.gz -/orjson-3.8.11.tar.gz -/orjson-3.8.12.tar.gz -/orjson-3.8.14.tar.gz -/orjson-3.9.2.tar.gz -/orjson-3.9.7.tar.gz -/orjson-3.9.8.tar.gz -/orjson-3.9.10.tar.gz -/orjson-3.9.12.tar.gz -/orjson-3.9.13.tar.gz -/orjson-3.10.1.tar.gz -/orjson-3.10.3.tar.gz -/orjson-3.10.6.tar.gz -/orjson-3.10.7.tar.gz -/orjson-3.10.10.tar.gz -/orjson-3.10.11.tar.gz -/orjson-3.10.12.tar.gz -/orjson-3.10.13.tar.gz -/orjson-3.10.14.tar.gz -/orjson-3.10.16.tar.gz -/orjson-3.10.18.tar.gz -/orjson-3.11.0.tar.gz -/orjson-3.11.0-filtered.tar.xz -/orjson-3.11.1-filtered.tar.xz -/orjson-3.11.2-filtered.tar.xz -/orjson-3.11.3-filtered.tar.xz -/orjson-3.11.4-filtered.tar.xz diff --git a/Remove-unstable-simd-feature.patch b/Remove-unstable-simd-feature.patch new file mode 100644 index 0000000..5c845c6 --- /dev/null +++ b/Remove-unstable-simd-feature.patch @@ -0,0 +1,30 @@ +From 9fdfb7e06d1f8c193c476a8bb7b12e3ba7952b51 Mon Sep 17 00:00:00 2001 +From: Maxwell G +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 + diff --git a/Use-setuptools-rust-instead-of-maturin.patch b/Use-setuptools-rust-instead-of-maturin.patch new file mode 100644 index 0000000..41f6076 --- /dev/null +++ b/Use-setuptools-rust-instead-of-maturin.patch @@ -0,0 +1,59 @@ +From d464faa67a06b4277e315e2ea0c35c32f6832025 Mon Sep 17 00:00:00 2001 +From: Maxwell G +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 + diff --git a/changelog b/changelog deleted file mode 100644 index a07230a..0000000 --- a/changelog +++ /dev/null @@ -1,61 +0,0 @@ -* Mon Jul 22 2024 Benjamin A. Beasley - 3.10.6-1 -- Update to 3.10.6. Fixes rhbz#2291190. - -* Fri Jul 19 2024 Fedora Release Engineering - 3.10.3-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Sat Jun 08 2024 Python Maint - 3.10.3-2 -- Rebuilt for Python 3.13 - -* Sat Jun 01 2024 Benjamin A. Beasley - 3.10.3-1 -- Update to 3.10.3. Fixes rhbz#2278078. - -* Fri May 24 2024 Benjamin A. Beasley - 3.10.1-2 -- Rebuild with Rust 1.78 to fix incomplete debuginfo and backtraces - -* Mon Apr 15 2024 Maxwell G - 3.10.1-1 -- Update to 3.10.1. Fixes rhbz#2264126. - -* Tue Feb 6 2024 Maxwell G - 3.9.13-1 -- Update to 3.9.13. Fixes rhbz#2262570. - -* Fri Jan 26 2024 Fedora Release Engineering - 3.9.12-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Mon Jan 22 2024 Fedora Release Engineering - 3.9.12-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Jan 18 2024 Maxwell G - 3.9.12-1 -- Update to 3.9.12. Fixes rhbz#2259025. - -* Wed Nov 22 2023 Maxwell G - 3.9.10-1 -- Update to 3.9.10. Fixes rhbz#2243767. - -* Tue Oct 10 2023 Maxwell G - 3.9.8-1 -- Update to 3.9.8. Fixes rhbz#2229530. - -* Tue Jul 25 2023 Tomáš Hrnčiar - 3.9.2-2 -- Backport patch to add PyType_GetDict for Python 3.12 -- Fixes: rhbz#2220383 - -* Fri Jul 21 2023 Maxwell G - 3.9.2-1 -- Update to 3.9.2. Fixes rhbz#2211703. - -* Fri Jul 21 2023 Maxwell G - 3.8.14-1 -- Update to 3.8.14. - -* Fri Jul 21 2023 Fedora Release Engineering - 3.8.12-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Jun 27 2023 Python Maint - 3.8.12-2 -- Rebuilt for Python 3.12 - -* Thu May 18 2023 Maxwell G - 3.8.12-1 -- Update to 3.8.12. -- Use maturin as a build system when available - -* Fri May 5 2023 Maxwell G - 3.8.11-1 -- Update to 3.8.11. Fixes rhbz#2193468. - -* Wed Apr 12 2023 Maxwell G - 3.8.10-1 -- Initial package (rhbz#2184237). diff --git a/don-t-use-vendored-pyo3-build-config-and-pyo3-ffi.patch b/don-t-use-vendored-pyo3-build-config-and-pyo3-ffi.patch new file mode 100644 index 0000000..57837a9 --- /dev/null +++ b/don-t-use-vendored-pyo3-build-config-and-pyo3-ffi.patch @@ -0,0 +1,34 @@ +From be3e97b9899bd8d37ffc664ab8c7d876c0a2ac2e Mon Sep 17 00:00:00 2001 +From: Maxwell G +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 + diff --git a/get_source b/get_source deleted file mode 100755 index 5067989..0000000 --- a/get_source +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -set -o errexit -set -o nounset - -if [ "$#" != '1' ] -then - cat 1>&2 < Downloading: ${URL}" 1>&2 -curl -L -O "${URL}" - -ARCHIVE="$(find . -mindepth 1 -maxdepth 1 -type f -name '*.tar.gz' -print -quit)" -echo "--> Extracting: $(basename "${ARCHIVE}")" 1>&2 -tar -xzf "${ARCHIVE}" -echo '--> Removing data/ due to licensing issues' 1>&2 -TARDIR="$(basename "${ARCHIVE}" '.tar.gz')" -MTIME="$(stat -c '%Y' "${TARDIR}")" -rm -rvf "${TARDIR}/data/" -# Make sure the original mtime is preserved even though we modified the base -# directory by removing something at the top level. -touch -d @"${MTIME}" "${TARDIR}" -FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.xz" -echo "--> Re-archiving: ${FILTERED}" 1>&2 -# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html -TZ=UTC LC_ALL=C tar \ - --create --verbose \ - --sort=name \ - --format=posix \ - --numeric-owner --owner=0 --group=0 \ - --mode=go+u,go-w \ - --pax-option='delete=atime,delete=ctime' \ - "${TARDIR}/" | - xz -9e > "${FILTERED}" -mv -v "${FILTERED}" "${OUTDIR}" -echo 'Done.' 1>&2 diff --git a/python-orjson.spec b/python-orjson.spec index 33e673e..23490ec 100644 --- a/python-orjson.spec +++ b/python-orjson.spec @@ -3,67 +3,29 @@ # Copyright (c) 2023 Maxwell G # Copyright (c) Fedora Project Authors -# Specfile compatability: EPEL >= 9 or Fedora >= 37 and RPM >= 4.16 - %bcond tests 1 -# Not yet in EPEL10: https://bugzilla.redhat.com/show_bug.cgi?id=2356387 -%bcond pendulum %{undefined el10} Name: python-orjson -Version: 3.11.4 -Release: %autorelease +Version: 3.8.10 +Release: 1%{?dist} Summary: Fast, correct Python JSON library -# The entire source is (Apache-2.0 OR MIT), except: -# -# MIT: -# - include/yyjson/yyjson.c -# - include/yyjson/yyjson.h -# -# Apache-2.0: -# - src/serialize/writer/str/mod.rs -# - src/serialize/writer/str/sse2.rs -License: (Apache-2.0 OR MIT) AND Apache-2.0 AND MIT +License: Apache-2.0 OR MIT URL: https://github.com/ijl/orjson -# We must be careful about the source archive. -# -# The PyPI releases have a vendored Rust dependency bundle in include/cargo/, -# which we would remove in %%prep, but which we must still check to make sure -# everything has a license acceptable for distribution in Fedora before -# uploading to the lookaside cache. -# Source: %%{pypi_source orjson} -# The GitHub archives from -# %%{url}/archive/%%{version}/orjson-%%{version}.tar.gz do not have the -# vendored crates, but they contain benchmark data in data/, some of which is -# lacking its license text (e.g. data/blns.txt.xz, which is from -# https://github.com/minimaxir/big-list-of-naughty-strings and should carry the -# corresponding MIT license text), and some of which looks like it might have -# at best unclear license status. Since the benchmark data is potentially -# problematic, we would need to filter the GitHub archives with a script. -Source0: orjson-%{version}-filtered.tar.xz -# ./get_source ${COMMIT} (or ${TAG}) -Source1: get_source +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: tomcli BuildRequires: python3-devel -BuildRequires: %{py3_dist pytest-forked} -# Upstream restricts these test dependencies to particular Python interpreter -# versions and architectures, but we would like to run the corresponding tests -# everywhere. -BuildRequires: %{py3_dist numpy} -%if %{with pendulum} -BuildRequires: %{py3_dist pendulum} -%endif -# These are not in tests/requirements.txt, but they enable additional tests -%ifnarch %{ix86} -BuildRequires: %{py3_dist pandas} -%endif -BuildRequires: %{py3_dist psutil} -BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: rust-packaging %global _description %{expand: -orjson is a fast, correct Python JSON library supporting dataclasses, +orjosn is a fast, correct Python JSON library supporting dataclasses, datetimes, and numpy} @@ -71,61 +33,58 @@ datetimes, and numpy} %package -n python3-orjson Summary: %{summary} -# Output of %%{cargo_license_summary}: -# -# (Apache-2.0 OR MIT) AND BSD-3-Clause -# Apache-2.0 OR BSL-1.0 -# Apache-2.0 OR MIT -# BSD-2-Clause OR Apache-2.0 OR MIT -# BSL-1.0 -# MIT -# MIT OR Apache-2.0 -# Unlicense OR MIT -# -# Note that this must include the terms of the base package License expression. -License: %{shrink: - (Apache-2.0 OR MIT) AND - Apache-2.0 AND - (Apache-2.0 OR BSL-1.0) AND - (Apache-2.0 OR BSD-2-Clause OR MIT) AND - BSD-3-Clause AND - BSL-1.0 AND - MIT AND - (Unlicense OR MIT) - } +# 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 -# Version from YYJSON_VERSION_STRING in include/yyjson/yyjson.h -# -# Since version 3.11.4, orjson unconditionally uses a bundled copy of the C -# library yyjson, https://github.com/ibireme/yyjson, as the JSON -# deserialization backend. It is forked (customized) and compiled with a -# particular set of options via preprocessor defines (see build.rs), so it is -# not a candidate for unbundling. (Prior to version 3.11.4, this could be -# disabled, and the json crate from the Rust standard library, -# https://docs.rs/json, would be used instead, but this is no longer -# supported.) -Provides: bundled(yyjson) = 0.9.0 %description -n python3-orjson %{_description} %prep %autosetup -p1 -n orjson-%{version} -%cargo_prep -# Remove unwind feature, which is not useful here: the comment above it says -# “Avoid bundling libgcc on musl.” -tomcli-set Cargo.toml del 'features.unwind' -tomcli-set Cargo.toml del 'dependencies.unwinding' +# Replaces @@VERSION@@ placeholder in pyproject.toml with the value of %%version. +%writevars -f pyproject.toml version -%if %{without pendulum} -sed -i '/^pendulum\b/d' test/requirements.txt +%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 < setup.cfg +[metadata] +name = orjson +version = %{version} + +[options] +packages = orjson +EOF +sed -i 's|setuptools>=61.0|setuptools|' pyproject.toml %endif -# Test dependency on arrow appears spurious -# https://github.com/ijl/orjson/issues/559 -sed -i '/^arrow\b/d' test/requirements.txt -# Remove unpackaged PyPI plugin -sed -i '/pytest-random-order/d' test/requirements.txt + +# Remove bundled yyjson. +rm -rv include/yyjson/ + +%cargo_prep %generate_buildrequires @@ -142,21 +101,21 @@ export RUSTFLAGS='%{build_rustflags}' %install %pyproject_install -%pyproject_save_files -l orjson +%pyproject_save_files orjson %check %pyproject_check_import %if %{with tests} -# --forked: protect the pytest process against test segfaults -# -rs: print the reasons for skipped tests -%pytest --forked -rs +%pytest -vv %endif %files -n python3-orjson -f %{pyproject_files} +%license LICENSE-MIT LICENSE-APACHE LICENSES.dependencies %doc README.md %changelog -%autochangelog +* Wed Apr 12 2023 Maxwell G - 3.8.10-1 +- Initial package (rhbz#2184237). diff --git a/sources b/sources index 18ca5d3..771f779 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (orjson-3.11.4-filtered.tar.xz) = 1a457a91dfa1918341acfebcdb86ddf92b5776f166be9dbd16a4253f55140ae0bc90f911ceb3a9b33abd963be22f089aa2764b25e1701691298c0e8840c8225a +SHA512 (orjson-3.8.10.tar.gz) = 68828e9b4dc2c8e2c8675ece61e366e38f027a7eb3058d0ed1f3a65916964ae67bbb11fcea3414c330841b79208fe52b2c18263493f09092c50d73ac0b549720