Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pysnmp/files/, dev-python/pysnmp/
Date: Mon, 02 May 2022 03:46:39
Message-Id: 1651463187.d42498a6ef8cd0776f8d6c164eed724319c3da10.sam@gentoo
1 commit: d42498a6ef8cd0776f8d6c164eed724319c3da10
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 2 03:45:29 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon May 2 03:46:27 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d42498a6
7
8 dev-python/pysnmp: fix build with newer setuptools; fix runtime w/ Python 3.10+
9
10 Closes: https://bugs.gentoo.org/836608
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../pysnmp/files/pysnmp-4.4.12-python310.patch | 36 ++++++++++++++++
14 .../files/pysnmp-4.4.12-setuptools-version.patch | 20 +++++++++
15 dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild | 49 ++++++++++++++++++++++
16 3 files changed, 105 insertions(+)
17
18 diff --git a/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch b/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch
19 new file mode 100644
20 index 000000000000..1fd272d8b5b6
21 --- /dev/null
22 +++ b/dev-python/pysnmp/files/pysnmp-4.4.12-python310.patch
23 @@ -0,0 +1,36 @@
24 +https://github.com/etingof/pysnmp/pull/415
25 +
26 +From 1d83beddd61b71e71dd725a12813a7052c14f730 Mon Sep 17 00:00:00 2001
27 +From: Flaviu Tamas <me@×××××××××××.com>
28 +Date: Sun, 26 Dec 2021 18:07:09 -0500
29 +Subject: [PATCH 1/2] Fixes #413
30 +
31 +Thanks to @mheppner for finding the issue and reporting the bug.
32 +--- a/pysnmp/carrier/asyncio/dgram/base.py
33 ++++ b/pysnmp/carrier/asyncio/dgram/base.py
34 +@@ -44,7 +44,7 @@
35 + from pysnmp.carrier import error
36 + from pysnmp.carrier.asyncio.base import AbstractAsyncioTransport
37 +
38 +-IS_PYTHON_344_PLUS = platform.python_version_tuple() >= ('3', '4', '4')
39 ++IS_PYTHON_344_PLUS = [int(v) for v in platform.python_version_tuple()] >= [3, 4, 4]
40 +
41 +
42 + class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
43 +
44 +From fc5ad9c1b1b9195f49d327f471705f9519ce5c09 Mon Sep 17 00:00:00 2001
45 +From: Flaviu Tamas <me@×××××××××××.com>
46 +Date: Fri, 31 Dec 2021 11:41:09 -0500
47 +Subject: [PATCH 2/2] Fix python 3.10 compatability, part 2
48 +
49 +--- a/pysnmp/carrier/asyncio/dispatch.py
50 ++++ b/pysnmp/carrier/asyncio/dispatch.py
51 +@@ -43,7 +43,7 @@
52 + from pysnmp.carrier.base import AbstractTransportDispatcher
53 + from pysnmp.error import PySnmpError
54 +
55 +-IS_PYTHON_344_PLUS = platform.python_version_tuple() >= ('3', '4', '4')
56 ++IS_PYTHON_344_PLUS = [int(v) for v in platform.python_version_tuple()] >= [3, 4, 4]
57 +
58 +
59 + class AsyncioDispatcher(AbstractTransportDispatcher):
60
61 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
62 new file mode 100644
63 index 000000000000..e2793fd6eeaa
64 --- /dev/null
65 +++ b/dev-python/pysnmp/files/pysnmp-4.4.12-setuptools-version.patch
66 @@ -0,0 +1,20 @@
67 +https://github.com/etingof/pysnmp/commit/2ee8b8707d36e772d6308f434b445a766e6586e7
68 +https://bugs.gentoo.org/836608
69 +
70 +From 2ee8b8707d36e772d6308f434b445a766e6586e7 Mon Sep 17 00:00:00 2001
71 +From: Michael Weiss <dev.primeos@×××××.com>
72 +Date: Thu, 7 Nov 2019 18:55:45 +0100
73 +Subject: [PATCH] Improve the setuptools version check (#322)
74 +
75 +Handles malformed `setuptools.__version__` such as "41.4.0.post20191022"
76 +--- a/setup.py
77 ++++ b/setup.py
78 +@@ -85,7 +85,7 @@ def howto_install_setuptools():
79 +
80 + setup, Command = setuptools.setup, setuptools.Command
81 +
82 +- observed_version = [int(x) for x in setuptools.__version__.split('.')]
83 ++ observed_version = [int(x) for x in setuptools.__version__.split('.')[:3]]
84 + required_version = [36, 2, 0]
85 +
86 + # NOTE(etingof): require fresh setuptools to build proper wheels
87
88 diff --git a/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild b/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild
89 new file mode 100644
90 index 000000000000..75fef329b09d
91 --- /dev/null
92 +++ b/dev-python/pysnmp/pysnmp-4.4.12-r2.ebuild
93 @@ -0,0 +1,49 @@
94 +# Copyright 1999-2022 Gentoo Authors
95 +# Distributed under the terms of the GNU General Public License v2
96 +
97 +EAPI=7
98 +
99 +PYTHON_COMPAT=( python3_{8..10} )
100 +inherit distutils-r1 optfeature
101 +
102 +DESCRIPTION="Python SNMP library"
103 +HOMEPAGE="https://pypi.org/project/pysnmp/ https://github.com/etingof/pysnmp"
104 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
105 +
106 +LICENSE="BSD"
107 +SLOT="0"
108 +KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~sparc ~x86"
109 +IUSE="doc examples"
110 +
111 +RDEPEND="
112 + >=dev-python/pyasn1-0.2.3[${PYTHON_USEDEP}]
113 + dev-python/pycryptodome[${PYTHON_USEDEP}]"
114 +PDEPEND="dev-python/pysmi[${PYTHON_USEDEP}]"
115 +
116 +PATCHES=(
117 + "${FILESDIR}"/${P}-setuptools-version.patch
118 + "${FILESDIR}"/${PN}-4.4.12-python310.patch
119 +)
120 +
121 +distutils_enable_sphinx docs/source
122 +
123 +python_prepare_all() {
124 + touch docs/source/conf.py || die
125 + distutils-r1_python_prepare_all
126 +}
127 +
128 +python_install_all() {
129 + if use examples; then
130 + docinto examples
131 + dodoc -r examples/. docs/mibs
132 + docompress -x /usr/share/doc/${PF}/examples
133 + fi
134 +
135 + distutils-r1_python_install_all
136 +}
137 +
138 +pkg_postinst() {
139 + optfeature "Example programs using pysnmp" dev-python/pysnmp-apps
140 + optfeature "IETF and other mibs" dev-python/pysnmp-mibs
141 + optfeature "Dump MIBs in python format" dev-python/pysmi
142 +}