summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-05-02 04:45:29 +0100
committerSam James <sam@gentoo.org>2022-05-02 04:46:27 +0100
commitd42498a6ef8cd0776f8d6c164eed724319c3da10 (patch)
tree4391070581d76706c17d40e3117171ff27e1c5d2 /dev-python/pysnmp
parentdev-libs/rccl: bump to 5.0.2. (diff)
downloadgentoo-d42498a6ef8cd0776f8d6c164eed724319c3da10.tar.gz
gentoo-d42498a6ef8cd0776f8d6c164eed724319c3da10.tar.bz2
gentoo-d42498a6ef8cd0776f8d6c164eed724319c3da10.zip
dev-python/pysnmp: fix build with newer setuptools; fix runtime w/ Python 3.10+
Closes: https://bugs.gentoo.org/836608 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/pysnmp')
-rw-r--r--dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch36
-rw-r--r--dev-python/pysnmp/files/pysnmp-4.4.12-setuptools-version.patch20
-rw-r--r--dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild49
3 files changed, 105 insertions, 0 deletions
diff --git a/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch b/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch
new file mode 100644
index 000000000000..1fd272d8b5b6
--- /dev/null
+++ b/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch
@@ -0,0 +1,36 @@
+https://github.com/etingof/pysnmp/pull/415
+
+From 1d83beddd61b71e71dd725a12813a7052c14f730 Mon Sep 17 00:00:00 2001
+From: Flaviu Tamas <me@flaviutamas.com>
+Date: Sun, 26 Dec 2021 18:07:09 -0500
+Subject: [PATCH 1/2] Fixes #413
+
+Thanks to @mheppner for finding the issue and reporting the bug.
+--- a/pysnmp/carrier/asyncio/dgram/base.py
++++ b/pysnmp/carrier/asyncio/dgram/base.py
+@@ -44,7 +44,7 @@
+ from pysnmp.carrier import error
+ from pysnmp.carrier.asyncio.base import AbstractAsyncioTransport
+
+-IS_PYTHON_344_PLUS = platform.python_version_tuple() >= ('3', '4', '4')
++IS_PYTHON_344_PLUS = [int(v) for v in platform.python_version_tuple()] >= [3, 4, 4]
+
+
+ class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
+
+From fc5ad9c1b1b9195f49d327f471705f9519ce5c09 Mon Sep 17 00:00:00 2001
+From: Flaviu Tamas <me@flaviutamas.com>
+Date: Fri, 31 Dec 2021 11:41:09 -0500
+Subject: [PATCH 2/2] Fix python 3.10 compatability, part 2
+
+--- a/pysnmp/carrier/asyncio/dispatch.py
++++ b/pysnmp/carrier/asyncio/dispatch.py
+@@ -43,7 +43,7 @@
+ from pysnmp.carrier.base import AbstractTransportDispatcher
+ from pysnmp.error import PySnmpError
+
+-IS_PYTHON_344_PLUS = platform.python_version_tuple() >= ('3', '4', '4')
++IS_PYTHON_344_PLUS = [int(v) for v in platform.python_version_tuple()] >= [3, 4, 4]
+
+
+ class AsyncioDispatcher(AbstractTransportDispatcher):
diff --git a/dev-python/pysnmp/files/pysnmp-4.4.12-setuptools-version.patch b/dev-python/pysnmp/files/pysnmp-4.4.12-setuptools-version.patch
new file mode 100644
index 000000000000..e2793fd6eeaa
--- /dev/null
+++ b/dev-python/pysnmp/files/pysnmp-4.4.12-setuptools-version.patch
@@ -0,0 +1,20 @@
+https://github.com/etingof/pysnmp/commit/2ee8b8707d36e772d6308f434b445a766e6586e7
+https://bugs.gentoo.org/836608
+
+From 2ee8b8707d36e772d6308f434b445a766e6586e7 Mon Sep 17 00:00:00 2001
+From: Michael Weiss <dev.primeos@gmail.com>
+Date: Thu, 7 Nov 2019 18:55:45 +0100
+Subject: [PATCH] Improve the setuptools version check (#322)
+
+Handles malformed `setuptools.__version__` such as "41.4.0.post20191022"
+--- a/setup.py
++++ b/setup.py
+@@ -85,7 +85,7 @@ def howto_install_setuptools():
+
+ setup, Command = setuptools.setup, setuptools.Command
+
+- observed_version = [int(x) for x in setuptools.__version__.split('.')]
++ observed_version = [int(x) for x in setuptools.__version__.split('.')[:3]]
+ required_version = [36, 2, 0]
+
+ # NOTE(etingof): require fresh setuptools to build proper wheels
diff --git a/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild b/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild
new file mode 100644
index 000000000000..75fef329b09d
--- /dev/null
+++ b/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit distutils-r1 optfeature
+
+DESCRIPTION="Python SNMP library"
+HOMEPAGE="https://pypi.org/project/pysnmp/ https://github.com/etingof/pysnmp"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~sparc ~x86"
+IUSE="doc examples"
+
+RDEPEND="
+ >=dev-python/pyasn1-0.2.3[${PYTHON_USEDEP}]
+ dev-python/pycryptodome[${PYTHON_USEDEP}]"
+PDEPEND="dev-python/pysmi[${PYTHON_USEDEP}]"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-setuptools-version.patch
+ "${FILESDIR}"/${PN}-4.4.12-python310.patch
+)
+
+distutils_enable_sphinx docs/source
+
+python_prepare_all() {
+ touch docs/source/conf.py || die
+ distutils-r1_python_prepare_all
+}
+
+python_install_all() {
+ if use examples; then
+ docinto examples
+ dodoc -r examples/. docs/mibs
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+
+ distutils-r1_python_install_all
+}
+
+pkg_postinst() {
+ optfeature "Example programs using pysnmp" dev-python/pysnmp-apps
+ optfeature "IETF and other mibs" dev-python/pysnmp-mibs
+ optfeature "Dump MIBs in python format" dev-python/pysmi
+}