public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyzor/files/, dev-python/pyzor/
@ 2017-03-18  9:09 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2017-03-18  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     32c88f7865c1ddf431fe99bfc6aa24c2c256babd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 18 08:21:53 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Mar 18 09:09:38 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32c88f78

dev-python/pyzor: Remove old (distutils.eclass)

 dev-python/pyzor/Manifest                          |  1 -
 .../files/pyzor-0.5.0-python26_warnings.patch      | 89 ----------------------
 dev-python/pyzor/files/pyzord_getopt.patch         | 24 ------
 dev-python/pyzor/pyzor-0.5.0-r2.ebuild             | 65 ----------------
 4 files changed, 179 deletions(-)

diff --git a/dev-python/pyzor/Manifest b/dev-python/pyzor/Manifest
index 2647fd70775..6b3841522a0 100644
--- a/dev-python/pyzor/Manifest
+++ b/dev-python/pyzor/Manifest
@@ -1,3 +1,2 @@
-DIST pyzor-0.5.0.tar.bz2 40654 SHA256 2bf3df9e916861063a73f7b46cb8b27bac6f661fce1362803de9e7921fc155ba SHA512 048c81e373be217808f4e4e8f6adbc1b464891b725b3004031dfa7a82abe234b080c3a87bc9ad61ee1df2bfb78ed0ee78565b49843f09243f72b6315df6877a1 WHIRLPOOL 966090015bfe93d4ef059a1186e97705807769f9341e94a2f5d9c223540effac04209a32cad850c6f405225c00aea55bdf7ac5a6a98e0927824d641ee61e5c80
 DIST pyzor-0.7.0.tar.bz2 78555 SHA256 6d9ca62bd4aa9a0210adb9d4c8ff2b38bb2cd051f1517ce29e88d7fbe4b1026d SHA512 40026fc0276b4cf60fe7dfe30e2d4d4d1f220cf860b8aaef9d983e632a7d87bc8deb3430ded7520a69269ef56550117735a6e3c8d046d4cad7066f8597ead3cd WHIRLPOOL dd8466477e38362fa0a64ec66822ae3820c22f8ae13b40002145b1e688d17c17edfb800eb44679ff961e74b667daa43ef09d8eadb92f683c9e73c9b00fad23b9
 DIST pyzor-1.0.0.tar.gz 126276 SHA256 548bc461c01e790cf8db1f26d9f66b281f3aa3cf5f5a6fd647071360ed663ef1 SHA512 b3fb8b2c5261e187a2ab3a5a3b12d221df7de08766c6bb2ad9990c0f23517534871ecc9d5ad529e79b0d0aef8b2b800728320c57435a8c0d8c3f80a4ba0f7e4a WHIRLPOOL ad92ca30c116b1c22cc49b5643ecb03880ef1911d7f2a59cf9b655ccd5fa5167e0ccdb890d92754ed1b1c0730785c186f6615c569b6bbbc36aed26e2423037b1

