blob: edbc23ff5e9287c306200b347a1ddb50e5ac5c6d [file] [edit]
diff -urN orig/gsutil/gslib/vendored/boto/boto/plugin.py patched/gsutil/gslib/vendored/boto/boto/plugin.py
--- orig/gsutil/gslib/vendored/boto/boto/plugin.py 2022-10-12 21:40:18.000000000 +0000
+++ patched/gsutil/gslib/vendored/boto/boto/plugin.py 2026-07-27 01:58:12.503399336 +0000
@@ -37,7 +37,12 @@
"""
import glob
-import imp
+try:
+ import importlib.util
+ _use_importlib = True
+except ImportError:
+ import imp
+ _use_importlib = False
import os.path
@@ -70,12 +75,22 @@
(path, name) = os.path.split(filename)
(name, ext) = os.path.splitext(name)
- (file, filename, data) = imp.find_module(name, [path])
- try:
- return imp.load_module(name, file, filename, data)
- finally:
- if file:
- file.close()
+ if _use_importlib:
+ spec = importlib.util.spec_from_file_location(name, filename)
+ if spec is None:
+ raise ImportError("Could not load spec for %s" % filename)
+ module = importlib.util.module_from_spec(spec)
+ import sys
+ sys.modules[name] = module
+ spec.loader.exec_module(module)
+ return module
+ else:
+ (file, filename, data) = imp.find_module(name, [path])
+ try:
+ return imp.load_module(name, file, filename, data)
+ finally:
+ if file:
+ file.close()
_plugin_loaded = False
diff -urN orig/gsutil/gslib/vendored/boto/boto/vendored/six.py patched/gsutil/gslib/vendored/boto/boto/vendored/six.py
--- orig/gsutil/gslib/vendored/boto/boto/vendored/six.py 2022-10-12 21:40:18.000000000 +0000
+++ patched/gsutil/gslib/vendored/boto/boto/vendored/six.py 2026-07-27 01:58:12.502977082 +0000
@@ -72,6 +72,12 @@
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."""
func.__doc__ = doc
@@ -185,6 +191,11 @@
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]
@@ -220,6 +231,12 @@
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__)
diff -urN orig/gsutil/third_party/apitools/apitools/base/protorpclite/messages.py patched/gsutil/third_party/apitools/apitools/base/protorpclite/messages.py
--- orig/gsutil/third_party/apitools/apitools/base/protorpclite/messages.py 2021-05-05 21:58:03.000000000 +0000
+++ patched/gsutil/third_party/apitools/apitools/base/protorpclite/messages.py 2026-07-27 01:58:12.503757796 +0000
@@ -311,7 +311,7 @@
for attribute, value in dct.items():
# Module will be in every enum class.
- if attribute in _RESERVED_ATTRIBUTE_NAMES:
+ if attribute in _RESERVED_ATTRIBUTE_NAMES or (attribute.startswith('__') and attribute.endswith('__')):
continue
# Reject anything that is not an int.
@@ -631,7 +631,7 @@
# dct.
for key, field in dct.items():
- if key in _RESERVED_ATTRIBUTE_NAMES:
+ if key in _RESERVED_ATTRIBUTE_NAMES or (key.startswith('__') and key.endswith('__')):
continue
if isinstance(field, type) and issubclass(field, Enum):
diff -urN orig/gsutil/third_party/six/six.py patched/gsutil/third_party/six/six.py
--- orig/gsutil/third_party/six/six.py 2018-12-10 00:54:51.000000000 +0000
+++ patched/gsutil/third_party/six/six.py 2026-07-27 01:58:12.502701142 +0000
@@ -72,6 +72,12 @@
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."""
func.__doc__ = doc
@@ -186,6 +192,11 @@
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 +234,12 @@
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__)
diff -urN orig/gsutil/third_party/urllib3/src/urllib3/packages/six.py patched/gsutil/third_party/urllib3/src/urllib3/packages/six.py
--- orig/gsutil/third_party/urllib3/src/urllib3/packages/six.py 2020-11-10 19:50:09.000000000 +0000
+++ patched/gsutil/third_party/urllib3/src/urllib3/packages/six.py 2026-07-27 01:58:12.503213057 +0000
@@ -72,6 +72,12 @@
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."""
func.__doc__ = doc
@@ -182,6 +188,11 @@
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]
@@ -221,6 +232,12 @@
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__)