summaryrefslogtreecommitdiff
path: root/dev-python/backports-zstd
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/backports-zstd')
-rw-r--r--dev-python/backports-zstd/Manifest2
-rw-r--r--dev-python/backports-zstd/backports-zstd-1.0.0.ebuild51
-rw-r--r--dev-python/backports-zstd/files/backports-zstd-1.0.0-py313.patch31
-rw-r--r--dev-python/backports-zstd/metadata.xml11
4 files changed, 95 insertions, 0 deletions
diff --git a/dev-python/backports-zstd/Manifest b/dev-python/backports-zstd/Manifest
new file mode 100644
index 000000000000..d57e773fbfa9
--- /dev/null
+++ b/dev-python/backports-zstd/Manifest
@@ -0,0 +1,2 @@
+DIST backports_zstd-1.0.0.tar.gz 995991 BLAKE2B 6aa424ac191db255ed93e31a0c23c3645af1c67120f6e3c5757d4f4d8479d4a448e43c4d96d8c8c075307d7e8840f9aa380dd6940574240c86e55a3e96a1f62b SHA512 efeab141279ed2b0ab4eda3a32685c3da0fbc970c34bea63694b0d23c378a2c9661ad29cc6059edf9d89929f70e9b25e0f527b4b58ede0bbb64a24ca369c5fa0
+DIST backports_zstd-1.0.0.tar.gz.provenance 9489 BLAKE2B 6e9d39b29faae7a72934f14070db60b5e8464555cc77005e02088a8c0d53fd870e1c2e1d63eee8658d48ae569dcf6de1fd5ffaa81527fd1317189c06d29397db SHA512 87047ee17a00df0f6173d49131ec033f7811b825c0d95611bfde9a52d4a3248b94a2960f5bb55b4df75ad9b15502294d68d7f3ae0730b33d19e8dd6fa1fee328
diff --git a/dev-python/backports-zstd/backports-zstd-1.0.0.ebuild b/dev-python/backports-zstd/backports-zstd-1.0.0.ebuild
new file mode 100644
index 000000000000..f94e1528850d
--- /dev/null
+++ b/dev-python/backports-zstd/backports-zstd-1.0.0.ebuild
@@ -0,0 +1,51 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYPI_PN=${PN/-/.}
+PYPI_VERIFY_REPO=https://github.com/Rogdham/backports.zstd
+PYTHON_COMPAT=( pypy3_11 python3_{11..13} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Backport of PEP-784: adding Zstandard to the standard library"
+HOMEPAGE="
+ https://github.com/Rogdham/backports.zstd/
+ https://pypi.org/project/backports.zstd/
+"
+
+LICENSE="PSF-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="
+ app-arch/zstd:=
+"
+RDEPEND="
+ ${DEPEND}
+"
+
+distutils_enable_tests unittest
+
+src_prepare() {
+ local PATCHES=(
+ # https://github.com/Rogdham/backports.zstd/pull/54
+ "${FILESDIR}/${P}-py313.patch"
+ )
+
+ distutils-r1_src_prepare
+
+ # remove -flto and other forced cflags
+ sed -i -e 's:kwargs\["extra.*:pass:' setup.py || die
+
+ DISTUTILS_ARGS=(
+ --system-zstd
+ )
+}
+
+python_test() {
+ eunittest tests
+}
diff --git a/dev-python/backports-zstd/files/backports-zstd-1.0.0-py313.patch b/dev-python/backports-zstd/files/backports-zstd-1.0.0-py313.patch
new file mode 100644
index 000000000000..37cbfef8570f
--- /dev/null
+++ b/dev-python/backports-zstd/files/backports-zstd-1.0.0-py313.patch
@@ -0,0 +1,31 @@
+From be7548ac9a08de3ae1a8cf3c47630336d65b656f Mon Sep 17 00:00:00 2001
+From: Rogdham <contact@rogdham.net>
+Date: Sun, 19 Oct 2025 09:06:31 +0200
+Subject: [PATCH] fix: assertions on 3.13
+
+---
+ src/c/compat/backports_zstd_edits.h | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/c/compat/backports_zstd_edits.h b/src/c/compat/backports_zstd_edits.h
+index 1e4b9f7..4cf076c 100644
+--- a/src/c/compat/backports_zstd_edits.h
++++ b/src/c/compat/backports_zstd_edits.h
+@@ -107,12 +107,14 @@ static inline int BACKPORTSZSTD_LOCK_isLocked(PyThread_type_lock *mp)
+ #define BACKPORTSZSTD_LOCK_lock PyMutex_Lock
+ #define BACKPORTSZSTD_LOCK_unlock PyMutex_Unlock
+ #define BACKPORTSZSTD_LOCK_free(l)
++#if PY_VERSION_HEX < 0x030E0000 // Python 3.13 and below
+ static inline int BACKPORTSZSTD_LOCK_isLocked(PyMutex *lp)
+ {
+- // note: this function is only used in asserts
+- // PyMutex_IsLocked is not exposed publicly https://github.com/python/cpython/issues/134009
+- Py_FatalError("Not implemented");
++ return (_Py_atomic_load_uint8(&lp->_bits) & _Py_LOCKED) != 0;
+ }
++#else // Python 3.14 and above
++#define BACKPORTSZSTD_LOCK_isLocked PyMutex_IsLocked
++#endif
+
+ #endif /* !BACKPORTSZSTD_LOCK */
+
diff --git a/dev-python/backports-zstd/metadata.xml b/dev-python/backports-zstd/metadata.xml
new file mode 100644
index 000000000000..46edd012472d
--- /dev/null
+++ b/dev-python/backports-zstd/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">Rogdham/backports.zstd</remote-id>
+ <remote-id type="pypi">backports.zstd</remote-id>
+ </upstream>
+</pkgmetadata>