pyzor - fix für python deprecation
Hanno Böck

Hanno Böck commited on 2013-10-15 21:55:11
Zeige 4 geänderte Dateien mit 183 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,4 @@
1
+AUX pyzor-0.5.0-python26_warnings.patch 2680 SHA256 f1b9f51295788ac40c6396ea12a846f0b01d45fa8d87448d764900b3b167b9ff SHA512 e7a8826dc2b02ff24301b116247344ca221008333fbaf1fb4037ed1eef7e317235070fd6f6b70e4ffec0a44de675b1c6ae09da555d6a23295fd4c81301a13c80 WHIRLPOOL c3bdaeb5e2b312434164ec24b83fb067961cbaf164dc568da138ea397deee75c411edbc0b510ca2bd904c76caec079e46251dee5b8af8ca659c689e181b203f7
2
+AUX pyzord_getopt.patch 640 SHA256 6cc675c7caf935342c3728ef399c2ebdb57029d146903aa36593fa3a34f270a9 SHA512 8c405266251f61b0d4b54d3811512067d90521dc04fb0a2df60fc19d27d818fb00849af0c0469187d60fe2d3c6bdde71fbf8320e22b2d5db5e6226c06cde93db WHIRLPOOL 2fef82cb54b2cd03baf29536e121c84b9f1823c9593278c362624cceb180cbd562d57e8147cb6218ba1ceeffb7d4137d0ec64f94cc1d66e9d93effe4bf29ce95
3
+DIST pyzor-0.5.0.tar.bz2 40654 SHA256 2bf3df9e916861063a73f7b46cb8b27bac6f661fce1362803de9e7921fc155ba SHA512 048c81e373be217808f4e4e8f6adbc1b464891b725b3004031dfa7a82abe234b080c3a87bc9ad61ee1df2bfb78ed0ee78565b49843f09243f72b6315df6877a1 WHIRLPOOL 966090015bfe93d4ef059a1186e97705807769f9341e94a2f5d9c223540effac04209a32cad850c6f405225c00aea55bdf7ac5a6a98e0927824d641ee61e5c80
4
+EBUILD pyzor-0.5.0-r1.ebuild 1478 SHA256 edb0e83054daa54a05a25b1a80ec712acbe53e5b85da8e68bb248982a0c3a7ce SHA512 af8c0db7e313db16e9f09b2df8d4225bfee3be18a2690f2b03fdcaba3feb076e4f53bc0ec28165aab941152025d61e219b0d7f137fd916feb5248f0414edd508 WHIRLPOOL 875448bbe0522faf96a766c5b3cf598e00e1804ab9fcbc4816149c90cf38be383231786c8b60177b371f16511dccea423715edf48e561461b0e25eb1f7728753
... ...
@@ -0,0 +1,89 @@
1
+# Description: Fix python2.6 deprecation warnings
2
+# Origin: Ubuntu
3
+# Author: Alessio Treglia <quadrispro@ubuntu.com>
4
+# Bug-Ubuntu: https://bugs.launchpad.net/bugs/394775
5
+diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/client.py pyzor-0.5.0.new/lib/pyzor/client.py
6
+--- pyzor-0.5.0/lib/pyzor/client.py	2009-04-29 22:53:50.000000000 +0200
7
++++ pyzor-0.5.0.new/lib/pyzor/client.py	2009-08-01 12:27:55.749263645 +0200
8
+@@ -10,7 +10,7 @@
9
+ import tempfile
10
+ import mimetools
11
+ import multifile
12
+-import sha
13
++import hashlib
14
+ 
15
+ import pyzor
16
+ from pyzor import *
17
+@@ -402,12 +402,12 @@
18
+         del p2
19
+ 
20
+         saltfile = open(randfile)
21
+-        salt = saltfile.read(sha.digest_size)
22
++        salt = saltfile.read(hashlib.sha1().digest_size)
23
+         del saltfile
24
+ 
25
+-        salt_digest = sha.new(salt)
26
++        salt_digest = hashlib.sha1(salt)
27
+ 
28
+-        pass_digest = sha.new()
29
++        pass_digest = hashlib.sha1()
30
+         pass_digest.update(salt_digest.digest())
31
+         pass_digest.update(p1)
32
+         sys.stdout.write("salt,key:\n")
33
+@@ -498,7 +498,7 @@
34
+         if len(offsets) == 0:
35
+             return
36
+ 
37
+-        self._digest = sha.new()
38
++        self._digest = hashlib.sha1()
39
+ 
40
+         if len(offsets) <= self.atomic_num_lines:
41
+             self.handle_atomic(fp)
42
+diff -Nur -x '*.orig' -x '*~' pyzor-0.5.0/lib/pyzor/__init__.py pyzor-0.5.0.new/lib/pyzor/__init__.py
43
+--- pyzor-0.5.0/lib/pyzor/__init__.py	2009-04-29 22:53:50.000000000 +0200
44
++++ pyzor-0.5.0.new/lib/pyzor/__init__.py	2009-08-01 12:28:20.268413580 +0200
45
+@@ -8,7 +8,7 @@
46
+ import os.path
47
+ import re
48
+ import sys
49
+-import sha
50
++import hashlib
51
+ import tempfile
52
+ import random
53
+ import ConfigParser
54
+@@ -114,7 +114,7 @@
55
+ 
56
+ class DataDigest(str):
57
+     # hex output doubles digest size
58
+-    value_size = sha.digest_size * 2
59
++    value_size = hashlib.sha1().digest_size * 2
60
+ 
61
+     def __init__(self, value):
62
+         if len(value) != self.value_size:
63
+@@ -285,7 +285,7 @@
64
+         """returns a digest object"""
65
+         typecheck(msg, Message)
66
+ 
67
+-        return sha.new(str(msg))
68
++        return hashlib.sha1(str(msg))
69
+ 
70
+     hash_msg = staticmethod(hash_msg)
71
+ 
72
+@@ -295,7 +295,7 @@
73
+         typecheck(key, long)
74
+         typecheck(user, Username)
75
+ 
76
+-        return sha.new("%s:%x" % (Username, key)).hexdigest().lower()
77
++        return hashlib.sha1("%s:%x" % (Username, key)).hexdigest().lower()
78
+ 
79
+     hash_key = staticmethod(hash_key)
80
+ 
81
+@@ -316,7 +316,7 @@
82
+ 
83
+         h_msg = self.hash_msg(msg)
84
+ 
85
+-        return sha.new("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
86
++        return hashlib.sha1("%s:%d:%s" % (h_msg.digest(), ts, hashed_key)).hexdigest().lower()
87
+ 
88
+     sign_msg = classmethod(sign_msg)
89
+ 
... ...
@@ -0,0 +1,24 @@
1
+--- scripts/pyzord.orig	2002-09-08 06:33:44.000000000 +0300
2
++++ scripts/pyzord	2007-07-06 01:31:06.000000000 +0300
3
+@@ -52,7 +52,11 @@
4
+ # functions above, run below
5
+ 
6
+ debug = 0
7
+-(options, args) = getopt.getopt(sys.argv[1:], 'dh:', ['homedir='])
8
++try:
9
++    (options, args) = getopt.getopt(sys.argv[1:], 'hd', ['help','homedir='])
10
++except getopt.GetoptError, err:
11
++    print str(err)
12
++    usage()
13
+ if len(args) != 0:
14
+     usage()
15
+ 
16
+@@ -61,7 +65,7 @@
17
+ for (o, v) in options:
18
+     if o == '-d':
19
+         debug = 1
20
+-    elif o == '-h':
21
++    elif o in ('-h', '--help'):
22
+         usage()
23
+     elif o == '--homedir':
24
+         specified_homedir = v
... ...
@@ -0,0 +1,66 @@
1
+# Copyright 1999-2010 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzor/pyzor-0.5.0-r1.ebuild,v 1.7 2010/07/27 16:49:25 arfrever Exp $
4
+
5
+EAPI="3"
6
+PYTHON_DEPEND="2"
7
+PYTHON_USE_WITH="gdbm"
8
+PYTHON_USE_WITH_OPT="pyzord"
9
+SUPPORT_PYTHON_ABIS="1"
10
+RESTRICT_PYTHON_ABIS="3.*"
11
+
12
+inherit distutils eutils
13
+
14
+DESCRIPTION="A distributed, collaborative spam detection and filtering network"
15
+HOMEPAGE="http://pyzor.sourceforge.net/"
16
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
17
+
18
+LICENSE="GPL-2"
19
+SLOT="0"
20
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86"
21
+IUSE="pyzord"
22
+
23
+DEPEND=""
24
+RDEPEND=""
25
+
26
+DOCS="THANKS UPGRADING"
27
+
28
+src_prepare() {
29
+	epatch "${FILESDIR}/pyzord_getopt.patch"
30
+	epatch "${FILESDIR}/pyzor-0.5.0-python26_warnings.patch"
31
+
32
+	# rfc822BodyCleanerTest doesn't work fine.
33
+	# Remove it until it's fixed.
34
+	sed -i \
35
+		-e '/rfc822BodyCleanerTest/,/self\.assertEqual/d' \
36
+		unittests.py || die "sed in unittest.py failed"
37
+}
38
+
39
+src_test() {
40
+	testing() {
41
+		PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" unittests.py
42
+	}
43
+	python_execute_function testing
44
+}
45
+
46
+src_install () {
47
+	distutils_src_install
48
+
49
+	dohtml docs/usage.html
50
+	rm -rf "${ED}usr/share/doc/pyzor"
51
+
52
+	if use pyzord; then
53
+		dodir /usr/sbin
54
+		mv "${ED}"usr/bin/pyzord* "${ED}usr/sbin"
55
+	else
56
+		rm "${ED}"usr/bin/pyzord*
57
+	fi
58
+}
59
+
60
+pkg_postinst() {
61
+	distutils_pkg_postinst
62
+
63
+	if use pyzord; then
64
+		ewarn "/usr/bin/pyzord has been moved to /usr/sbin"
65
+	fi
66
+}
0 67