diff --git a/dev-python/pyzor/files/pyzor-0.5.0-python26_warnings.patch b/dev-python/pyzor/files/pyzor-0.5.0-python26_warnings.patch
deleted file mode 100644
index 671b994b3a2..00000000000
--- a/dev-python/pyzor/files/pyzor-0.5.0-python26_warnings.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-# Description: Fix python2.6 deprecation warnings
-# Origin: Ubuntu
-# Author: Alessio Treglia <quadrispro@ubuntu.com>
-# Bug-Ubuntu: https://bugs.launchpad.net/bugs/394775
-diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/client.py pyzor-0.5.0.new/lib/pyzor/client.py
---- pyzor-0.5.0/lib/pyzor/client.py	2009-04-29 22:53:50.000000000 +0200
-+++ pyzor-0.5.0.new/lib/pyzor/client.py	2009-08-01 12:27:55.749263645 +0200
-@@ -10,7 +10,7 @@
- import tempfile
- import mimetools
- import multifile
--import sha
-+import hashlib
- 
- import pyzor
- from pyzor import *
-@@ -402,12 +402,12 @@
-         del p2
- 
-         saltfile = open(randfile)
--        salt = saltfile.read(sha.digest_size)
-+        salt = saltfile.read(hashlib.sha1().digest_size)
-         del saltfile
- 
--        salt_digest = sha.new(salt)
-+        salt_digest = hashlib.sha1(salt)
- 
--        pass_digest = sha.new()
-+        pass_digest = hashlib.sha1()
-         pass_digest.update(salt_digest.digest())
-         pass_digest.update(p1)
-         sys.stdout.write("salt,key:\n")
-@@ -498,7 +498,7 @@
-         if len(offsets) == 0:
-             return
- 
--        self._digest = sha.new()
-+        self._digest = hashlib.sha1()
- 
-         if len(offsets) <= self.atomic_num_lines:
-             self.handle_atomic(fp)
-diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/__init__.py pyzor-0.5.0.new/lib/pyzor/__init__.py
---- pyzor-0.5.0/lib/pyzor/__init__.py	2009-04-29 22:53:50.000000000 +0200
-+++ pyzor-0.5.0.new/lib/pyzor/__init__.py	2009-08-01 12:28:20.268413580 +0200
-@@ -8,7 +8,7 @@
- import os.path
- import re
- import sys
--import sha
-+import hashlib
- import tempfile
- import random
- import ConfigParser
-@@ -114,7 +114,7 @@
- 
- class DataDigest(str):
-     # hex output doubles digest size
--    value_size = sha.digest_size * 2
-+    value_size = hashlib.sha1().digest_size * 2
- 
-     def __init__(self, value):
-         if len(value) != self.value_size:
-@@ -285,7 +285,7 @@
-         """returns a digest object"""
-         typecheck(msg, Message)
- 
--        return sha.new(str(msg))
-+        return hashlib.sha1(str(msg))
- 
-     hash_msg = staticmethod(hash_msg)
- 
-@@ -295,7 +295,7 @@
-         typecheck(key, long)
-         typecheck(user, Username)
- 
--        return sha.new("%s:%x" % (Username, key)).hexdigest().lower()
-+        return hashlib.sha1("%s:%x" % (Username, key)).hexdigest().lower()
- 
-     hash_key = staticmethod(hash_key)
- 
-@@ -316,7 +316,7 @@
- 
-         h_msg = self.hash_msg(msg)
- 
--        return sha.new("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
-+        return hashlib.sha1("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
- 
-     sign_msg = classmethod(sign_msg)
- 

diff --git a/dev-python/pyzor/files/pyzord_getopt.patch b/dev-python/pyzor/files/pyzord_getopt.patch
deleted file mode 100644
index 42b6fe4339f..00000000000
--- a/dev-python/pyzor/files/pyzord_getopt.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- scripts/pyzord.orig	2002-09-08 06:33:44.000000000 +0300
-+++ scripts/pyzord	2007-07-06 01:31:06.000000000 +0300
-@@ -52,7 +52,11 @@
- # functions above, run below
- 
- debug = 0
--(options, args) = getopt.getopt(sys.argv[1:], 'dh:', ['homedir='])
-+try:
-+    (options, args) = getopt.getopt(sys.argv[1:], 'hd', ['help','homedir='])
-+except getopt.GetoptError, err:
-+    print str(err)
-+    usage()
- if len(args) != 0:
-     usage()
- 
-@@ -61,7 +65,7 @@
- for (o, v) in options:
-     if o == '-d':
-         debug = 1
--    elif o == '-h':
-+    elif o in ('-h', '--help'):
-         usage()
-     elif o == '--homedir':
-         specified_homedir = v

diff --git a/dev-python/pyzor/pyzor-0.5.0-r2.ebuild b/dev-python/pyzor/pyzor-0.5.0-r2.ebuild
deleted file mode 100644
index bc8c5e83621..00000000000
--- a/dev-python/pyzor/pyzor-0.5.0-r2.ebuild
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="3"
-PYTHON_DEPEND="2"
-PYTHON_USE_WITH="gdbm"
-PYTHON_USE_WITH_OPT="pyzord"
-SUPPORT_PYTHON_ABIS="1"
-RESTRICT_PYTHON_ABIS="3.*"
-
-inherit distutils eutils
-
-DESCRIPTION="A distributed, collaborative spam detection and filtering network"
-HOMEPAGE="http://pyzor.sourceforge.net/"
-SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86"
-IUSE="pyzord"
-
-DEPEND=""
-RDEPEND=""
-
-DOCS="THANKS UPGRADING"
-
-src_prepare() {
-	epatch "${FILESDIR}/pyzord_getopt.patch"
-	epatch "${FILESDIR}/${P}-python26_warnings.patch"
-
-	# rfc822BodyCleanerTest doesn't work fine.
-	# Remove it until it's fixed.
-	sed -i \
-		-e '/rfc822BodyCleanerTest/,/self\.assertEqual/d' \
-		unittests.py || die "sed in unittest.py failed"
-}
-
-src_test() {
-	testing() {
-		PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" unittests.py
-	}
-	python_execute_function testing
-}
-
-src_install () {
-	distutils_src_install
-
-	dohtml docs/usage.html
-	rm -rf "${ED}usr/share/doc/pyzor"
-
-	if use pyzord; then
-		dodir /usr/sbin
-		mv "${ED}"usr/bin/pyzord* "${ED}usr/sbin"
-	else
-		rm "${ED}"usr/bin/pyzord*
-	fi
-}
-
-pkg_postinst() {
-	distutils_pkg_postinst
-
-	if use pyzord; then
-		ewarn "/usr/bin/pyzord has been moved to /usr/sbin"
-	fi
-}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyzor/files/, dev-python/pyzor/
@ 2018-03-23 23:35 Michael Orlitzky
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Orlitzky @ 2018-03-23 23:35 UTC (permalink / raw
  To: gentoo-commits

commit:     4d3fe7a396ce39cfe22c324b03d4b48fd359da77
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 18 15:13:33 2018 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 23:34:26 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d3fe7a3

dev-python/pyzor: new revision to fix some open bugs.

Lots of changes all at once:

* Update to EAPI=6.
* Remove an old pkg_postinst() notice about a relocated executable.
* Add IUSE=gdbm to make the gdbm daemon backend optional.
* Only require a (gdbm, mysql, redis) backend with USE=pyzord.
* Add a patch submitted upstream (by me) to fix a unicode crash.
* Require sphinx with USE=doc (bug 636752).
* Remove version constraints on redis-py and gevent (bug 643692).
* Use HOMEPAGE to make SRC_URI fit on one line.
* Add die() to "mv" and "rm" commands in src_install.
* Removed seemingly-unnecessary DISTUTILS_IN_SOURCE_BUILD=1.
* Added myself to metadata.xml as a maintainer.
* Improved the back-end database engine USE flag descriptions.

Bug: https://bugs.gentoo.org/636752
Bug: https://bugs.gentoo.org/643692
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 .../read-stdin-as-binary-in-get_input_msg.patch    | 45 ++++++++++++++
 dev-python/pyzor/metadata.xml                      | 22 +++++--
 dev-python/pyzor/pyzor-1.0.0-r1.ebuild             | 70 ++++++++++++++++++++++
 3 files changed, 133 insertions(+), 4 deletions(-)

diff --git a/dev-python/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch b/dev-python/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch
new file mode 100644
index 00000000000..81668e36937
--- /dev/null
+++ b/dev-python/pyzor/files/read-stdin-as-binary-in-get_input_msg.patch
@@ -0,0 +1,45 @@
+From 6332a429ed415187599ecce7d8a169ee19f0bbe5 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Sun, 4 Mar 2018 17:34:33 -0500
+Subject: [PATCH 1/1] scripts/pyzor: read stdin as binary in _get_input_msg().
+
+Reading stdin in python-3.x is done as text, with a best-guess
+encoding. But this can go awry: for example, if an iso-8859-1 message
+is passed in and if python guesses the "utf-8" encoding, then read()
+will fail with a UnicodeDecodeError on non-ASCII characters. For
+example, the "copyright" symbol is a single byte 0xa9 in iso-8859-1,
+and the utf-8 decoder can't handle it:
+
+  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9... invalid
+  start byte
+
+Instead -- and as was done in python-2.x -- we can read stdin as
+binary using the new get_binary_stdin() function. Afterwards, we use
+email.message_from_bytes() instead of the email.message_from_file()
+constructor to parse the byte data. The resulting function is able to
+correctly parse these messages.
+
+Closes: https://github.com/SpamExperts/pyzor/issues/64
+---
+ scripts/pyzor | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/pyzor b/scripts/pyzor
+index 567a7f9..1ba632f 100755
+--- a/scripts/pyzor
++++ b/scripts/pyzor
+@@ -171,7 +171,10 @@ def _get_input_digests(dummy):
+ 
+ 
+ def _get_input_msg(digester):
+-    msg = email.message_from_file(sys.stdin)
++    # Read and process stdin as bytes because we don't know its
++    # encoding. Python-3.x will try to guess -- and can sometimes
++    # guess wrong -- leading to decoding errors in read().
++    msg = email.message_from_bytes(get_binary_stdin().read())
+     digested = digester(msg).value
+     yield digested
+ 
+-- 
+2.13.6
+

diff --git a/dev-python/pyzor/metadata.xml b/dev-python/pyzor/metadata.xml
index 601b2a90164..d88c249a89f 100644
--- a/dev-python/pyzor/metadata.xml
+++ b/dev-python/pyzor/metadata.xml
@@ -1,15 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
+  <maintainer type="person">
+    <email>mjo@gentoo.org</email>
+  </maintainer>
   <maintainer type="project">
     <email>python@gentoo.org</email>
     <name>Python</name>
   </maintainer>
   <use>
-    <flag name="pyzord">enable support for pyzord</flag>
-    <flag name="mysql">Enables mysql support</flag>
-    <flag name="redis">Enables redis support</flag>
-    <flag name="gevent">Enable support for the gevent based handler</flag>
+    <flag name="pyzord">Enable the pyzord server daemon</flag>
+    <flag name="gdbm">
+      Enables the Gdbm back-end database engine for pyzord
+    </flag>
+    <flag name="mysql">
+      Enables the MySQL back-end database engine for pyzord through
+      <pkg>dev-python/mysql-python</pkg>. Only works with python-2.x!
+    </flag>
+    <flag name="redis">
+      Enables the redis back-end database engine for pyzord through
+      <pkg>dev-python/redis-py</pkg>
+    </flag>
+    <flag name="gevent">
+      Use <pkg>dev-python/gevent</pkg> to enable asynchronous operation
+    </flag>
   </use>
   <upstream>
     <remote-id type="github">SpamExperts/pyzor</remote-id>

diff --git a/dev-python/pyzor/pyzor-1.0.0-r1.ebuild b/dev-python/pyzor/pyzor-1.0.0-r1.ebuild
new file mode 100644
index 00000000000..14e1ee84072
--- /dev/null
+++ b/dev-python/pyzor/pyzor-1.0.0-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit distutils-r1
+
+MY_PV="1-0-0"
+DESCRIPTION="A distributed, collaborative spam detection and filtering network"
+HOMEPAGE="https://github.com/SpamExperts/pyzor"
+SRC_URI="${HOMEPAGE}/archive/release-${MY_PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+IUSE="doc gdbm gevent mysql pyzord redis test"
+
+# The mysql-python library is always required for the MySQL engine. We
+# depend on it conditionally here because otherwise repoman will balk at
+# the potential conflict between PYTHON_TARGETS and USE=mysql. But as a
+# result, if you try to use the MySQL engine with python-3.x, it just
+# won't work because you'll be missing the library.
+RDEPEND="pyzord? (
+	gdbm? ( $(python_gen_impl_dep 'gdbm') )
+	mysql? ( $(python_gen_cond_dep \
+				'dev-python/mysql-python[${PYTHON_USEDEP}]' python2_7) )
+	redis? ( dev-python/redis-py[${PYTHON_USEDEP}] )
+	gevent? ( dev-python/gevent[${PYTHON_USEDEP}] )
+)"
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
+	doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
+	test? ( ${RDEPEND} )"
+
+# TODO: maybe upstream would support skipping tests for which the
+# dependencies are missing?
+REQUIRED_USE="pyzord? ( || ( gdbm mysql redis ) )
+	test? ( gdbm mysql redis )"
+S="${WORKDIR}/${PN}-release-${MY_PV}"
+
+PATCHES=( "${FILESDIR}/read-stdin-as-binary-in-get_input_msg.patch" )
+
+python_test() {
+	# The suite is py2 friendly only
+	if ! python_is_python3; then
+		PYTHONPATH=. "${PYTHON}" ./tests/unit/__init__.py
+	fi
+}
+
+python_compile_all() {
+	use doc && emake -C docs html
+}
+
+python_install_all() {
+	use doc && HTML_DOCS=( docs/.build/html/. )
+	distutils-r1_python_install_all
+}
+
+src_install () {
+	distutils-r1_src_install
+
+	if use pyzord; then
+		dodir /usr/sbin
+		mv "${D}"usr/bin/pyzord* "${ED}usr/sbin" \
+		   || die "failed to relocate pyzord"
+	else
+		rm "${D}"usr/bin/pyzord* || die "failed to remove pyzord"
+	fi
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-23 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-18  9:09 [gentoo-commits] repo/gentoo:master commit in: dev-python/pyzor/files/, dev-python/pyzor/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2018-03-23 23:35 Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox