Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/pyzor/files/, mail-filter/pyzor/
Date: Fri, 01 Jan 2021 01:06:52
Message-Id: 1609462907.0ec84e9a00b10cdae9ec774dc0fed3ceee3b84e8.mgorny@gentoo
1 commit: 0ec84e9a00b10cdae9ec774dc0fed3ceee3b84e8
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 1 01:01:47 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 1 01:01:47 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ec84e9a
7
8 mail-filter/pyzor: Remove old (py3.6)
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 mail-filter/pyzor/Manifest | 1 -
13 .../read-stdin-as-binary-in-get_input_msg.patch | 85 ----------------------
14 .../files/unfix-configparser-compat-for-2to3.patch | 41 -----------
15 mail-filter/pyzor/pyzor-1.0.0-r1.ebuild | 71 ------------------
16 4 files changed, 198 deletions(-)
17
18 diff --git a/mail-filter/pyzor/Manifest b/mail-filter/pyzor/Manifest
19 index 418fdd57e1c..23730c858e1 100644
20 --- a/mail-filter/pyzor/Manifest
21 +++ b/mail-filter/pyzor/Manifest
22 @@ -1,2 +1 @@
23 -DIST pyzor-1.0.0.tar.gz 126276 BLAKE2B c60f26c53bf118c88dacbc49ddd414473748af1868b383a9c937ecf3cfe426ecdd60f64388fe7e555bd4641ef445769600e40879279dd544ef9ea32bd0dab6b9 SHA512 b3fb8b2c5261e187a2ab3a5a3b12d221df7de08766c6bb2ad9990c0f23517534871ecc9d5ad529e79b0d0aef8b2b800728320c57435a8c0d8c3f80a4ba0f7e4a
24 DIST pyzor-1.0.0_p20200523.tar.gz 138077 BLAKE2B 13ad30f06ce32a24a42dd5aaa21ad2a6700df1bac3dc54a86532748688b094ee0f56a8e28e34336298388c6e0b95868e95d040866c9afa561d867069496608fe SHA512 afe3b14794aea68b1a7d72840257976c7c9f755a6f6dcaaf6ebacab465c176fe2aa84f3fe176006cdbe26ef0b07ed949f75f6ef729f65c604fadf6ce8472da8f
25
26 diff --git a/mail-filter/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch b/mail-filter/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch
27 deleted file mode 100644
28 index 03031a97669..00000000000
29 --- a/mail-filter/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch
30 +++ /dev/null
31 @@ -1,85 +0,0 @@
32 -From 66225b32d2774cf37fa7f702f7eb26cd94094482 Mon Sep 17 00:00:00 2001
33 -From: Michael Orlitzky <michael@××××××××.com>
34 -Date: Sun, 4 Mar 2018 17:27:01 -0500
35 -Subject: [PATCH 1/1] scripts/pyzor: replace the client with the git (+ issue
36 - 64 fix) version.
37 -
38 ----
39 - scripts/pyzor | 33 +++++++++++++++++++++++++++------
40 - 1 file changed, 27 insertions(+), 6 deletions(-)
41 -
42 -diff --git a/scripts/pyzor b/scripts/pyzor
43 -index 19b1d21..86c6f7d 100755
44 ---- a/scripts/pyzor
45 -+++ b/scripts/pyzor
46 -@@ -17,9 +17,9 @@ import tempfile
47 - import threading
48 -
49 - try:
50 -- import ConfigParser
51 --except ImportError:
52 - import configparser as ConfigParser
53 -+except ImportError:
54 -+ import ConfigParser
55 -
56 - import pyzor.digest
57 - import pyzor.client
58 -@@ -110,7 +110,7 @@ def load_configuration():
59 - config = ConfigParser.ConfigParser()
60 - # Set the defaults.
61 - config.add_section("client")
62 -- for key, value in defaults.iteritems():
63 -+ for key, value in defaults.items():
64 - config.set("client", key, value)
65 - # Override with the configuration.
66 - config.read(os.path.join(options.homedir, "config"))
67 -@@ -171,14 +171,35 @@ def _get_input_digests(dummy):
68 -
69 -
70 - def _get_input_msg(digester):
71 -- msg = email.message_from_file(sys.stdin)
72 -+ msg = email.message_from_bytes(get_binary_stdin().read())
73 - digested = digester(msg).value
74 - yield digested
75 -
76 -
77 -+def _is_binary_reader(stream, default=False):
78 -+ try:
79 -+ return isinstance(stream.read(0), bytes)
80 -+ except Exception:
81 -+ return default
82 -+
83 -+
84 -+def get_binary_stdin():
85 -+ # sys.stdin might or might not be binary in some extra cases. By
86 -+ # default it's obviously non binary which is the core of the
87 -+ # problem but the docs recommend changing it to binary for such
88 -+ # cases so we need to deal with it.
89 -+ is_binary = _is_binary_reader(sys.stdin, False)
90 -+ if is_binary:
91 -+ return sys.stdin
92 -+ buf = getattr(sys.stdin, 'buffer', None)
93 -+ if buf is not None and _is_binary_reader(buf, True):
94 -+ return buf
95 -+ raise RuntimeError('Did not manage to get binary stdin')
96 -+
97 -+
98 - def _get_input_mbox(digester):
99 - tfile = tempfile.NamedTemporaryFile()
100 -- tfile.write(sys.stdin.read().encode("utf8"))
101 -+ tfile.write(get_binary_stdin().read())
102 - tfile.seek(0)
103 - mbox = mailbox.mbox(tfile.name)
104 - for msg in mbox:
105 -@@ -372,7 +393,7 @@ def genkey(client, servers, config, hash_func=hashlib.sha1):
106 - return False
107 - # pylint: disable-msg=W0612
108 - salt = "".join([chr(random.randint(0, 255))
109 -- for unused in xrange(hash_func(b"").digest_size)])
110 -+ for unused in range(hash_func(b"").digest_size)])
111 - if sys.version_info >= (3, 0):
112 - salt = salt.encode("utf8")
113 - salt_digest = hash_func(salt)
114 ---
115 -2.13.6
116 -
117
118 diff --git a/mail-filter/pyzor/files/unfix-configparser-compat-for-2to3.patch b/mail-filter/pyzor/files/unfix-configparser-compat-for-2to3.patch
119 deleted file mode 100644
120 index 93d0f07a257..00000000000
121 --- a/mail-filter/pyzor/files/unfix-configparser-compat-for-2to3.patch
122 +++ /dev/null
123 @@ -1,41 +0,0 @@
124 -From e4f06e21f697b863fa45a50e535ff0c6e3621a60 Mon Sep 17 00:00:00 2001
125 -From: Michael Orlitzky <michael@××××××××.com>
126 -Date: Sun, 25 Mar 2018 10:14:21 -0400
127 -Subject: [PATCH 1/1] scripts/pyzor: undo ConfigParser python-3.x
128 - compatibility.
129 -
130 -The build system for pyzor-1.0.0 still runs the 2to3 utility on the
131 -scripts to be installed. As an unintended side-effect, the python-3.x
132 -"try... import... except" compatibility block for the ConfigParser <->
133 -configparser module gets modified (the module name gets mistakenly
134 -lowercased).
135 -
136 -This commit puts back the python-2.x "import ConfigParser" line
137 -unconditionally, and we'll have to rely on 2to3 to fix it when run
138 -under python-3.x. In newer versions of pyzor, the automatic 2to3 will
139 -not happen.
140 -
141 -Bug: https://bugs.gentoo.org/643692
142 ----
143 - scripts/pyzor | 5 +----
144 - 1 file changed, 1 insertion(+), 4 deletions(-)
145 -
146 -diff --git a/scripts/pyzor b/scripts/pyzor
147 -index 86c6f7d..2750d92 100755
148 ---- a/scripts/pyzor
149 -+++ b/scripts/pyzor
150 -@@ -16,10 +16,7 @@ import optparse
151 - import tempfile
152 - import threading
153 -
154 --try:
155 -- import configparser as ConfigParser
156 --except ImportError:
157 -- import ConfigParser
158 -+import ConfigParser
159 -
160 - import pyzor.digest
161 - import pyzor.client
162 ---
163 -2.16.1
164 -
165
166 diff --git a/mail-filter/pyzor/pyzor-1.0.0-r1.ebuild b/mail-filter/pyzor/pyzor-1.0.0-r1.ebuild
167 deleted file mode 100644
168 index af40ded0281..00000000000
169 --- a/mail-filter/pyzor/pyzor-1.0.0-r1.ebuild
170 +++ /dev/null
171 @@ -1,71 +0,0 @@
172 -# Copyright 1999-2020 Gentoo Authors
173 -# Distributed under the terms of the GNU General Public License v2
174 -
175 -EAPI=6
176 -
177 -PYTHON_COMPAT=( python3_6 )
178 -inherit distutils-r1
179 -
180 -MY_PV="1-0-0"
181 -DESCRIPTION="A distributed, collaborative spam detection and filtering network"
182 -HOMEPAGE="https://github.com/SpamExperts/pyzor"
183 -SRC_URI="https://github.com/SpamExperts/pyzor/archive/release-${MY_PV}.tar.gz -> ${P}.tar.gz"
184 -
185 -LICENSE="GPL-2"
186 -SLOT="0"
187 -KEYWORDS="~alpha amd64 ~hppa ~ia64 ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux"
188 -
189 -IUSE="doc gdbm gevent pyzord redis test"
190 -# The test suite is py2-only
191 -RESTRICT="test"
192 -
193 -# The mysql-python library is always required for the MySQL engine. We
194 -# depend on it conditionally here because otherwise repoman will balk at
195 -# the potential conflict between PYTHON_TARGETS and USE=mysql. But as a
196 -# result, if you try to use the MySQL engine with python-3.x, it just
197 -# won't work because you'll be missing the library.
198 -RDEPEND="
199 - pyzord? (
200 - gdbm? ( $(python_gen_impl_dep 'gdbm') )
201 - redis? ( dev-python/redis-py[${PYTHON_USEDEP}] )
202 - gevent? ( dev-python/gevent[${PYTHON_USEDEP}] )
203 - )"
204 -DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
205 - doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
206 - test? ( ${RDEPEND} )"
207 -
208 -# TODO: maybe upstream would support skipping tests for which the
209 -# dependencies are missing?
210 -REQUIRED_USE="pyzord? ( || ( gdbm redis ) )
211 - test? ( gdbm redis )"
212 -S="${WORKDIR}/${PN}-release-${MY_PV}"
213 -
214 -PATCHES=(
215 - "${FILESDIR}/read-stdin-as-binary-in-get_input_msg.patch"
216 - "${FILESDIR}/unfix-configparser-compat-for-2to3.patch"
217 -)
218 -
219 -python_test() {
220 - PYTHONPATH=. "${PYTHON}" ./tests/unit/__init__.py
221 -}
222 -
223 -python_compile_all() {
224 - use doc && emake -C docs html
225 -}
226 -
227 -python_install_all() {
228 - use doc && HTML_DOCS=( docs/.build/html/. )
229 - distutils-r1_python_install_all
230 -}
231 -
232 -src_install() {
233 - distutils-r1_src_install
234 -
235 - if use pyzord; then
236 - dodir /usr/sbin
237 - mv "${D}"usr/bin/pyzord* "${ED}usr/sbin" \
238 - || die "failed to relocate pyzord"
239 - else
240 - rm "${D}"usr/bin/pyzord* || die "failed to remove pyzord"
241 - fi
242 -}