Codebase list s3cmd / e0857b8
Upload to sid Gianfranco Costamagna 3 years ago
3 changed file(s) with 123 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 s3cmd (2.1.0-2) unstable; urgency=medium
1
2 [ Gianfranco Costamagna ]
3 * debian/patches/1144.patch:
4 - cherry-pick another Python 3.9 compatibility fix
5
6 [ Anton Gladky ]
7 * fix compatibility with Python 3.9
8 * Add .gitlab-ci.yml
9
10 -- Gianfranco Costamagna <locutusofborg@debian.org> Fri, 11 Dec 2020 23:36:38 +0100
11
012 s3cmd (2.1.0-1) unstable; urgency=medium
113
214 [ Ondřej Nový ]
0 From 0aebbd52968c6705ccf07e2981d40c25d37e5aeb Mon Sep 17 00:00:00 2001
1 From: Kentaro <kentarokaneki@gmail.com>
2 Date: Sat, 24 Oct 2020 20:25:38 -0400
3 Subject: [PATCH 1/2] Update base64.encodestring for Python 3.9 compatibility
4 encodestring() method was removed from base64 in Python 3.9.
5
6 See the release notes: https://docs.python.org/3.9/whatsnew/3.9.html#removed
7 ---
8 S3/Crypto.py | 2 +-
9 S3/S3.py | 2 +-
10 2 files changed, 2 insertions(+), 2 deletions(-)
11
12 diff --git a/S3/Crypto.py b/S3/Crypto.py
13 index 315c98ff..c320ac4b 100644
14 --- a/S3/Crypto.py
15 +++ b/S3/Crypto.py
16 @@ -63,7 +63,7 @@ def sign_string_v2(string_to_sign):
17 and returned signature will be utf-8 encoded "bytes".
18 """
19 secret_key = Config.Config().secret_key
20 - signature = base64.encodestring(hmac.new(encode_to_s3(secret_key), string_to_sign, sha1).digest()).strip()
21 + signature = base64.encodebytes(hmac.new(encode_to_s3(secret_key), string_to_sign, sha1).digest()).strip()
22 return signature
23 __all__.append("sign_string_v2")
24
25 diff --git a/S3/S3.py b/S3/S3.py
26 index 24a54923..1616afc4 100644
27 --- a/S3/S3.py
28 +++ b/S3/S3.py
29 @@ -2054,7 +2054,7 @@ def parse_attrs_header(attrs_header):
30
31 def compute_content_md5(body):
32 m = md5(encode_to_s3(body))
33 - base64md5 = base64.encodestring(m.digest())
34 + base64md5 = base64.encodebytes(m.digest())
35 base64md5 = decode_from_s3(base64md5)
36 if base64md5[-1] == '\n':
37 base64md5 = base64md5[0:-1]
38
39 From 44cc1a996658eb6d150973018fece5b6d6e1f5bf Mon Sep 17 00:00:00 2001
40 From: Kentaro <kentarokaneki@gmail.com>
41 Date: Wed, 28 Oct 2020 10:15:14 -0400
42 Subject: [PATCH 2/2] Update base64 import to support Python 2 and 3
43
44 ---
45 S3/Crypto.py | 9 +++++++--
46 S3/S3.py | 9 +++++++--
47 2 files changed, 14 insertions(+), 4 deletions(-)
48
49 diff --git a/S3/Crypto.py b/S3/Crypto.py
50 index c320ac4b..7f8eee24 100644
51 --- a/S3/Crypto.py
52 +++ b/S3/Crypto.py
53 @@ -10,7 +10,12 @@
54
55 import sys
56 import hmac
57 -import base64
58 +try:
59 + # Python 2 support
60 + from base64 import encodestring
61 +except ImportError:
62 + # Python 3.9.0+ support
63 + from base64 import encodebytes as encodestring
64
65 from . import Config
66 from logging import debug
67 @@ -63,7 +68,7 @@ def sign_string_v2(string_to_sign):
68 and returned signature will be utf-8 encoded "bytes".
69 """
70 secret_key = Config.Config().secret_key
71 - signature = base64.encodebytes(hmac.new(encode_to_s3(secret_key), string_to_sign, sha1).digest()).strip()
72 + signature = encodestring(hmac.new(encode_to_s3(secret_key), string_to_sign, sha1).digest()).strip()
73 return signature
74 __all__.append("sign_string_v2")
75
76 diff --git a/S3/S3.py b/S3/S3.py
77 index 1616afc4..7fd7b7f2 100644
78 --- a/S3/S3.py
79 +++ b/S3/S3.py
80 @@ -12,7 +12,6 @@
81 import os
82 import time
83 import errno
84 -import base64
85 import mimetypes
86 import io
87 import pprint
88 @@ -25,6 +24,12 @@
89 from urlparse import urlparse
90 except ImportError:
91 from urllib.parse import urlparse
92 +try:
93 + # Python 2 support
94 + from base64 import encodestring
95 +except ImportError:
96 + # Python 3.9.0+ support
97 + from base64 import encodebytes as encodestring
98
99 import select
100
101 @@ -2054,7 +2059,7 @@ def parse_attrs_header(attrs_header):
102
103 def compute_content_md5(body):
104 m = md5(encode_to_s3(body))
105 - base64md5 = base64.encodebytes(m.digest())
106 + base64md5 = encodestring(m.digest())
107 base64md5 = decode_from_s3(base64md5)
108 if base64md5[-1] == '\n':
109 base64md5 = base64md5[0:-1]
00 1137.patch
1 1144.patch