summaryrefslogtreecommitdiffstats
path: root/third_party/python/setuptools/pkg_resources/extern
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
commitfcea19dfd2c426bac0456da850e7c12258e4b9eb (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /third_party/python/setuptools/pkg_resources/extern
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-3512beca9241712547078681b1a5f1f64df34543.tar.xz
firefox-esr-3512beca9241712547078681b1a5f1f64df34543.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/setuptools/pkg_resources/extern')
-rw-r--r--third_party/python/setuptools/pkg_resources/extern/__init__.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/third_party/python/setuptools/pkg_resources/extern/__init__.py b/third_party/python/setuptools/pkg_resources/extern/__init__.py
index 4dc3beb2fa..948bcc6094 100644
--- a/third_party/python/setuptools/pkg_resources/extern/__init__.py
+++ b/third_party/python/setuptools/pkg_resources/extern/__init__.py
@@ -1,3 +1,4 @@
+import importlib.util
import sys
@@ -20,17 +21,10 @@ class VendorImporter:
yield self.vendor_pkg + '.'
yield ''
- def find_module(self, fullname, path=None):
- """
- Return self when fullname starts with root_name and the
- target module is one vendored through this importer.
- """
+ def _module_matches_namespace(self, fullname):
+ """Figure out if the target module is vendored."""
root, base, target = fullname.partition(self.root_name + '.')
- if root:
- return
- if not any(map(target.startswith, self.vendored_names)):
- return
- return self
+ return not root and any(map(target.startswith, self.vendored_names))
def load_module(self, fullname):
"""
@@ -54,6 +48,20 @@ class VendorImporter:
"distribution.".format(**locals())
)
+ def create_module(self, spec):
+ return self.load_module(spec.name)
+
+ def exec_module(self, module):
+ pass
+
+ def find_spec(self, fullname, path=None, target=None):
+ """Return a module spec for vendored names."""
+ return (
+ importlib.util.spec_from_loader(fullname, self)
+ if self._module_matches_namespace(fullname)
+ else None
+ )
+
def install(self):
"""
Install this importer into sys.meta_path if not already present.
@@ -62,5 +70,11 @@ class VendorImporter:
sys.meta_path.append(self)
-names = 'packaging', 'pyparsing', 'appdirs'
+names = (
+ 'packaging',
+ 'platformdirs',
+ 'jaraco',
+ 'importlib_resources',
+ 'more_itertools',
+)
VendorImporter(__name__, names).install()