dev-python/backports-zstd: Add from Gentoo

It's from Gentoo commit 5867e28cbfb4bf12ac5397e9dd35fd77dbfa1aab.

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
This commit is contained in:
Krzesimir Nowak 2026-03-05 19:17:04 +01:00
parent 74ba4c41ed
commit 1525d22c8f
7 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,8 @@
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
DIST backports_zstd-1.1.0.tar.gz 996020 BLAKE2B 63747df8cbbbc69f53cabae56708849915ba822ed20487fdec01887100ab07c2d342dc275e9c80e4d62078282aef9f7eb100846539ceed832448c20b4198722d SHA512 9a23debaa624f85996a5ddc91cb085531c43ebe92518e8c82bbb0bdca71bcbb96229af9bd245a109c6c554e9af00a822288b452ce68f62f7d3a332167d53669c
DIST backports_zstd-1.1.0.tar.gz.provenance 9395 BLAKE2B 8fa4bdf2e4c57926f897e0b1678b38b47f9097e2b788503b23ea366f6d6595ecdbb03739934d8bf8c494e4db9f4e9654760256b1a6cc6dcacb050852fea29c59 SHA512 165b5c10d2169f5a2f3d0315c77f965a720727d4616fcd539aa2bb1a026d35f11b9d6215e75d663604bcd129d95fbe78b690f4b363282175b2be4189b987bde4
DIST backports_zstd-1.2.0.tar.gz 997263 BLAKE2B 63cc3af77e9b5ef0fc14f4b3c8fcf20b2dafd8b28fc6177e954c4261134de8f72c1d3c09478158ec36c92b6f3b1553a10c68cbe5f23b2b01164c4b65c7266b70 SHA512 98f3962ad2628c7c032848a43cc1116e2cdb1e5ac7fadff640ecd7a36dee8ccfae0c230ef0297047bf6a54159e3493ac468888a9d1cf6e02594541473cd31352
DIST backports_zstd-1.2.0.tar.gz.provenance 9389 BLAKE2B 0c4fc2709b9cfb4fd614a21f4f660e786c3f8de250d08d77bbe8b4fff22ca4e8b541aff3f80166860b19e8fe76d6ad88be37bb4bd7977652b0ea4ef18efbccaa SHA512 109d3300d365d7ccbea6032f9d4e58fad9c46680489f474f7fea0b986e982ea0d0b1cf84f99096acb1758b4c984a700725c730a32da0d18c32f20b64df8f14e2
DIST backports_zstd-1.3.0.tar.gz 997138 BLAKE2B 17fc2627b1cd498e6e808ac62fa56aa744f9124df0c7954fa9f58ff2eceb201fc414afeaa67b92a74ad23eaac0f01199f276ac1b156a9462f0cacd4e9a64aa40 SHA512 f9318e5e86ca284e96d64e53b6ebe15b534c13f95ea2f8a36fb48189ce0690b3d8cd952ba69a369a7da555665786753d70bddb66b3aa43bcc04a654fb466d158
DIST backports_zstd-1.3.0.tar.gz.provenance 9389 BLAKE2B e6f8bcf6bc755e5e4f9d7e85adbb930018a761e37f2b0cde08905cc3cc0a5bd25ea75283f3012df84fd15a7be81d0708c9a5b202c72d2a8ce7ebbff0fed8958b SHA512 2c846b90a4049a1eef2cc5b4c89c0311f92513558cffae4bc918dd778f9648d13c854592ab7416b1b15f1942ff106b4d714905b9ffcd15746cad4fa60282fe8c

View File

@ -0,0 +1,54 @@
# 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="~alpha amd64 arm arm64 ~mips ppc ppc64 ~riscv x86"
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
)
# remove namespace file
rm src/python/backports/__init__.py || die
}
python_test() {
eunittest tests
}

View File

@ -0,0 +1,50 @@
# 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
# this is a backport from py3.14, so don't add it
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="~alpha amd64 arm arm64 ~mips ppc ppc64 ~riscv x86"
DEPEND="
app-arch/zstd:=
"
RDEPEND="
${DEPEND}
"
distutils_enable_tests unittest
src_prepare() {
distutils-r1_src_prepare
# remove -flto and other forced cflags
sed -i -e 's:kwargs\["extra.*:pass:' setup.py || die
DISTUTILS_ARGS=(
--system-zstd
)
# remove namespace file
rm src/python/backports/__init__.py || die
}
python_test() {
eunittest tests
}

View File

@ -0,0 +1,50 @@
# Copyright 2025-2026 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
# this is a backport from py3.14, so don't add it
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="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
DEPEND="
app-arch/zstd:=
"
RDEPEND="
${DEPEND}
"
distutils_enable_tests unittest
src_prepare() {
distutils-r1_src_prepare
# remove -flto and other forced cflags
sed -i -e 's:kwargs\["extra.*:pass:' setup.py || die
DISTUTILS_ARGS=(
--system-zstd
)
# remove namespace file
rm src/python/backports/__init__.py || die
}
python_test() {
eunittest tests
}

View File

@ -0,0 +1,47 @@
# 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
# this is a backport from py3.14, so don't add it
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="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
DEPEND="
app-arch/zstd:=
"
RDEPEND="
${DEPEND}
"
distutils_enable_tests unittest
src_prepare() {
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
}

View File

@ -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 */

View File

@ -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>