summaryrefslogtreecommitdiff
path: root/dev-python/blake3-py-c
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-09-15 23:13:45 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-09-15 23:13:45 +0100
commite87ef1b6ce856ae8859bdfce8028fb992f3e3763 (patch)
treed51e0c41adf3586e9a393881cee3ec0a9ed48977 /dev-python/blake3-py-c
parent0c80ffd3caee224555f8b394b6b2c05b2752f440 (diff)
gentoo auto-resync : 15:09:2022 - 23:13:44
Diffstat (limited to 'dev-python/blake3-py-c')
-rw-r--r--dev-python/blake3-py-c/Manifest4
-rw-r--r--dev-python/blake3-py-c/blake3-py-c-0.3.1.ebuild42
-rw-r--r--dev-python/blake3-py-c/files/blake3-py-c-0.3.1-backports.patch73
-rw-r--r--dev-python/blake3-py-c/metadata.xml11
4 files changed, 130 insertions, 0 deletions
diff --git a/dev-python/blake3-py-c/Manifest b/dev-python/blake3-py-c/Manifest
new file mode 100644
index 000000000000..c4ed29cb50a1
--- /dev/null
+++ b/dev-python/blake3-py-c/Manifest
@@ -0,0 +1,4 @@
+AUX blake3-py-c-0.3.1-backports.patch 2271 BLAKE2B 22fb38af9b13be8f729cf3f7ccb76e1ae5141f2a9d3ca75345854030a08f15f36ca4db42f3f4f8ddd9bd84604aa32bf61164fcf22ea729cc60d19206af69b7bc SHA512 acf5237b16a10ddb0223f75dad9d273041eb1879a8c78fddbf9ffbe109c8a4077f1747918bc55c7de97207a5a8506bec05a557af45c69d031658ff9cc6eb0b9a
+DIST blake3-py-0.3.1.gh.tar.gz 131798 BLAKE2B 6c816bab8d1e432453d4d40f4acc4d33bb45d305a2ab8458dded72bfee6ffd687a016d257dad4c2d656ddd5d765e5ad450e18fdd4af084a51f1973ce56daea68 SHA512 d3901339df9dc3409f8c2407c6f4f02fb9e13e8e7a76d77c06d9f58c6cceea4829cedf71a687fdded8ad70897d3a4833f2b124f39837b0ffa5fb8b907b51fd56
+EBUILD blake3-py-c-0.3.1.ebuild 761 BLAKE2B 0c409d941e5b0536e00aa82e18cfce2d3739d7b3a96e46f4863804aeaccd319047b0c6809a2192f9e84e2d0a609a0d8adb91a877b4b55684076910ea73681b4a SHA512 239156e1753874a877ed4548ed54a74272bb9a890ca7cf653db1db5376295d66d05e6ed04acf67627943529c821610a011a3957bf36562619ebdee62cab22cb8
+MISC metadata.xml 326 BLAKE2B 0f883faa7377c344baf1515844f711bc3c8c9e1fd0315311d382c50a065af4065accb592b79d152bf5110984cbe4d620f393db2ce2a43f7108b07690f5236d32 SHA512 18bc804d4f01849b61fc903e3d21d867d58e39a5e2fb9d2bfadb9b1299cc82ae57fd70416a1d457613a6dbf7393c8108ab45b91fec6b4ecb6a3f96228905046a
diff --git a/dev-python/blake3-py-c/blake3-py-c-0.3.1.ebuild b/dev-python/blake3-py-c/blake3-py-c-0.3.1.ebuild
new file mode 100644
index 000000000000..954d842bcbe7
--- /dev/null
+++ b/dev-python/blake3-py-c/blake3-py-c-0.3.1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit distutils-r1
+
+MY_P=${P/-c}
+DESCRIPTION="Python bindings for the BLAKE3 cryptographic hash function"
+HOMEPAGE="https://github.com/oconnor663/blake3-py/"
+SRC_URI="
+ https://github.com/oconnor663/blake3-py/archive/${PV}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+"
+S=${WORKDIR}/${MY_P}/c_impl
+
+LICENSE="|| ( CC0-1.0 Apache-2.0 )"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ !dev-python/blake3-py[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ test? (
+ dev-python/numpy[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-backports.patch
+)
+
+python_test() {
+ cd .. || die
+ epytest
+}
diff --git a/dev-python/blake3-py-c/files/blake3-py-c-0.3.1-backports.patch b/dev-python/blake3-py-c/files/blake3-py-c-0.3.1-backports.patch
new file mode 100644
index 000000000000..0c36aaa5ff21
--- /dev/null
+++ b/dev-python/blake3-py-c/files/blake3-py-c-0.3.1-backports.patch
@@ -0,0 +1,73 @@
+From 0d7526621087fd016d4ab5d34abfb35c715ec0cd Mon Sep 17 00:00:00 2001
+From: Thomas Waldmann <tw@waldmann-edv.de>
+Date: Tue, 29 Mar 2022 17:31:02 +0200
+Subject: [PATCH] c_impl: compatibility fix for python < 3.10
+
+---
+ blake3module.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/blake3module.c b/blake3module.c
+index f4160fb..0fce6ad 100644
+--- a/blake3module.c
++++ b/blake3module.c
+@@ -414,7 +414,8 @@ PyMODINIT_FUNC PyInit_blake3(void) {
+ goto exit;
+ }
+
+- if (PyModule_AddObjectRef(module, "blake3", (PyObject *)&Blake3Type) < 0) {
++ if (PyModule_AddObject(module, "blake3", (PyObject *)&Blake3Type) < 0) {
++ Py_DECREF((PyObject *)&Blake3Type);
+ goto exit;
+ }
+
+From 52676a355eccfb0050b372cd36a14ab49878e8b3 Mon Sep 17 00:00:00 2001
+From: Thomas Waldmann <tw@waldmann-edv.de>
+Date: Tue, 29 Mar 2022 18:18:46 +0200
+Subject: [PATCH] c_impl: apple silicon build fix, fixes #31
+
+On Apple Silicon (M1 CPU), the platform.machine() call returns "arm64".
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index a159d8b..863c7ea 100644
+--- a/setup.py
++++ b/setup.py
+@@ -66,7 +66,7 @@ def targeting_x86_32():
+
+
+ def is_aarch64():
+- return platform.machine().lower() == "aarch64"
++ return platform.machine().lower() in ("aarch64", "arm64")
+
+
+ def force_intrinsics():
+From 5eac8ae62d8f4e0a574164b73c42837ddc6ff356 Mon Sep 17 00:00:00 2001
+From: Thomas Waldmann <tw@waldmann-edv.de>
+Date: Tue, 29 Mar 2022 20:30:30 +0200
+Subject: [PATCH] c_impl: fix usedforsecurity argument variable type, fixes #34
+
+the python docs state that this must be int (not: bool).
+
+as seen in #34, using the wrong type here seems to overflow the variable
+and leads to a wrong value in max_threads, which leads to that strange
+test failure.
+---
+ blake3module.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/blake3module.c b/blake3module.c
+index 0fce6ad..a9562cf 100644
+--- a/blake3module.c
++++ b/blake3module.c
+@@ -53,7 +53,7 @@ static PyObject *Blake3_new(PyTypeObject *type, PyObject *args,
+ Py_buffer key = {0};
+ const char *derive_key_context = NULL;
+ Py_ssize_t max_threads = 1;
+- bool usedforsecurity = true;
++ int usedforsecurity = 1;
+
+ PyObject *ret = NULL;
+
diff --git a/dev-python/blake3-py-c/metadata.xml b/dev-python/blake3-py-c/metadata.xml
new file mode 100644
index 000000000000..3091c4dd69fe
--- /dev/null
+++ b/dev-python/blake3-py-c/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>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">oconnor663/blake3-py</remote-id>
+ </upstream>
+</pkgmetadata>