Skip to content

Commit f23661e

Browse files
committed
overlay dev-python/boto: Add a patch to make it work on python 3.12
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
1 parent d4e33f7 commit f23661e

File tree

2 files changed

+336
-0
lines changed

2 files changed

+336
-0
lines changed

sdk_container/src/third_party/coreos-overlay/dev-python/boto/boto-2.49.0-r8.ebuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PATCHES=(
2525
"${FILESDIR}"/${P}-unbundle-six.patch
2626
"${FILESDIR}"/${P}-py310.patch
2727
"${FILESDIR}"/${P}-mock-spec.patch
28+
"${FILESDIR}"/${P}-py312.patch
2829
)
2930

3031
RDEPEND="
Lines changed: 335 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,335 @@
1+
diff '--color=auto' -u -r boto-2.49.0/MANIFEST.in boto-2.49.0-patched/MANIFEST.in
2+
--- boto-2.49.0/MANIFEST.in 2018-07-11 17:35:36.000000000 -0000
3+
+++ boto-2.49.0-patched/MANIFEST.in 2026-01-16 15:03:51.938929181 -0000
4+
@@ -6,7 +6,5 @@
5+
include boto/endpoints.json
6+
include boto/pyami/copybot.cfg
7+
include boto/services/sonofmmm.cfg
8+
-include boto/mturk/test/*.doctest
9+
-include boto/mturk/test/.gitignore
10+
recursive-include tests *.json *.py *.txt
11+
recursive-include docs *
12+
diff '--color=auto' -u -r boto-2.49.0/bin/instance_events boto-2.49.0-patched/bin/instance_events
13+
--- boto-2.49.0/bin/instance_events 2018-07-11 17:35:36.000000000 -0000
14+
+++ boto-2.49.0-patched/bin/instance_events 2026-01-16 15:03:43.818883024 -0000
15+
@@ -83,7 +83,7 @@
16+
events[stat.id]['description'] = event.description
17+
events[stat.id]['not_before'] = event.not_before
18+
events[stat.id]['not_after'] = event.not_after
19+
- if completed and re.match('^\[Completed\]',event.description):
20+
+ if completed and re.match(r'^\[Completed\]',event.description):
21+
events[stat.id]['not_before'] = 'Completed'
22+
events[stat.id]['not_after'] = 'Completed'
23+
24+
diff '--color=auto' -u -r boto-2.49.0/bin/launch_instance boto-2.49.0-patched/bin/launch_instance
25+
--- boto-2.49.0/bin/launch_instance 2018-07-11 17:35:36.000000000 -0000
26+
+++ boto-2.49.0-patched/bin/launch_instance 2026-01-16 15:03:43.818883024 -0000
27+
@@ -50,7 +50,7 @@
28+
:param file_url: URL for the file to add, or a local path
29+
:type file_url: str
30+
"""
31+
- if not re.match("^([a-zA-Z0-9]*:\/\/)(.*)", file_url):
32+
+ if not re.match(r"^([a-zA-Z0-9]*:\/\/)(.*)", file_url):
33+
if not file_url.startswith("/"):
34+
file_url = os.path.join(os.getcwd(), file_url)
35+
file_url = "file://%s" % file_url
36+
@@ -58,7 +58,7 @@
37+
base_config = boto.utils.fetch_file(file_url)
38+
base_config.seek(0)
39+
for line in base_config.readlines():
40+
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
41+
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
42+
if match:
43+
self.add_config("%s/%s" % (base_url, match.group(1)))
44+
base_config.seek(0)
45+
@@ -95,7 +95,7 @@
46+
script_raw = boto.utils.fetch_file(scr_url)
47+
script_content = ''
48+
for line in script_raw.readlines():
49+
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
50+
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
51+
#if there is an import
52+
if match:
53+
#Read the other script and put it in that spot
54+
@@ -194,7 +194,7 @@
55+
scriptuples.append(('user_data', user_data))
56+
for scr in scripts:
57+
scr_url = scr
58+
- if not re.match("^([a-zA-Z0-9]*:\/\/)(.*)", scr_url):
59+
+ if not re.match(r"^([a-zA-Z0-9]*:\/\/)(.*)", scr_url):
60+
if not scr_url.startswith("/"):
61+
scr_url = os.path.join(os.getcwd(), scr_url)
62+
try:
63+
diff '--color=auto' -u -r boto-2.49.0/boto/__init__.py boto-2.49.0-patched/boto/__init__.py
64+
--- boto-2.49.0/boto/__init__.py 2018-07-11 20:42:42.000000000 -0000
65+
+++ boto-2.49.0-patched/boto/__init__.py 2026-01-16 15:03:43.822216377 -0000
66+
@@ -1136,7 +1136,7 @@
67+
* gs://bucket
68+
* s3://bucket
69+
* filename (which could be a Unix path like /a/b/c or a Windows path like
70+
- C:\a\b\c)
71+
+ C:\\a\\b\\c)
72+
73+
The last example uses the default scheme ('file', unless overridden).
74+
"""
75+
diff '--color=auto' -u -r boto-2.49.0/boto/cloudfront/distribution.py boto-2.49.0-patched/boto/cloudfront/distribution.py
76+
--- boto-2.49.0/boto/cloudfront/distribution.py 2018-07-11 17:35:36.000000000 -0000
77+
+++ boto-2.49.0-patched/boto/cloudfront/distribution.py 2026-01-16 15:03:43.822216377 -0000
78+
@@ -540,7 +540,7 @@
79+
:type policy_url: str
80+
:param policy_url: If provided, allows the signature to contain
81+
wildcard globs in the URL. For example, you could
82+
- provide: 'http://example.com/media/\*' and the policy
83+
+ provide: 'http://example.com/media/\\*' and the policy
84+
and signature would allow access to all contents of
85+
the media subdirectory. If not specified, only
86+
allow access to the exact url provided in 'url'.
87+
diff '--color=auto' -u -r boto-2.49.0/boto/cloudsearchdomain/layer1.py boto-2.49.0-patched/boto/cloudsearchdomain/layer1.py
88+
--- boto-2.49.0/boto/cloudsearchdomain/layer1.py 2018-07-11 17:35:36.000000000 -0000
89+
+++ boto-2.49.0-patched/boto/cloudsearchdomain/layer1.py 2026-01-16 15:03:43.822216377 -0000
90+
@@ -270,7 +270,7 @@
91+
~ operator to perform a sloppy phrase search. Disabling the `fuzzy`
92+
operator disables the ability to use the ~ operator to perform a
93+
fuzzy search. `escape` disables the ability to use a backslash (
94+
- `\`) to escape special characters within the search string.
95+
+ `\\`) to escape special characters within the search string.
96+
Disabling whitespace is an advanced option that prevents the parser
97+
from tokenizing on whitespace, which can be useful for Vietnamese.
98+
(It prevents Vietnamese words from being split incorrectly.) For
99+
diff '--color=auto' -u -r boto-2.49.0/boto/connection.py boto-2.49.0-patched/boto/connection.py
100+
--- boto-2.49.0/boto/connection.py 2026-01-16 15:03:21.202087596 -0000
101+
+++ boto-2.49.0-patched/boto/connection.py 2026-01-16 15:03:43.822216377 -0000
102+
@@ -664,10 +664,10 @@
103+
self.proxy_pass = proxy_pass
104+
if 'http_proxy' in os.environ and not self.proxy:
105+
pattern = re.compile(
106+
- '(?:http://)?'
107+
- '(?:(?P<user>[\w\-\.]+):(?P<pass>.*)@)?'
108+
- '(?P<host>[\w\-\.]+)'
109+
- '(?::(?P<port>\d+))?'
110+
+ r'(?:http://)?'
111+
+ r'(?:(?P<user>[\w\-\.]+):(?P<pass>.*)@)?'
112+
+ r'(?P<host>[\w\-\.]+)'
113+
+ r'(?::(?P<port>\d+))?'
114+
)
115+
match = pattern.match(os.environ['http_proxy'])
116+
if match:
117+
diff '--color=auto' -u -r boto-2.49.0/boto/gs/resumable_upload_handler.py boto-2.49.0-patched/boto/gs/resumable_upload_handler.py
118+
--- boto-2.49.0/boto/gs/resumable_upload_handler.py 2018-07-11 17:35:36.000000000 -0000
119+
+++ boto-2.49.0-patched/boto/gs/resumable_upload_handler.py 2026-01-16 15:03:43.822216377 -0000
120+
@@ -235,7 +235,7 @@
121+
range_spec = resp.getheader('range')
122+
if range_spec:
123+
# Parse 'bytes=<from>-<to>' range_spec.
124+
- m = re.search('bytes=(\d+)-(\d+)', range_spec)
125+
+ m = re.search(r'bytes=(\d+)-(\d+)', range_spec)
126+
if m:
127+
server_start = long(m.group(1))
128+
server_end = long(m.group(2))
129+
diff '--color=auto' -u -r boto-2.49.0/boto/https_connection.py boto-2.49.0-patched/boto/https_connection.py
130+
--- boto-2.49.0/boto/https_connection.py 2026-01-16 15:03:21.182087483 -0000
131+
+++ boto-2.49.0-patched/boto/https_connection.py 2026-01-16 15:03:43.822216377 -0000
132+
@@ -77,7 +77,7 @@
133+
"validating server certificate: hostname=%s, certificate hosts=%s",
134+
hostname, hosts)
135+
for host in hosts:
136+
- host_re = host.replace('.', '\.').replace('*', '[^.]*')
137+
+ host_re = host.replace('.', r'\.').replace('*', '[^.]*')
138+
if re.search('^%s$' % (host_re,), hostname, re.I):
139+
return True
140+
return False
141+
diff '--color=auto' -u -r boto-2.49.0/boto/iam/connection.py boto-2.49.0-patched/boto/iam/connection.py
142+
--- boto-2.49.0/boto/iam/connection.py 2018-07-11 17:35:36.000000000 -0000
143+
+++ boto-2.49.0-patched/boto/iam/connection.py 2026-01-16 15:03:43.822216377 -0000
144+
@@ -1111,7 +1111,7 @@
145+
else:
146+
147+
for tld, policy in DEFAULT_POLICY_DOCUMENTS.items():
148+
- if tld is 'default':
149+
+ if tld == 'default':
150+
# Skip the default. We'll fall back to it if we don't find
151+
# anything.
152+
continue
153+
diff '--color=auto' -u -r boto-2.49.0/boto/opsworks/layer1.py boto-2.49.0-patched/boto/opsworks/layer1.py
154+
--- boto-2.49.0/boto/opsworks/layer1.py 2018-07-11 17:35:36.000000000 -0000
155+
+++ boto-2.49.0-patched/boto/opsworks/layer1.py 2026-01-16 15:03:43.822216377 -0000
156+
@@ -2657,7 +2657,7 @@
157+
OpsWorksand by Chef. The short name is also used as the name for
158+
the directory where your app files are installed. It can have a
159+
maximum of 200 characters and must be in the following format:
160+
- /\A[a-z0-9\-\_\.]+\Z/.
161+
+ /\\A[a-z0-9\\-\\_\\.]+\\Z/.
162+
163+
:type attributes: map
164+
:param attributes: One or more user-defined key/value pairs to be added
165+
diff '--color=auto' -u -r boto-2.49.0/boto/plugin.py boto-2.49.0-patched/boto/plugin.py
166+
--- boto-2.49.0/boto/plugin.py 2018-07-11 17:35:36.000000000 -0000
167+
+++ boto-2.49.0-patched/boto/plugin.py 2026-01-16 15:03:43.822216377 -0000
168+
@@ -37,8 +37,9 @@
169+
"""
170+
171+
import glob
172+
-import imp
173+
+import importlib
174+
import os.path
175+
+import sys
176+
177+
178+
class Plugin(object):
179+
@@ -70,12 +71,13 @@
180+
(path, name) = os.path.split(filename)
181+
(name, ext) = os.path.splitext(name)
182+
183+
- (file, filename, data) = imp.find_module(name, [path])
184+
+ spec = importlib.util.spec_from_file_location(name, path)
185+
+ module = importlib.util.module_from_spec(spec)
186+
+ sys.modules[module_name] = module
187+
try:
188+
- return imp.load_module(name, file, filename, data)
189+
+ spec.loader.exec_module(module)
190+
finally:
191+
- if file:
192+
- file.close()
193+
+ pass
194+
195+
_plugin_loaded = False
196+
197+
diff '--color=auto' -u -r boto-2.49.0/boto/pyami/config.py boto-2.49.0-patched/boto/pyami/config.py
198+
--- boto-2.49.0/boto/pyami/config.py 2018-07-11 17:35:36.000000000 -0000
199+
+++ boto-2.49.0-patched/boto/pyami/config.py 2026-01-16 15:03:43.822216377 -0000
200+
@@ -95,7 +95,7 @@
201+
def load_from_path(self, path):
202+
file = open(path)
203+
for line in file.readlines():
204+
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
205+
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
206+
if match:
207+
extended_file = match.group(1)
208+
(dir, file) = os.path.split(path)
209+
diff '--color=auto' -u -r boto-2.49.0/boto/pyami/launch_ami.py boto-2.49.0-patched/boto/pyami/launch_ami.py
210+
--- boto-2.49.0/boto/pyami/launch_ami.py 2018-07-11 17:35:36.000000000 -0000
211+
+++ boto-2.49.0-patched/boto/pyami/launch_ami.py 2026-01-16 15:03:43.822216377 -0000
212+
@@ -22,7 +22,7 @@
213+
#
214+
import getopt
215+
import sys
216+
-import imp
217+
+import importlib
218+
import time
219+
import boto
220+
221+
@@ -132,11 +132,11 @@
222+
print('Reloading module %s to S3' % params['script_name'])
223+
else:
224+
print('Copying module %s to S3' % params['script_name'])
225+
- l = imp.find_module(params['script_name'])
226+
+ spec = importlib.util.find_spec(params['script_name'])
227+
c = boto.connect_s3()
228+
bucket = c.get_bucket(params['script_bucket'])
229+
key = bucket.new_key(params['script_name'] + '.py')
230+
- key.set_contents_from_file(l[0])
231+
+ key.set_contents_from_file(spec.origin)
232+
params['script_md5'] = key.md5
233+
# we have everything we need, now build userdata string
234+
l = []
235+
diff '--color=auto' -u -r boto-2.49.0/boto/redshift/layer1.py boto-2.49.0-patched/boto/redshift/layer1.py
236+
--- boto-2.49.0/boto/redshift/layer1.py 2018-07-11 17:35:36.000000000 -0000
237+
+++ boto-2.49.0-patched/boto/redshift/layer1.py 2026-01-16 15:03:43.825549730 -0000
238+
@@ -417,7 +417,7 @@
239+
+ Must contain at least one lowercase letter.
240+
+ Must contain one number.
241+
+ Can be any printable ASCII character (ASCII code 33 to 126) except '
242+
- (single quote), " (double quote), \, /, @, or space.
243+
+ (single quote), " (double quote), \\, /, @, or space.
244+
245+
:type cluster_security_groups: list
246+
:param cluster_security_groups: A list of security groups to be
247+
@@ -2189,7 +2189,7 @@
248+
249+
+ Cannot exceed 512 characters
250+
+ Cannot contain spaces( ), double quotes ("), single quotes ('), a
251+
- backslash (\), or control characters. The hexadecimal codes for
252+
+ backslash (\\), or control characters. The hexadecimal codes for
253+
invalid characters are:
254+
255+
+ x00 to x20
256+
@@ -2363,7 +2363,7 @@
257+
+ Must contain at least one lowercase letter.
258+
+ Must contain one number.
259+
+ Can be any printable ASCII character (ASCII code 33 to 126) except '
260+
- (single quote), " (double quote), \, /, @, or space.
261+
+ (single quote), " (double quote), \\, /, @, or space.
262+
263+
:type cluster_parameter_group_name: string
264+
:param cluster_parameter_group_name: The name of the cluster parameter
265+
diff '--color=auto' -u -r boto-2.49.0/boto/sdb/db/manager/sdbmanager.py boto-2.49.0-patched/boto/sdb/db/manager/sdbmanager.py
266+
--- boto-2.49.0/boto/sdb/db/manager/sdbmanager.py 2018-07-11 17:35:36.000000000 -0000
267+
+++ boto-2.49.0-patched/boto/sdb/db/manager/sdbmanager.py 2026-01-16 15:03:43.825549730 -0000
268+
@@ -345,7 +345,7 @@
269+
key = bucket.new_key(str(uuid.uuid4()))
270+
value.id = "s3://%s/%s" % (key.bucket.name, key.name)
271+
else:
272+
- match = re.match("^s3:\/\/([^\/]*)\/(.*)$", value.id)
273+
+ match = re.match(r"^s3:\/\/([^\/]*)\/(.*)$", value.id)
274+
if match:
275+
s3 = self.manager.get_s3_connection()
276+
bucket = s3.get_bucket(match.group(1), validate=False)
277+
@@ -360,7 +360,7 @@
278+
def decode_blob(self, value):
279+
if not value:
280+
return None
281+
- match = re.match("^s3:\/\/([^\/]*)\/(.*)$", value)
282+
+ match = re.match(r"^s3:\/\/([^\/]*)\/(.*)$", value)
283+
if match:
284+
s3 = self.manager.get_s3_connection()
285+
bucket = s3.get_bucket(match.group(1), validate=False)
286+
diff '--color=auto' -u -r boto-2.49.0/boto/sdb/db/property.py boto-2.49.0-patched/boto/sdb/db/property.py
287+
--- boto-2.49.0/boto/sdb/db/property.py 2018-07-11 17:35:36.000000000 -0000
288+
+++ boto-2.49.0-patched/boto/sdb/db/property.py 2026-01-16 15:03:43.825549730 -0000
289+
@@ -262,7 +262,7 @@
290+
291+
data_type = boto.s3.key.Key
292+
type_name = 'S3Key'
293+
- validate_regex = "^s3:\/\/([^\/]*)\/(.*)$"
294+
+ validate_regex = r"^s3:\/\/([^\/]*)\/(.*)$"
295+
296+
def __init__(self, verbose_name=None, name=None, default=None,
297+
required=False, validator=None, choices=None, unique=False):
298+
diff '--color=auto' -u -r boto-2.49.0/setup.cfg boto-2.49.0-patched/setup.cfg
299+
--- boto-2.49.0/setup.cfg 2018-07-11 20:44:23.000000000 -0000
300+
+++ boto-2.49.0-patched/setup.cfg 2026-01-16 15:03:43.825549730 -0000
301+
@@ -1,6 +1,3 @@
302+
-[bdist_wheel]
303+
-universal = 1
304+
-
305+
[egg_info]
306+
tag_build =
307+
tag_date = 0
308+
diff '--color=auto' -u -r boto-2.49.0/setup.py boto-2.49.0-patched/setup.py
309+
--- boto-2.49.0/setup.py 2018-07-11 17:35:36.000000000 -0000
310+
+++ boto-2.49.0-patched/setup.py 2026-01-16 15:03:43.825549730 -0000
311+
@@ -27,10 +27,8 @@
312+
313+
try:
314+
from setuptools import setup
315+
- extra = dict(test_suite="tests.test.suite", include_package_data=True)
316+
except ImportError:
317+
from distutils.core import setup
318+
- extra = {}
319+
320+
import sys
321+
322+
@@ -91,7 +89,6 @@
323+
platforms = "Posix; MacOS X; Windows",
324+
classifiers = ["Development Status :: 5 - Production/Stable",
325+
"Intended Audience :: Developers",
326+
- "License :: OSI Approved :: MIT License",
327+
"Operating System :: OS Independent",
328+
"Topic :: Internet",
329+
"Programming Language :: Python :: 2",
330+
@@ -100,5 +97,4 @@
331+
"Programming Language :: Python :: 3",
332+
"Programming Language :: Python :: 3.3",
333+
"Programming Language :: Python :: 3.4"],
334+
- **extra
335+
)

0 commit comments

Comments
 (0)