diff --git a/srcpkgs/s3cmd/patches/python2.patch b/srcpkgs/s3cmd/patches/python2.patch new file mode 100644 index 00000000000..9faac6d3717 --- /dev/null +++ b/srcpkgs/s3cmd/patches/python2.patch @@ -0,0 +1,52 @@ +From 58dbe1e727573ffb2eb95cc811bce7f56e3b0a25 Mon Sep 17 00:00:00 2001 +From: Florent Viard +Date: Mon, 24 Jul 2017 11:44:49 +0200 +Subject: [PATCH] Fixes #895 - Refactored py3 source to be byte-compilable with + py2 to fix warnings during "setup.py install" + +--- + S3/Custom_httplib3x.py | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/S3/Custom_httplib3x.py b/S3/Custom_httplib3x.py +index 50448a0f..42d84228 100644 +--- S3/Custom_httplib3x.py ++++ S3/Custom_httplib3x.py +@@ -1,6 +1,7 @@ + from __future__ import absolute_import, print_function + + import os ++import sys + import http.client as httplib + + from http.client import (_CS_REQ_SENT, _CS_REQ_STARTED, CONTINUE, UnknownProtocol, +@@ -23,14 +24,18 @@ def _encode(data, name='data'): + try: + return data.encode("latin-1") + except UnicodeEncodeError as err: +- raise UnicodeEncodeError( ++ # The following is equivalent to raise Exception() from None ++ # but is still byte-compilable compatible with python 2. ++ exc = UnicodeEncodeError( + err.encoding, + err.object, + err.start, + err.end, + "%s (%.20r) is not valid Latin-1. Use %s.encode('utf-8') " + "if you want to send it encoded in UTF-8." % +- (name.title(), data[err.start:err.end], name)) from None ++ (name.title(), data[err.start:err.end], name)) ++ exc.__cause__ = None ++ raise exc + + def httpresponse_patched_begin(self): + """ Re-implemented httplib begin function +@@ -204,7 +209,7 @@ def httpconnection_patched_send_request(self, method, url, body, headers, + elif resp.status == CONTINUE: + self.wrapper_send_body(body, encode_chunked) + +-def httpconnection_patched_endheaders(self, message_body=None, *, encode_chunked=False): ++def httpconnection_patched_endheaders(self, message_body=None, encode_chunked=False): + """REIMPLEMENTED because new argument encode_chunked added after py 3.4""" + """Indicate that the last header line has been sent to the server. + diff --git a/srcpkgs/s3cmd/template b/srcpkgs/s3cmd/template index cc7e96d8a0b..65e44dd1cf7 100644 --- a/srcpkgs/s3cmd/template +++ b/srcpkgs/s3cmd/template @@ -1,6 +1,6 @@ # Template file for 's3cmd' pkgname=s3cmd -version=1.6.1 +version=2.0.0 revision=1 noarch=yes build_style=python2-module @@ -8,11 +8,11 @@ pycompile_module="S3" hostmakedepends="python-setuptools" depends="python-dateutil" short_desc="Command line tool for Amazon S3" -maintainer="Eivind Uggedal " +maintainer="Duncaen " license="GPL-2" homepage="http://s3tools.org/s3cmd" distfiles="https://github.com/s3tools/${pkgname}/archive/v${version}.tar.gz" -checksum=e3b962e94068230d4e3ec15b4e827e76cbe7e51dda0e80697ebffbe20b15098b +checksum=12698c115a52e4a705cf3dae67a84da3ccd9516c116bbc9717922d359fb8b18f pre_install() { export S3CMD_INSTPATH_DOC="share/doc"