summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bracht Laumann Jespersen <t@laumann.xyz>2022-06-04 22:37:54 +0200
committerSam James <sam@gentoo.org>2022-06-07 20:58:40 +0100
commitbc1f5c409d75ab773dfeee3f284384b82a95cb5d (patch)
tree6d74209973a0b846389d8570820c5eeb2da5e1b0 /dev-python/tlsh
parentdev-libs/tlsh: initial import (diff)
downloadgentoo-bc1f5c409d75ab773dfeee3f284384b82a95cb5d.tar.gz
gentoo-bc1f5c409d75ab773dfeee3f284384b82a95cb5d.tar.bz2
gentoo-bc1f5c409d75ab773dfeee3f284384b82a95cb5d.zip
dev-python/tlsh: initial import
The second package to add support for fuzzy matching in diffoscope. Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz> Closes: https://github.com/gentoo/gentoo/pull/25771 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-setup-sources.patch30
-rw-r--r--dev-python/tlsh/metadata.xml12
-rw-r--r--dev-python/tlsh/tlsh-4.8.2.ebuild33
4 files changed, 76 insertions, 0 deletions
diff --git a/dev-python/tlsh/Manifest b/dev-python/tlsh/Manifest
new file mode 100644
index 000000000000..2425a1db29ee
--- /dev/null
+++ b/dev-python/tlsh/Manifest
@@ -0,0 +1 @@
+DIST tlsh-4.8.2.tar.gz 3345458 BLAKE2B 27d5eece16bb36225b9ae8b3d3a9d055a0f214fffae08a58c39211c3d918dd842497315a62237b291ee1055dfadad78826bbd24f7b9d88f510e9a31f74654039 SHA512 5355c7734f5356a3a7a31ccc078254835871fc0369f1889a34131a0f810735201c68f674eb18e975b6a03a32e5c284899ca9ffdc1f583e42192188c172d2aad0
diff --git a/dev-python/tlsh/files/tlsh-4.8.2-setup-sources.patch b/dev-python/tlsh/files/tlsh-4.8.2-setup-sources.patch
new file mode 100644
index 000000000000..4cdb0f864b5b
--- /dev/null
+++ b/dev-python/tlsh/files/tlsh-4.8.2-setup-sources.patch
@@ -0,0 +1,30 @@
+--- a/setup.py
++++ b/setup.py
+@@ -21,26 +21,7 @@ with open(join(realpath('..'), 'CMakeLists.txt'), 'r') as f:
+ if m:
+ tlsh_3b = ''
+
+-if os.name == 'nt':
+- tlsh_module = Extension('tlsh', \
+- sources = ['tlshmodule.cpp', \
+- join(realpath('..'), 'src', 'tlsh.cpp'), \
+- join(realpath('..'), 'src', 'tlsh_impl.cpp'), \
+- join(realpath('..'), 'src', 'tlsh_util.cpp') \
+- ], \
+- include_dirs = [join(realpath('..'), 'include'),
+- join(realpath('..'), 'Windows')],\
+- define_macros = [('WINDOWS', None),], \
+- )
+-else:
+- tlsh_module = Extension('tlsh', \
+- sources = ['tlshmodule.cpp', \
+- join(realpath('..'), 'src', 'tlsh.cpp'), \
+- join(realpath('..'), 'src', 'tlsh_impl.cpp'), \
+- join(realpath('..'), 'src', 'tlsh_util.cpp') \
+- ], \
+- include_dirs = [join(realpath('..'), 'include')],
+- )
++tlsh_module = Extension('tlsh', sources=['tlshmodule.cpp'], libraries=['tlsh'])
+
+ if tlsh_256 != '':
+ tlsh_module.extra_compile_args.append(tlsh_256)
diff --git a/dev-python/tlsh/metadata.xml b/dev-python/tlsh/metadata.xml
new file mode 100644
index 000000000000..89e6a410f9e7
--- /dev/null
+++ b/dev-python/tlsh/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>t@laumann.xyz</email>
+ <name>Thomas Bracht Laumann Jespersen</name>
+ </maintainer>
+ <maintainer type="person" proxied="proxy">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/dev-python/tlsh/tlsh-4.8.2.ebuild b/dev-python/tlsh/tlsh-4.8.2.ebuild
new file mode 100644
index 000000000000..d99d69d0b9c9
--- /dev/null
+++ b/dev-python/tlsh/tlsh-4.8.2.ebuild
@@ -0,0 +1,33 @@
+# 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..10} )
+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}.tar.gz"
+S=${WORKDIR}/${P}/py_ext
+
+LICENSE="|| ( Apache-2.0 BSD )"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="dev-libs/tlsh"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-setup-sources.patch
+)
+
+src_prepare() {
+ distutils-r1_src_prepare
+ sed -i -e 's:#include "tlsh.h":#include <tlsh/tlsh.h>:' tlshmodule.cpp || die
+}
+
+python_test() {
+ "${EPYTHON}" test.py test.py test.py &> /dev/null || die
+}