From 28a1d66a8464f0c58a33cd5cda3b85ddad5601e7 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Tue, 1 Jul 2014 12:47:27 +0200 Subject: [PATCH] python-httplib2: update to 0.9 Switch to setuptools. Add python3.4 subpkg with pycompile support. Add patch to use system ca certificates, via Debian. --- .../patches/ssl-mismatch-check.patch | 25 ++++++++++ .../patches/use_system_cacerts.patch | 49 +++++++++++++++++++ srcpkgs/python-httplib2/template | 32 ++++++++---- srcpkgs/python3.4-httplib2 | 1 + 4 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 srcpkgs/python-httplib2/patches/ssl-mismatch-check.patch create mode 100644 srcpkgs/python-httplib2/patches/use_system_cacerts.patch create mode 120000 srcpkgs/python3.4-httplib2 diff --git a/srcpkgs/python-httplib2/patches/ssl-mismatch-check.patch b/srcpkgs/python-httplib2/patches/ssl-mismatch-check.patch new file mode 100644 index 0000000000..4f9e2b3c02 --- /dev/null +++ b/srcpkgs/python-httplib2/patches/ssl-mismatch-check.patch @@ -0,0 +1,25 @@ +Description: Close connection on certificate mismatch to avoid reuse +Author: Roman Podolyaka +Forwarded: https://code.google.com/p/httplib2/issues/detail?id=282 + +diff -r 93291649202b python2/httplib2/__init__.py +--- a/python2/httplib2/__init__.py Tue Mar 26 14:17:48 2013 -0400 ++++ b/python2/httplib2/__init__.py Tue Apr 23 10:32:15 2013 +0300 +@@ -1030,7 +1030,7 @@ + raise CertificateHostnameMismatch( + 'Server presented certificate that does not match ' + 'host %s: %s' % (hostname, cert), hostname, cert) +- except ssl_SSLError, e: ++ except (ssl_SSLError, CertificateHostnameMismatch), e: + if sock: + sock.close() + if self.sock: +@@ -1040,7 +1040,7 @@ + # to get at more detailed error information, in particular + # whether the error is due to certificate validation or + # something else (such as SSL protocol mismatch). +- if e.errno == ssl.SSL_ERROR_SSL: ++ if hasattr(e, 'errno') and e.errno == ssl.SSL_ERROR_SSL: + raise SSLHandshakeError(e) + else: + raise diff --git a/srcpkgs/python-httplib2/patches/use_system_cacerts.patch b/srcpkgs/python-httplib2/patches/use_system_cacerts.patch new file mode 100644 index 0000000000..b198d4e41a --- /dev/null +++ b/srcpkgs/python-httplib2/patches/use_system_cacerts.patch @@ -0,0 +1,49 @@ +Description: Use system ca certificates, not the bundled ones +Author: Marc Deslauriers +Forwarded: not-needed +Bug-Ubuntu: https://launchpad.net/bugs/882027 + +Index: b/python2/httplib2/__init__.py +=================================================================== +--- a/python2/httplib2/__init__.py 2013-03-18 22:37:43.423868573 +0100 ++++ b/python2/httplib2/__init__.py 2013-03-18 22:37:43.419868572 +0100 +@@ -190,9 +190,8 @@ + import ca_certs_locater + CA_CERTS = ca_certs_locater.get() + except ImportError: +- # Default CA certificates file bundled with httplib2. +- CA_CERTS = os.path.join( +- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt") ++ # Use system CA certificates ++ CA_CERTS = "/etc/ssl/certs/ca-certificates.crt" + + # Which headers are hop-by-hop headers by default + HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] +Index: b/python3/httplib2/__init__.py +=================================================================== +--- a/python3/httplib2/__init__.py 2013-03-18 22:37:43.423868573 +0100 ++++ b/python3/httplib2/__init__.py 2013-03-18 22:37:43.419868572 +0100 +@@ -123,9 +123,8 @@ + # Which headers are hop-by-hop headers by default + HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] + +-# Default CA certificates file bundled with httplib2. +-CA_CERTS = os.path.join( +- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt") ++# Use system CA certificates ++CA_CERTS = "/etc/ssl/certs/ca-certificates.crt" + + def _get_end2end_headers(response): + hopbyhop = list(HOP_BY_HOP) +Index: b/setup.py +=================================================================== +--- a/setup.py 2013-03-18 22:37:43.423868573 +0100 ++++ b/setup.py 2013-03-18 22:37:43.419868572 +0100 +@@ -61,7 +61,6 @@ + """, + package_dir=pkgdir, + packages=['httplib2'], +- package_data={'httplib2': ['*.txt']}, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Web Environment', diff --git a/srcpkgs/python-httplib2/template b/srcpkgs/python-httplib2/template index 3425cd1251..a60e63ad1e 100644 --- a/srcpkgs/python-httplib2/template +++ b/srcpkgs/python-httplib2/template @@ -1,16 +1,30 @@ # Template file for 'python-httplib2' pkgname=python-httplib2 -version=0.7.7 -revision=2 +version=0.9 +revision=1 +noarch=yes +patch_args="-Np1" wrksrc="httplib2-${version}" build_style=python-module -hostmakedepends="python-setuptools" -makedepends="python-devel openssl-devel" -noarch="yes" +python_versions="2.7 3.4" +hostmakedepends="python-setuptools python3.4-setuptools" +makedepends="python-devel python3.4-devel openssl-devel" +depends="python" pycompile_module="httplib2" -short_desc="A comprehensive HTTP client library in Python" +short_desc="A comprehensive HTTP client library (Python2)" maintainer="Juan RP " +homepage="https://github.com/jcgregorio/httplib2/" license="MIT" -homepage="http://code.google.com/p/httplib2/" -distfiles="http://httplib2.googlecode.com/files/httplib2-${version}.tar.gz" -checksum=2e2ce18092c32d1ec54f8a447e14e33585e30f240b883bfeeca65f12b3bcfaf6 +distfiles="https://pypi.python.org/packages/source/h/httplib2/httplib2-${version}.tar.gz" +checksum=39ea8c6a6d9f595c177a16134fc49a990ad8d382758cbf469c8659662f2f51ab + +python3.4-httplib2_package() { + noarch=yes + depends="python3.4" + pycompile_version="3.4" + pycompile_module="httplib2" + short_desc="${short_desc/Python2/Python3.4}" + pkg_install() { + vmove usr/lib/python3.4 + } +} diff --git a/srcpkgs/python3.4-httplib2 b/srcpkgs/python3.4-httplib2 new file mode 120000 index 0000000000..a9367265aa --- /dev/null +++ b/srcpkgs/python3.4-httplib2 @@ -0,0 +1 @@ +python-httplib2 \ No newline at end of file