overlay dev-python/boto: Add a patch to make it work on python 3.12

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
This commit is contained in:
Krzesimir Nowak 2026-01-16 15:22:23 +01:00
parent d4e33f7a4c
commit f23661e2d0
2 changed files with 336 additions and 0 deletions

View File

@ -25,6 +25,7 @@ PATCHES=(
"${FILESDIR}"/${P}-unbundle-six.patch
"${FILESDIR}"/${P}-py310.patch
"${FILESDIR}"/${P}-mock-spec.patch
"${FILESDIR}"/${P}-py312.patch
)
RDEPEND="

View File

@ -0,0 +1,335 @@
diff '--color=auto' -u -r boto-2.49.0/MANIFEST.in boto-2.49.0-patched/MANIFEST.in
--- boto-2.49.0/MANIFEST.in 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/MANIFEST.in 2026-01-16 15:03:51.938929181 -0000
@@ -6,7 +6,5 @@
include boto/endpoints.json
include boto/pyami/copybot.cfg
include boto/services/sonofmmm.cfg
-include boto/mturk/test/*.doctest
-include boto/mturk/test/.gitignore
recursive-include tests *.json *.py *.txt
recursive-include docs *
diff '--color=auto' -u -r boto-2.49.0/bin/instance_events boto-2.49.0-patched/bin/instance_events
--- boto-2.49.0/bin/instance_events 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/bin/instance_events 2026-01-16 15:03:43.818883024 -0000
@@ -83,7 +83,7 @@
events[stat.id]['description'] = event.description
events[stat.id]['not_before'] = event.not_before
events[stat.id]['not_after'] = event.not_after
- if completed and re.match('^\[Completed\]',event.description):
+ if completed and re.match(r'^\[Completed\]',event.description):
events[stat.id]['not_before'] = 'Completed'
events[stat.id]['not_after'] = 'Completed'
diff '--color=auto' -u -r boto-2.49.0/bin/launch_instance boto-2.49.0-patched/bin/launch_instance
--- boto-2.49.0/bin/launch_instance 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/bin/launch_instance 2026-01-16 15:03:43.818883024 -0000
@@ -50,7 +50,7 @@
:param file_url: URL for the file to add, or a local path
:type file_url: str
"""
- if not re.match("^([a-zA-Z0-9]*:\/\/)(.*)", file_url):
+ if not re.match(r"^([a-zA-Z0-9]*:\/\/)(.*)", file_url):
if not file_url.startswith("/"):
file_url = os.path.join(os.getcwd(), file_url)
file_url = "file://%s" % file_url
@@ -58,7 +58,7 @@
base_config = boto.utils.fetch_file(file_url)
base_config.seek(0)
for line in base_config.readlines():
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
if match:
self.add_config("%s/%s" % (base_url, match.group(1)))
base_config.seek(0)
@@ -95,7 +95,7 @@
script_raw = boto.utils.fetch_file(scr_url)
script_content = ''
for line in script_raw.readlines():
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
#if there is an import
if match:
#Read the other script and put it in that spot
@@ -194,7 +194,7 @@
scriptuples.append(('user_data', user_data))
for scr in scripts:
scr_url = scr
- if not re.match("^([a-zA-Z0-9]*:\/\/)(.*)", scr_url):
+ if not re.match(r"^([a-zA-Z0-9]*:\/\/)(.*)", scr_url):
if not scr_url.startswith("/"):
scr_url = os.path.join(os.getcwd(), scr_url)
try:
diff '--color=auto' -u -r boto-2.49.0/boto/__init__.py boto-2.49.0-patched/boto/__init__.py
--- boto-2.49.0/boto/__init__.py 2018-07-11 20:42:42.000000000 -0000
+++ boto-2.49.0-patched/boto/__init__.py 2026-01-16 15:03:43.822216377 -0000
@@ -1136,7 +1136,7 @@
* gs://bucket
* s3://bucket
* filename (which could be a Unix path like /a/b/c or a Windows path like
- C:\a\b\c)
+ C:\\a\\b\\c)
The last example uses the default scheme ('file', unless overridden).
"""
diff '--color=auto' -u -r boto-2.49.0/boto/cloudfront/distribution.py boto-2.49.0-patched/boto/cloudfront/distribution.py
--- boto-2.49.0/boto/cloudfront/distribution.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/cloudfront/distribution.py 2026-01-16 15:03:43.822216377 -0000
@@ -540,7 +540,7 @@
:type policy_url: str
:param policy_url: If provided, allows the signature to contain
wildcard globs in the URL. For example, you could
- provide: 'http://example.com/media/\*' and the policy
+ provide: 'http://example.com/media/\\*' and the policy
and signature would allow access to all contents of
the media subdirectory. If not specified, only
allow access to the exact url provided in 'url'.
diff '--color=auto' -u -r boto-2.49.0/boto/cloudsearchdomain/layer1.py boto-2.49.0-patched/boto/cloudsearchdomain/layer1.py
--- boto-2.49.0/boto/cloudsearchdomain/layer1.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/cloudsearchdomain/layer1.py 2026-01-16 15:03:43.822216377 -0000
@@ -270,7 +270,7 @@
~ operator to perform a sloppy phrase search. Disabling the `fuzzy`
operator disables the ability to use the ~ operator to perform a
fuzzy search. `escape` disables the ability to use a backslash (
- `\`) to escape special characters within the search string.
+ `\\`) to escape special characters within the search string.
Disabling whitespace is an advanced option that prevents the parser
from tokenizing on whitespace, which can be useful for Vietnamese.
(It prevents Vietnamese words from being split incorrectly.) For
diff '--color=auto' -u -r boto-2.49.0/boto/connection.py boto-2.49.0-patched/boto/connection.py
--- boto-2.49.0/boto/connection.py 2026-01-16 15:03:21.202087596 -0000
+++ boto-2.49.0-patched/boto/connection.py 2026-01-16 15:03:43.822216377 -0000
@@ -664,10 +664,10 @@
self.proxy_pass = proxy_pass
if 'http_proxy' in os.environ and not self.proxy:
pattern = re.compile(
- '(?:http://)?'
- '(?:(?P<user>[\w\-\.]+):(?P<pass>.*)@)?'
- '(?P<host>[\w\-\.]+)'
- '(?::(?P<port>\d+))?'
+ r'(?:http://)?'
+ r'(?:(?P<user>[\w\-\.]+):(?P<pass>.*)@)?'
+ r'(?P<host>[\w\-\.]+)'
+ r'(?::(?P<port>\d+))?'
)
match = pattern.match(os.environ['http_proxy'])
if match:
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
--- boto-2.49.0/boto/gs/resumable_upload_handler.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/gs/resumable_upload_handler.py 2026-01-16 15:03:43.822216377 -0000
@@ -235,7 +235,7 @@
range_spec = resp.getheader('range')
if range_spec:
# Parse 'bytes=<from>-<to>' range_spec.
- m = re.search('bytes=(\d+)-(\d+)', range_spec)
+ m = re.search(r'bytes=(\d+)-(\d+)', range_spec)
if m:
server_start = long(m.group(1))
server_end = long(m.group(2))
diff '--color=auto' -u -r boto-2.49.0/boto/https_connection.py boto-2.49.0-patched/boto/https_connection.py
--- boto-2.49.0/boto/https_connection.py 2026-01-16 15:03:21.182087483 -0000
+++ boto-2.49.0-patched/boto/https_connection.py 2026-01-16 15:03:43.822216377 -0000
@@ -77,7 +77,7 @@
"validating server certificate: hostname=%s, certificate hosts=%s",
hostname, hosts)
for host in hosts:
- host_re = host.replace('.', '\.').replace('*', '[^.]*')
+ host_re = host.replace('.', r'\.').replace('*', '[^.]*')
if re.search('^%s$' % (host_re,), hostname, re.I):
return True
return False
diff '--color=auto' -u -r boto-2.49.0/boto/iam/connection.py boto-2.49.0-patched/boto/iam/connection.py
--- boto-2.49.0/boto/iam/connection.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/iam/connection.py 2026-01-16 15:03:43.822216377 -0000
@@ -1111,7 +1111,7 @@
else:
for tld, policy in DEFAULT_POLICY_DOCUMENTS.items():
- if tld is 'default':
+ if tld == 'default':
# Skip the default. We'll fall back to it if we don't find
# anything.
continue
diff '--color=auto' -u -r boto-2.49.0/boto/opsworks/layer1.py boto-2.49.0-patched/boto/opsworks/layer1.py
--- boto-2.49.0/boto/opsworks/layer1.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/opsworks/layer1.py 2026-01-16 15:03:43.822216377 -0000
@@ -2657,7 +2657,7 @@
OpsWorksand by Chef. The short name is also used as the name for
the directory where your app files are installed. It can have a
maximum of 200 characters and must be in the following format:
- /\A[a-z0-9\-\_\.]+\Z/.
+ /\\A[a-z0-9\\-\\_\\.]+\\Z/.
:type attributes: map
:param attributes: One or more user-defined key/value pairs to be added
diff '--color=auto' -u -r boto-2.49.0/boto/plugin.py boto-2.49.0-patched/boto/plugin.py
--- boto-2.49.0/boto/plugin.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/plugin.py 2026-01-16 15:03:43.822216377 -0000
@@ -37,8 +37,9 @@
"""
import glob
-import imp
+import importlib
import os.path
+import sys
class Plugin(object):
@@ -70,12 +71,13 @@
(path, name) = os.path.split(filename)
(name, ext) = os.path.splitext(name)
- (file, filename, data) = imp.find_module(name, [path])
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[module_name] = module
try:
- return imp.load_module(name, file, filename, data)
+ spec.loader.exec_module(module)
finally:
- if file:
- file.close()
+ pass
_plugin_loaded = False
diff '--color=auto' -u -r boto-2.49.0/boto/pyami/config.py boto-2.49.0-patched/boto/pyami/config.py
--- boto-2.49.0/boto/pyami/config.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/pyami/config.py 2026-01-16 15:03:43.822216377 -0000
@@ -95,7 +95,7 @@
def load_from_path(self, path):
file = open(path)
for line in file.readlines():
- match = re.match("^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
+ match = re.match(r"^#import[\s\t]*([^\s^\t]*)[\s\t]*$", line)
if match:
extended_file = match.group(1)
(dir, file) = os.path.split(path)
diff '--color=auto' -u -r boto-2.49.0/boto/pyami/launch_ami.py boto-2.49.0-patched/boto/pyami/launch_ami.py
--- boto-2.49.0/boto/pyami/launch_ami.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/pyami/launch_ami.py 2026-01-16 15:03:43.822216377 -0000
@@ -22,7 +22,7 @@
#
import getopt
import sys
-import imp
+import importlib
import time
import boto
@@ -132,11 +132,11 @@
print('Reloading module %s to S3' % params['script_name'])
else:
print('Copying module %s to S3' % params['script_name'])
- l = imp.find_module(params['script_name'])
+ spec = importlib.util.find_spec(params['script_name'])
c = boto.connect_s3()
bucket = c.get_bucket(params['script_bucket'])
key = bucket.new_key(params['script_name'] + '.py')
- key.set_contents_from_file(l[0])
+ key.set_contents_from_file(spec.origin)
params['script_md5'] = key.md5
# we have everything we need, now build userdata string
l = []
diff '--color=auto' -u -r boto-2.49.0/boto/redshift/layer1.py boto-2.49.0-patched/boto/redshift/layer1.py
--- boto-2.49.0/boto/redshift/layer1.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/redshift/layer1.py 2026-01-16 15:03:43.825549730 -0000
@@ -417,7 +417,7 @@
+ Must contain at least one lowercase letter.
+ Must contain one number.
+ Can be any printable ASCII character (ASCII code 33 to 126) except '
- (single quote), " (double quote), \, /, @, or space.
+ (single quote), " (double quote), \\, /, @, or space.
:type cluster_security_groups: list
:param cluster_security_groups: A list of security groups to be
@@ -2189,7 +2189,7 @@
+ Cannot exceed 512 characters
+ Cannot contain spaces( ), double quotes ("), single quotes ('), a
- backslash (\), or control characters. The hexadecimal codes for
+ backslash (\\), or control characters. The hexadecimal codes for
invalid characters are:
+ x00 to x20
@@ -2363,7 +2363,7 @@
+ Must contain at least one lowercase letter.
+ Must contain one number.
+ Can be any printable ASCII character (ASCII code 33 to 126) except '
- (single quote), " (double quote), \, /, @, or space.
+ (single quote), " (double quote), \\, /, @, or space.
:type cluster_parameter_group_name: string
:param cluster_parameter_group_name: The name of the cluster parameter
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
--- boto-2.49.0/boto/sdb/db/manager/sdbmanager.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/sdb/db/manager/sdbmanager.py 2026-01-16 15:03:43.825549730 -0000
@@ -345,7 +345,7 @@
key = bucket.new_key(str(uuid.uuid4()))
value.id = "s3://%s/%s" % (key.bucket.name, key.name)
else:
- match = re.match("^s3:\/\/([^\/]*)\/(.*)$", value.id)
+ match = re.match(r"^s3:\/\/([^\/]*)\/(.*)$", value.id)
if match:
s3 = self.manager.get_s3_connection()
bucket = s3.get_bucket(match.group(1), validate=False)
@@ -360,7 +360,7 @@
def decode_blob(self, value):
if not value:
return None
- match = re.match("^s3:\/\/([^\/]*)\/(.*)$", value)
+ match = re.match(r"^s3:\/\/([^\/]*)\/(.*)$", value)
if match:
s3 = self.manager.get_s3_connection()
bucket = s3.get_bucket(match.group(1), validate=False)
diff '--color=auto' -u -r boto-2.49.0/boto/sdb/db/property.py boto-2.49.0-patched/boto/sdb/db/property.py
--- boto-2.49.0/boto/sdb/db/property.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/boto/sdb/db/property.py 2026-01-16 15:03:43.825549730 -0000
@@ -262,7 +262,7 @@
data_type = boto.s3.key.Key
type_name = 'S3Key'
- validate_regex = "^s3:\/\/([^\/]*)\/(.*)$"
+ validate_regex = r"^s3:\/\/([^\/]*)\/(.*)$"
def __init__(self, verbose_name=None, name=None, default=None,
required=False, validator=None, choices=None, unique=False):
diff '--color=auto' -u -r boto-2.49.0/setup.cfg boto-2.49.0-patched/setup.cfg
--- boto-2.49.0/setup.cfg 2018-07-11 20:44:23.000000000 -0000
+++ boto-2.49.0-patched/setup.cfg 2026-01-16 15:03:43.825549730 -0000
@@ -1,6 +1,3 @@
-[bdist_wheel]
-universal = 1
-
[egg_info]
tag_build =
tag_date = 0
diff '--color=auto' -u -r boto-2.49.0/setup.py boto-2.49.0-patched/setup.py
--- boto-2.49.0/setup.py 2018-07-11 17:35:36.000000000 -0000
+++ boto-2.49.0-patched/setup.py 2026-01-16 15:03:43.825549730 -0000
@@ -27,10 +27,8 @@
try:
from setuptools import setup
- extra = dict(test_suite="tests.test.suite", include_package_data=True)
except ImportError:
from distutils.core import setup
- extra = {}
import sys
@@ -91,7 +89,6 @@
platforms = "Posix; MacOS X; Windows",
classifiers = ["Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Internet",
"Programming Language :: Python :: 2",
@@ -100,5 +97,4 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4"],
- **extra
)