summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bracht Laumann Jespersen <t@laumann.xyz>2024-04-19 12:18:15 +0200
committerSam James <sam@gentoo.org>2024-06-02 01:38:30 +0100
commit0831a84172d0ee0499070a8c1212ef9780197b1f (patch)
tree55c3206a77d2664417adc5040fbe1856d8cacbf9 /dev-python/tlsh
parentmedia-libs/aubio: revbump to 0.4.9-r3 (diff)
downloadgentoo-0831a84172d0ee0499070a8c1212ef9780197b1f.tar.gz
gentoo-0831a84172d0ee0499070a8c1212ef9780197b1f.tar.bz2
gentoo-0831a84172d0ee0499070a8c1212ef9780197b1f.zip
dev-python/tlsh: fix build for python 3.12 + musl
Closes: https://bugs.gentoo.org/927058 Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz> Closes: https://github.com/gentoo/gentoo/pull/36321 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/tlsh')
-rw-r--r--dev-python/tlsh/Manifest1
-rw-r--r--dev-python/tlsh/files/tlsh-4.8.2-r1-py312.patch25
-rw-r--r--dev-python/tlsh/tlsh-4.8.2-r1.ebuild30
3 files changed, 56 insertions, 0 deletions
diff --git a/dev-python/tlsh/Manifest b/dev-python/tlsh/Manifest
index 2425a1db29ee..7f54384d66a4 100644
--- a/dev-python/tlsh/Manifest
+++ b/dev-python/tlsh/Manifest
@@ -1 +1,2 @@
+DIST tlsh-4.8.2.gh.tar.gz 3345458 BLAKE2B 27d5eece16bb36225b9ae8b3d3a9d055a0f214fffae08a58c39211c3d918dd842497315a62237b291ee1055dfadad78826bbd24f7b9d88f510e9a31f74654039 SHA512 5355c7734f5356a3a7a31ccc078254835871fc0369f1889a34131a0f810735201c68f674eb18e975b6a03a32e5c284899ca9ffdc1f583e42192188c172d2aad0
DIST tlsh-4.8.2.tar.gz 3345458 BLAKE2B 27d5eece16bb36225b9ae8b3d3a9d055a0f214fffae08a58c39211c3d918dd842497315a62237b291ee1055dfadad78826bbd24f7b9d88f510e9a31f74654039 SHA512 5355c7734f5356a3a7a31ccc078254835871fc0369f1889a34131a0f810735201c68f674eb18e975b6a03a32e5c284899ca9ffdc1f583e42192188c172d2aad0
diff --git a/dev-python/tlsh/files/tlsh-4.8.2-r1-py312.patch b/dev-python/tlsh/files/tlsh-4.8.2-r1-py312.patch
new file mode 100644
index 000000000000..56c4766bd711
--- /dev/null
+++ b/dev-python/tlsh/files/tlsh-4.8.2-r1-py312.patch
@@ -0,0 +1,25 @@
+Use PyVarObject_HEAD_INIT instead PyObject_HEAD_INIT
+
+--- a/tlshmodule.cpp
++++ b/tlshmodule.cpp
+@@ -59,7 +59,7 @@
+ #include <Python.h>
+ #include <new>
+ #include <bytesobject.h>
+-#include "tlsh.h"
++#include <tlsh/tlsh.h>
+
+ // to generate the "T1" hashes introduced in TLSH 4.0.0
+ // see 4.0.0 from 26/Mar/2020 at https://github.com/trendmicro/tlsh/blob/master/Change_History.md
+@@ -286,10 +286,7 @@ static PyGetSetDef Tlsh_getsetters[] = {
+ };
+
+ static PyTypeObject tlsh_TlshType = {
+- PyObject_HEAD_INIT(NULL)
+-#if PY_MAJOR_VERSION < 3
+- 0, /* ob_size */
+-#endif
++ PyVarObject_HEAD_INIT(NULL, 0)
+ "tlsh.Tlsh", /* tp_name */
+ sizeof(tlsh_TlshObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
diff --git a/dev-python/tlsh/tlsh-4.8.2-r1.ebuild b/dev-python/tlsh/tlsh-4.8.2-r1.ebuild
new file mode 100644
index 000000000000..94ebb2d03eab
--- /dev/null
+++ b/dev-python/tlsh/tlsh-4.8.2-r1.ebuild
@@ -0,0 +1,30 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+DISTUTILS_EXT=1
+inherit distutils-r1
+
+DESCRIPTION="Fuzzy matching library - C++ extension for Python"
+HOMEPAGE="https://pypi.org/project/python-tlsh/"
+SRC_URI="https://github.com/trendmicro/${PN}/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+S=${WORKDIR}/${P}/py_ext
+
+LICENSE="|| ( Apache-2.0 BSD )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc64 ~x86"
+
+DEPEND="dev-libs/tlsh"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-setup-sources.patch
+ "${FILESDIR}"/${P}-r1-py312.patch
+)
+
+python_test() {
+ "${EPYTHON}" test.py test.py test.py &> /dev/null || die
+}