summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hsuan Yen2024-04-07 13:09:59 +0800
committerChih-Hsuan Yen2024-04-09 23:56:19 +0800
commit35f8a7cba3d9adbeaee1ff70ca5767bc389f07b7 (patch)
tree51a5c65d4ff9c7b5866e3fd4a20a64c3e691b209
parente474fc1179cbac928ae01fd273a514ad774620cc (diff)
downloadaur-35f8a7cba3d9adbeaee1ff70ca5767bc389f07b7.tar.gz
Fix building wheels with Python 3.12
There are still test failures, see https://github.com/aws/aws-cli/issues/8342
-rw-r--r--PKGBUILD14
-rw-r--r--botocore-2551.patch367
2 files changed, 378 insertions, 3 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 5c620849de61..84e55a3c8d3a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -27,7 +27,8 @@ source=("https://awscli.amazonaws.com/awscli-$pkgver.tar.gz"{,.sig}
allow-egg-info.diff
botocore-2922.patch
botocore-2924.patch
- botocore-2990-rebased.patch)
+ botocore-2990-rebased.patch
+ botocore-2551.patch)
sha256sums=('427f27e0ab571dffd37b3995c4e99ab36fe09cb42351747848d7f368843dd65b'
'SKIP'
'0267e41561ab2c46a97ebfb024f0b047aabc9e6b9866f204b2c1a84ee5810d63'
@@ -37,7 +38,8 @@ sha256sums=('427f27e0ab571dffd37b3995c4e99ab36fe09cb42351747848d7f368843dd65b'
'6768df8667fe7fd827e6eef1c4cdb3eae25aba5806bbc725270200a585f62152'
'62be6cad0f9039ae682abffd167181abbd4a690e2680867418c5542893d74b36'
'aad8b863d9f9107c56401e71d76b71f526efd9f8efac31e2a007b9071f85b5b6'
- 'a43c3e9aba8974fc09f1780a37b6a94108b15dbbbcecdf6d9e7e224ca135816b')
+ 'a43c3e9aba8974fc09f1780a37b6a94108b15dbbbcecdf6d9e7e224ca135816b'
+ '778c621885dae2218c840eec06a0e0294df7d1180dea12264b34a93994be7c0d')
validpgpkeys=(
'FB5DB77FD5C118B80511ADA8A6310ACC4672475C' # the key mentioned on https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
)
@@ -64,8 +66,9 @@ prepare() {
# tests/dependencies checks dependencies, and many Arch Linux packages are not using PEP 517 yet
patch -Np1 -i ../allow-egg-info.diff
- # Backport fixes for urllib3 2.x to vendored botocore
pushd awscli
+
+ # Backport fixes for urllib3 2.x to vendored botocore
# [Defer to system defaults for cipher suites with urllib3 2.0+](https://github.com/boto/botocore/pull/2922)
patch --no-backup-if-mismatch -Np1 -i ../../botocore-2922.patch
# [Do not set_ciphers(DEFAULT_CIPHERS) if DEFAULT_CIPHERS is None](https://github.com/boto/botocore/pull/2924)
@@ -73,6 +76,11 @@ prepare() {
# [Move 100-continue behavior to use high-level request interface](https://github.com/boto/botocore/pull/2990)
# Manually rebased due to conflicts from refactoring
patch --no-backup-if-mismatch -Np1 -i ../../botocore-2990-rebased.patch
+
+ # Backport an update to vendored six.py for compatibility with Python 3.12
+ # [Update six from 1.10.0 to 1.16.0](https://github.com/boto/botocore/pull/2551)
+ patch --no-backup-if-mismatch -Np1 -i ../../botocore-2551.patch
+
popd
# use unittest.mock
diff --git a/botocore-2551.patch b/botocore-2551.patch
new file mode 100644
index 000000000000..cc78b0f53550
--- /dev/null
+++ b/botocore-2551.patch
@@ -0,0 +1,367 @@
+From c6c63e7b7e248966503d8ff4ac2dfe9e43f1862d Mon Sep 17 00:00:00 2001
+From: Nate Prewitt <nate.prewitt@gmail.com>
+Date: Mon, 1 Nov 2021 11:32:35 -0700
+Subject: [PATCH] Update six from 1.10.0 to 1.16.0
+
+---
+ .changes/next-release/feature-six-62143.json | 5 +
+ botocore/vendored/six.py | 186 ++++++++++++++++---
+ 2 files changed, 163 insertions(+), 28 deletions(-)
+ create mode 100644 .changes/next-release/feature-six-62143.json
+
+diff --git a/.changes/next-release/feature-six-62143.json b/.changes/next-release/feature-six-62143.json
+new file mode 100644
+index 0000000000..c4393201ee
+--- /dev/null
++++ b/.changes/next-release/feature-six-62143.json
+@@ -0,0 +1,5 @@
++{
++ "type": "feature",
++ "category": "``six``",
++ "description": "Updated vendored version of ``six`` from 1.10.0 to 1.16.0"
++}
+diff --git a/botocore/vendored/six.py b/botocore/vendored/six.py
+index 190c0239cd..4e15675d8b 100644
+--- a/botocore/vendored/six.py
++++ b/botocore/vendored/six.py
+@@ -1,6 +1,4 @@
+-"""Utilities for writing code that runs on Python 2 and 3"""
+-
+-# Copyright (c) 2010-2015 Benjamin Peterson
++# Copyright (c) 2010-2020 Benjamin Peterson
+ #
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
+ # of this software and associated documentation files (the "Software"), to deal
+@@ -20,6 +18,8 @@
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ # SOFTWARE.
+
++"""Utilities for writing code that runs on Python 2 and 3"""
++
+ from __future__ import absolute_import
+
+ import functools
+@@ -29,7 +29,7 @@
+ import types
+
+ __author__ = "Benjamin Peterson <benjamin@python.org>"
+-__version__ = "1.10.0"
++__version__ = "1.16.0"
+
+
+ # Useful for very coarse version differentiation.
+@@ -71,6 +71,11 @@ def __len__(self):
+ MAXSIZE = int((1 << 63) - 1)
+ del X
+
++if PY34:
++ from importlib.util import spec_from_loader
++else:
++ spec_from_loader = None
++
+
+ def _add_doc(func, doc):
+ """Add documentation to a function."""
+@@ -186,6 +191,11 @@ def find_module(self, fullname, path=None):
+ return self
+ return None
+
++ def find_spec(self, fullname, path, target=None):
++ if fullname in self.known_modules:
++ return spec_from_loader(fullname, self)
++ return None
++
+ def __get_module(self, fullname):
+ try:
+ return self.known_modules[fullname]
+@@ -223,6 +233,12 @@ def get_code(self, fullname):
+ return None
+ get_source = get_code # same as get_code
+
++ def create_module(self, spec):
++ return self.load_module(spec.name)
++
++ def exec_module(self, module):
++ pass
++
+ _importer = _SixMetaPathImporter(__name__)
+
+
+@@ -241,6 +257,7 @@ class _MovedItems(_LazyModule):
+ MovedAttribute("map", "itertools", "builtins", "imap", "map"),
+ MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
+ MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
++ MovedAttribute("getoutput", "commands", "subprocess"),
+ MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
+ MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
+ MovedAttribute("reduce", "__builtin__", "functools"),
+@@ -254,18 +271,21 @@ class _MovedItems(_LazyModule):
+ MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
+ MovedModule("builtins", "__builtin__"),
+ MovedModule("configparser", "ConfigParser"),
++ MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"),
+ MovedModule("copyreg", "copy_reg"),
+ MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
+- MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
++ MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
++ MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"),
+ MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
+ MovedModule("http_cookies", "Cookie", "http.cookies"),
+ MovedModule("html_entities", "htmlentitydefs", "html.entities"),
+ MovedModule("html_parser", "HTMLParser", "html.parser"),
+ MovedModule("http_client", "httplib", "http.client"),
++ MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
++ MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
+ MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
+ MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
+ MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
+- MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
+ MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
+ MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
+ MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
+@@ -337,10 +357,12 @@ class Module_six_moves_urllib_parse(_LazyModule):
+ MovedAttribute("quote_plus", "urllib", "urllib.parse"),
+ MovedAttribute("unquote", "urllib", "urllib.parse"),
+ MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
++ MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"),
+ MovedAttribute("urlencode", "urllib", "urllib.parse"),
+ MovedAttribute("splitquery", "urllib", "urllib.parse"),
+ MovedAttribute("splittag", "urllib", "urllib.parse"),
+ MovedAttribute("splituser", "urllib", "urllib.parse"),
++ MovedAttribute("splitvalue", "urllib", "urllib.parse"),
+ MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
+ MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
+ MovedAttribute("uses_params", "urlparse", "urllib.parse"),
+@@ -416,6 +438,8 @@ class Module_six_moves_urllib_request(_LazyModule):
+ MovedAttribute("URLopener", "urllib", "urllib.request"),
+ MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
+ MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
++ MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
++ MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
+ ]
+ for attr in _urllib_request_moved_attributes:
+ setattr(Module_six_moves_urllib_request, attr.name, attr)
+@@ -631,13 +655,16 @@ def u(s):
+ import io
+ StringIO = io.StringIO
+ BytesIO = io.BytesIO
++ del io
+ _assertCountEqual = "assertCountEqual"
+ if sys.version_info[1] <= 1:
+ _assertRaisesRegex = "assertRaisesRegexp"
+ _assertRegex = "assertRegexpMatches"
++ _assertNotRegex = "assertNotRegexpMatches"
+ else:
+ _assertRaisesRegex = "assertRaisesRegex"
+ _assertRegex = "assertRegex"
++ _assertNotRegex = "assertNotRegex"
+ else:
+ def b(s):
+ return s
+@@ -659,6 +686,7 @@ def indexbytes(buf, i):
+ _assertCountEqual = "assertItemsEqual"
+ _assertRaisesRegex = "assertRaisesRegexp"
+ _assertRegex = "assertRegexpMatches"
++ _assertNotRegex = "assertNotRegexpMatches"
+ _add_doc(b, """Byte literal""")
+ _add_doc(u, """Text literal""")
+
+@@ -675,15 +703,23 @@ def assertRegex(self, *args, **kwargs):
+ return getattr(self, _assertRegex)(*args, **kwargs)
+
+
++def assertNotRegex(self, *args, **kwargs):
++ return getattr(self, _assertNotRegex)(*args, **kwargs)
++
++
+ if PY3:
+ exec_ = getattr(moves.builtins, "exec")
+
+ def reraise(tp, value, tb=None):
+- if value is None:
+- value = tp()
+- if value.__traceback__ is not tb:
+- raise value.with_traceback(tb)
+- raise value
++ try:
++ if value is None:
++ value = tp()
++ if value.__traceback__ is not tb:
++ raise value.with_traceback(tb)
++ raise value
++ finally:
++ value = None
++ tb = None
+
+ else:
+ def exec_(_code_, _globs_=None, _locs_=None):
+@@ -699,19 +735,19 @@ def exec_(_code_, _globs_=None, _locs_=None):
+ exec("""exec _code_ in _globs_, _locs_""")
+
+ exec_("""def reraise(tp, value, tb=None):
+- raise tp, value, tb
++ try:
++ raise tp, value, tb
++ finally:
++ tb = None
+ """)
+
+
+-if sys.version_info[:2] == (3, 2):
++if sys.version_info[:2] > (3,):
+ exec_("""def raise_from(value, from_value):
+- if from_value is None:
+- raise value
+- raise value from from_value
+-""")
+-elif sys.version_info[:2] > (3, 2):
+- exec_("""def raise_from(value, from_value):
+- raise value from from_value
++ try:
++ raise value from from_value
++ finally:
++ value = None
+ """)
+ else:
+ def raise_from(value, from_value):
+@@ -786,13 +822,33 @@ def print_(*args, **kwargs):
+ _add_doc(reraise, """Reraise an exception.""")
+
+ if sys.version_info[0:2] < (3, 4):
++ # This does exactly the same what the :func:`py3:functools.update_wrapper`
++ # function does on Python versions after 3.2. It sets the ``__wrapped__``
++ # attribute on ``wrapper`` object and it doesn't raise an error if any of
++ # the attributes mentioned in ``assigned`` and ``updated`` are missing on
++ # ``wrapped`` object.
++ def _update_wrapper(wrapper, wrapped,
++ assigned=functools.WRAPPER_ASSIGNMENTS,
++ updated=functools.WRAPPER_UPDATES):
++ for attr in assigned:
++ try:
++ value = getattr(wrapped, attr)
++ except AttributeError:
++ continue
++ else:
++ setattr(wrapper, attr, value)
++ for attr in updated:
++ getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
++ wrapper.__wrapped__ = wrapped
++ return wrapper
++ _update_wrapper.__doc__ = functools.update_wrapper.__doc__
++
+ def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
+ updated=functools.WRAPPER_UPDATES):
+- def wrapper(f):
+- f = functools.wraps(wrapped, assigned, updated)(f)
+- f.__wrapped__ = wrapped
+- return f
+- return wrapper
++ return functools.partial(_update_wrapper, wrapped=wrapped,
++ assigned=assigned, updated=updated)
++ wraps.__doc__ = functools.wraps.__doc__
++
+ else:
+ wraps = functools.wraps
+
+@@ -802,10 +858,22 @@ def with_metaclass(meta, *bases):
+ # This requires a bit of explanation: the basic idea is to make a dummy
+ # metaclass for one level of class instantiation that replaces itself with
+ # the actual metaclass.
+- class metaclass(meta):
++ class metaclass(type):
+
+ def __new__(cls, name, this_bases, d):
+- return meta(name, bases, d)
++ if sys.version_info[:2] >= (3, 7):
++ # This version introduced PEP 560 that requires a bit
++ # of extra care (we mimic what is done by __build_class__).
++ resolved_bases = types.resolve_bases(bases)
++ if resolved_bases is not bases:
++ d['__orig_bases__'] = bases
++ else:
++ resolved_bases = bases
++ return meta(name, resolved_bases, d)
++
++ @classmethod
++ def __prepare__(cls, name, this_bases):
++ return meta.__prepare__(name, bases)
+ return type.__new__(metaclass, 'temporary_class', (), {})
+
+
+@@ -821,13 +889,75 @@ def wrapper(cls):
+ orig_vars.pop(slots_var)
+ orig_vars.pop('__dict__', None)
+ orig_vars.pop('__weakref__', None)
++ if hasattr(cls, '__qualname__'):
++ orig_vars['__qualname__'] = cls.__qualname__
+ return metaclass(cls.__name__, cls.__bases__, orig_vars)
+ return wrapper
+
+
++def ensure_binary(s, encoding='utf-8', errors='strict'):
++ """Coerce **s** to six.binary_type.
++
++ For Python 2:
++ - `unicode` -> encoded to `str`
++ - `str` -> `str`
++
++ For Python 3:
++ - `str` -> encoded to `bytes`
++ - `bytes` -> `bytes`
++ """
++ if isinstance(s, binary_type):
++ return s
++ if isinstance(s, text_type):
++ return s.encode(encoding, errors)
++ raise TypeError("not expecting type '%s'" % type(s))
++
++
++def ensure_str(s, encoding='utf-8', errors='strict'):
++ """Coerce *s* to `str`.
++
++ For Python 2:
++ - `unicode` -> encoded to `str`
++ - `str` -> `str`
++
++ For Python 3:
++ - `str` -> `str`
++ - `bytes` -> decoded to `str`
++ """
++ # Optimization: Fast return for the common case.
++ if type(s) is str:
++ return s
++ if PY2 and isinstance(s, text_type):
++ return s.encode(encoding, errors)
++ elif PY3 and isinstance(s, binary_type):
++ return s.decode(encoding, errors)
++ elif not isinstance(s, (text_type, binary_type)):
++ raise TypeError("not expecting type '%s'" % type(s))
++ return s
++
++
++def ensure_text(s, encoding='utf-8', errors='strict'):
++ """Coerce *s* to six.text_type.
++
++ For Python 2:
++ - `unicode` -> `unicode`
++ - `str` -> `unicode`
++
++ For Python 3:
++ - `str` -> `str`
++ - `bytes` -> decoded to `str`
++ """
++ if isinstance(s, binary_type):
++ return s.decode(encoding, errors)
++ elif isinstance(s, text_type):
++ return s
++ else:
++ raise TypeError("not expecting type '%s'" % type(s))
++
++
+ def python_2_unicode_compatible(klass):
+ """
+- A decorator that defines __unicode__ and __str__ methods under Python 2.
++ A class decorator that defines __unicode__ and __str__ methods under Python 2.
+ Under Python 3 it does nothing.
+
+ To support Python 2 and 3 with a single code base, define a __str__ method