summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/crc32c/Manifest1
-rw-r--r--dev-python/crc32c/crc32c-2.4.ebuild46
-rw-r--r--dev-python/crc32c/metadata.xml11
3 files changed, 58 insertions, 0 deletions
diff --git a/dev-python/crc32c/Manifest b/dev-python/crc32c/Manifest
new file mode 100644
index 000000000000..1bbb68b67268
--- /dev/null
+++ b/dev-python/crc32c/Manifest
@@ -0,0 +1 @@
+DIST crc32c-2.4.tar.gz 38272 BLAKE2B 1273f62794bd646e983737d922c4e1320a4519856b1cedf2d1d1f9b1e47fc767e248b6e00ada48e8f245e47fc18619327e9a8cfa5d88a0569c467ca6147a1974 SHA512 d747dee42184ff025dd6fd7334b65e5caba4066a055943a783b951d09e09339694072ea552aa95579f03a85a7bdb2eb4a8d12dc9a17f0f83d84c0fde534b36cb
diff --git a/dev-python/crc32c/crc32c-2.4.ebuild b/dev-python/crc32c/crc32c-2.4.ebuild
new file mode 100644
index 000000000000..ff64329bc4ad
--- /dev/null
+++ b/dev-python/crc32c/crc32c-2.4.ebuild
@@ -0,0 +1,46 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{10..12} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="CRC32c algorithm in hardware and software"
+HOMEPAGE="
+ https://github.com/ICRAR/crc32c/
+ https://pypi.org/project/crc32c/
+"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64"
+# NB: these don't affect the build, they are only used for tests
+IUSE="cpu_flags_arm_crc32 cpu_flags_x86_sse4_2"
+
+distutils_enable_tests pytest
+
+python_test() {
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ local -x CRC32C_SW_MODE
+
+ # force = run "software" code (i.e. unoptimized)
+ # none = run "hardware" code (i.e. SSE4.2 / ARMv8 CRC32)
+ for CRC32C_SW_MODE in none force; do
+ if [[ ${CRC32C_SW_MODE} == none ]]; then
+ if ! use cpu_flags_arm_crc32 && ! use cpu_flags_x86_sse4_2; then
+ continue
+ fi
+
+ # the test suite just skips all tests, so double-check
+ "${EPYTHON}" -c "import crc32c" ||
+ die "Importing crc32c failed (accelerated code path broken?)"
+ fi
+
+ einfo "Testing with CRC32C_SW_MODE=${CRC32C_SW_MODE}"
+ epytest
+ done
+}
diff --git a/dev-python/crc32c/metadata.xml b/dev-python/crc32c/metadata.xml
new file mode 100644
index 000000000000..a5c4dec1ece1
--- /dev/null
+++ b/dev-python/crc32c/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">ICRAR/crc32c</remote-id>
+ <remote-id type="pypi">crc32c</remote-id>
+ </upstream>
+</pkgmetadata>