From e4d7f18312fbbc40f4fbcf28a3905c8a47a1335d Mon Sep 17 00:00:00 2001 From: Patrick Lauer Date: Thu, 23 Apr 2009 09:10:39 +0000 Subject: Py 2.6 deprecation fix. Thanks to djc for pointing it out, thanks to Benoit Chesneau for the patch. Fixes #267184 Package-Manager: portage-2.2_rc31/cvs/Linux x86_64 --- dev-python/httplib2/ChangeLog | 9 +- dev-python/httplib2/Manifest | 4 +- dev-python/httplib2/files/compat-2.6-0.4.0.patch | 140 +++++++++++++++++++++++ dev-python/httplib2/httplib2-0.4.0-r1.ebuild | 22 ++++ 4 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 dev-python/httplib2/files/compat-2.6-0.4.0.patch create mode 100644 dev-python/httplib2/httplib2-0.4.0-r1.ebuild (limited to 'dev-python/httplib2') diff --git a/dev-python/httplib2/ChangeLog b/dev-python/httplib2/ChangeLog index 3e67899af05e..88e8cf66d9d9 100644 --- a/dev-python/httplib2/ChangeLog +++ b/dev-python/httplib2/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for dev-python/httplib2 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/httplib2/ChangeLog,v 1.8 2009/04/14 09:45:48 armin76 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/httplib2/ChangeLog,v 1.9 2009/04/23 09:10:39 patrick Exp $ + +*httplib2-0.4.0-r1 (23 Apr 2009) + + 23 Apr 2009; Patrick Lauer + +files/compat-2.6-0.4.0.patch, +httplib2-0.4.0-r1.ebuild: + Py 2.6 deprecation fix. Thanks to djc for pointing it out, thanks to + Benoit Chesneau for the patch. Fixes #267184 14 Apr 2009; Raúl Porcel httplib2-0.4.0.ebuild: x86 stable wrt #264496 diff --git a/dev-python/httplib2/Manifest b/dev-python/httplib2/Manifest index a639b55a3633..903105dc7b84 100644 --- a/dev-python/httplib2/Manifest +++ b/dev-python/httplib2/Manifest @@ -1,6 +1,8 @@ +AUX compat-2.6-0.4.0.patch 4951 RMD160 547cdfce2c92a05905816eeeceedef0ab86ad28e SHA1 1f7e58e60c9dc61e442c64ae0e40a876cabee1de SHA256 6280891b21c9796d96ca5741d6e06e7b24440ffa9d03ca359da4c3ba214f9271 DIST httplib2-0.3.0.tar.gz 16149 RMD160 85d968a2a8f9638a7870b229162b4e7ebd376cc5 SHA1 d8564f49dfd7cc3af73f2bd6376325fcb76cb416 SHA256 20c85b73dd6c4a1d0aeaa21f2d0161fd1e79ea5562cd92e89d63a209a9514372 DIST httplib2-0.4.0.tar.gz 16770 RMD160 1128e7056b1c4ac1045f86bbc6c649cbf7a0a70b SHA1 3bca0a41dc105003c09f41fce48357d84fa89c61 SHA256 816479fb906a7832527eab6852961f0ce7460f7159f0dd13cbef34721a2174d4 EBUILD httplib2-0.3.0.ebuild 509 RMD160 26f044567f98162926ed94540e3b2d42026f0b8c SHA1 fbb76b9027a6dd42a3b7ea5ae78152fd01204c19 SHA256 33277d9a22db4a479c67fef42b14dfa9c3c1865cbd2f5cecd1a36ba124cbd0e9 +EBUILD httplib2-0.4.0-r1.ebuild 598 RMD160 ac0fc1db35dbb4e67b06fc77792d606666538bb5 SHA1 f3fbbee1b5c60190f87b7bc6f589dc638b4fb388 SHA256 ed9436869dd69e7996276da3e2824560781e1cde9e860ad499243c5b7bbb5fd5 EBUILD httplib2-0.4.0.ebuild 507 RMD160 172c0d8995fb46fde49aaa40964472d1c4b00547 SHA1 0ebe3b296ae4514034ad242ed8ff657bef14b888 SHA256 5a8cffd82871964fe4d8a44a52123503e13fe1349dd53c9ea43b7a35ae8906e9 -MISC ChangeLog 1280 RMD160 ee0e33effadbadc4b8cdba4a361949af97676593 SHA1 1853c3c19baf5965a4f1c35c7ac800338ba92cb7 SHA256 9154261d0e6da089c1b95a9bc44663c0c07f50e1eb6c0b372bd2310e06c2d77b +MISC ChangeLog 1543 RMD160 a9ea287b99c1b3d442ae3a88415bbe9ac65afcb1 SHA1 1648500198ecb37a0a2ed3e53edf60344bd827bf SHA256 040d19a8ab6c1af3fbf8c1fbab0ef18daf7690c7849d0146deab0ee63d87f834 MISC metadata.xml 307 RMD160 8783f9c7caa0f013592c0e28ecb741ab614ce97d SHA1 b1155712613e27fcfe580d2112e46a73320d1505 SHA256 9d84958e04cbafc80b45ce283fc20395695cad045774239d45d337e8bfccd867 diff --git a/dev-python/httplib2/files/compat-2.6-0.4.0.patch b/dev-python/httplib2/files/compat-2.6-0.4.0.patch new file mode 100644 index 000000000000..f02232ce5e93 --- /dev/null +++ b/dev-python/httplib2/files/compat-2.6-0.4.0.patch @@ -0,0 +1,140 @@ +Index: httplib2/__init__.py +=================================================================== +--- httplib2/__init__.py (revision 274) ++++ httplib2/__init__.py (revision 275) +@@ -26,7 +26,6 @@ + + import re + import sys +-import md5 + import email + import email.Utils + import email.Message +@@ -42,7 +41,14 @@ + import calendar + import time + import random +-import sha ++# remove depracated warning in python2.6 ++try: ++ from hashlib import sha1 as _sha, md5 as _md5 ++except ImportError: ++ import sha ++ import md5 ++ _sha = sha.new ++ _md5 = md5.new + import hmac + from gettext import gettext as _ + import socket +@@ -52,12 +58,27 @@ + except ImportError: + socks = None + ++# Build the appropriate socket wrapper for ssl ++try: ++ import ssl # python 2.6 ++ _ssl_wrap_socket = ssl.wrap_socket ++except ImportError: ++ def _ssl_wrap_socket(sock, key_file, cert_file): ++ ssl_sock = socket.ssl(sock, key_file, cert_file) ++ return httplib.FakeSocket(sock, ssl_sock) ++ ++ + if sys.version_info >= (2,3): + from iri2uri import iri2uri + else: + def iri2uri(uri): + return uri + ++def has_timeout(timeout): # python 2.6 ++ if hasattr(socket, '_GLOBAL_DEFAULT_TIMEOUT'): ++ return (timeout is not None and timeout is not socket._GLOBAL_DEFAULT_TIMEOUT) ++ return (timeout is not None) ++ + __all__ = ['Http', 'Response', 'ProxyInfo', 'HttpLib2Error', + 'RedirectMissingLocation', 'RedirectLimit', 'FailedToDecompressContent', + 'UnimplementedDigestAuthOptionError', 'UnimplementedHmacDigestAuthOptionError', +@@ -182,7 +203,7 @@ + pass + if isinstance(filename,unicode): + filename=filename.encode('utf-8') +- filemd5 = md5.new(filename).hexdigest() ++ filemd5 = _md5(filename).hexdigest() + filename = re_url_scheme.sub("", filename) + filename = re_slash.sub(",", filename) + +@@ -363,11 +384,11 @@ + cache.set(cachekey, text) + + def _cnonce(): +- dig = md5.new("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest() ++ dig = _md5("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest() + return dig[:16] + + def _wsse_username_token(cnonce, iso_now, password): +- return base64.encodestring(sha.new("%s%s%s" % (cnonce, iso_now, password)).digest()).strip() ++ return base64.encodestring(_sha("%s%s%s" % (cnonce, iso_now, password)).digest()).strip() + + + # For credentials we need two things, first +@@ -441,7 +462,7 @@ + + def request(self, method, request_uri, headers, content, cnonce = None): + """Modify the request headers""" +- H = lambda x: md5.new(x).hexdigest() ++ H = lambda x: _md5(x).hexdigest() + KD = lambda s, d: H("%s:%s" % (s, d)) + A2 = "".join([method, ":", request_uri]) + self.challenge['cnonce'] = cnonce or _cnonce() +@@ -501,13 +522,13 @@ + if self.challenge['pw-algorithm'] not in ['SHA-1', 'MD5']: + raise UnimplementedHmacDigestAuthOptionError( _("Unsupported value for pw-algorithm: %s." % self.challenge['pw-algorithm'])) + if self.challenge['algorithm'] == 'HMAC-MD5': +- self.hashmod = md5 ++ self.hashmod = _md5 + else: +- self.hashmod = sha ++ self.hashmod = _sha + if self.challenge['pw-algorithm'] == 'MD5': +- self.pwhashmod = md5 ++ self.pwhashmod = _md5 + else: +- self.pwhashmod = sha ++ self.pwhashmod = _sha + self.key = "".join([self.credentials[0], ":", + self.pwhashmod.new("".join([self.credentials[1], self.challenge['salt']])).hexdigest().lower(), + ":", self.challenge['realm'] +@@ -604,9 +625,6 @@ + + AUTH_SCHEME_ORDER = ["hmacdigest", "googlelogin", "digest", "wsse", "basic"] + +-def _md5(s): +- return +- + class FileCache(object): + """Uses a local directory as a store for cached files. + Not really safe to use if multiple threads or processes are going to +@@ -701,7 +719,7 @@ + else: + self.sock = socket.socket(af, socktype, proto) + # Different from httplib: support timeouts. +- if self.timeout is not None: ++ if has_timeout(self.timeout): + self.sock.settimeout(self.timeout) + # End of difference from httplib. + if self.debuglevel > 0: +@@ -737,11 +755,11 @@ + sock.setproxy(*self.proxy_info.astuple()) + else: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +- if self.timeout is not None: ++ ++ if has_timeout(self.timeout): + sock.settimeout(self.timeout) + sock.connect((self.host, self.port)) +- ssl = socket.ssl(sock, self.key_file, self.cert_file) +- self.sock = httplib.FakeSocket(sock, ssl) ++ self.sock =_ssl_wrap_socket(sock, self.key_file, self.cert_file) + + + diff --git a/dev-python/httplib2/httplib2-0.4.0-r1.ebuild b/dev-python/httplib2/httplib2-0.4.0-r1.ebuild new file mode 100644 index 000000000000..2aabd544e588 --- /dev/null +++ b/dev-python/httplib2/httplib2-0.4.0-r1.ebuild @@ -0,0 +1,22 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/httplib2/httplib2-0.4.0-r1.ebuild,v 1.1 2009/04/23 09:10:39 patrick Exp $ + +NEED_PYTHON=2.3 + +inherit distutils + +DESCRIPTION="A comprehensive HTTP client library with caching and authentication." +HOMEPAGE="http://code.google.com/p/httplib2/" +SRC_URI="http://httplib2.googlecode.com/files/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" + +IUSE="" + +src_unpack() { + distutils_src_unpack + epatch "${FILESDIR}"/compat-2.6-${PV}.patch +} -- cgit v1.2.3-65-gdbad