We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Forward compatibility][BUG] pkg_resources.extern.VendorImporter lacks find_spec() method
### setuptools version

54.1.2 and main

### Python version

3.10.0a7

### OS

All

### Additional environment information

When running tests for setuptools_scm.

### Description

We get:

```python-traceback
<frozen importlib._bootstrap>:933: in _find_spec
    ???
E   AttributeError: 'VendorImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:
/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file
    elif _is_doctest(config, path, parent):
/usr/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest
    if path.check(fnmatch=glob):
/usr/lib/python3.10/site-packages/py/_path/local.py:387: in check
    return super(LocalPath, self).check(**kw)
/usr/lib/python3.10/site-packages/py/_path/common.py:241: in check
    return self.Checkers(self)._evaluate(kw)
/usr/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate
    if py.code.getrawcode(meth).co_argcount > 1:
/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr
    result = importobj(modpath, attrname)
/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj
    module = __import__(modpath, None, None, ['__doc__'])
/usr/lib/python3.10/site-packages/py/_code/code.py:7: in <module>
    reprlib = py.builtin._tryimport('repr', 'reprlib')
/usr/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport
    __import__(name)
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
<frozen importlib._bootstrap>:908: in _find_spec_legacy
    ???
E   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()
```

The traceback is not very helpful, but the VendorImporter is from pkg_resourecs.

Python added a warning: https://bugs.python.org/issue42134 but other packages treat it as error.

### Expected behavior

No ImportWarning.

### How to Reproduce

1. Get Python 3.10.0a7 and tox (e.g. on Fedora via `$ sudo dnf --enablerepo=updates-testing install python3.10 tox`)
2. git clone https://github.com/pypa/setuptools_scm.git and cd in
3. Run `tox -e py310-test`

### Output

```console
py310-test develop-inst-nodeps: .../setuptools_scm
py310-test installed: attrs==20.3.0,iniconfig==1.1.1,packaging==20.9,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pytest==6.2.3,-e git+https://github.com/pypa/setuptools_scm.git@abb67b15985f380d8cf4451b9f2ef3dd11cb8a91#egg=setuptools_scm,toml==0.10.2
py310-test run-test-pre: PYTHONHASHSEED='1426720794'
py310-test run-test: commands[0] | pytest
============================= test session starts ==============================
platform linux -- Python 3.10.0a7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py310-test/.pytest_cache
setuptools version 53.0.0 from '.../setuptools_scm/.tox/py310-test/lib/python3.10/site-packages/setuptools/__init__.py'
setuptools_scm version 6.0.1 from '.../setuptools_scm/src/setuptools_scm/__init__.py'
rootdir: .../setuptools_scm, configfile: tox.ini, testpaths: testing
collected 0 items / 1 error

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
<frozen importlib._bootstrap>:933: in _find_spec
    ???
E   AttributeError: 'VendorImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:
.tox/py310-test/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file
    elif _is_doctest(config, path, parent):
.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest
    if path.check(fnmatch=glob):
.tox/py310-test/lib/python3.10/site-packages/py/_path/local.py:387: in check
    return super(LocalPath, self).check(**kw)
.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:241: in check
    return self.Checkers(self)._evaluate(kw)
.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate
    if py.code.getrawcode(meth).co_argcount > 1:
.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr
    result = importobj(modpath, attrname)
.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj
    module = __import__(modpath, None, None, ['__doc__'])
.tox/py310-test/lib/python3.10/site-packages/py/_code/code.py:7: in <module>
    reprlib = py.builtin._tryimport('repr', 'reprlib')
.tox/py310-test/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport
    __import__(name)
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
<frozen importlib._bootstrap>:908: in _find_spec_legacy
    ???
E   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()
=========================== short test summary info ============================
ERROR  - ImportWarning: VendorImporter.find_spec() not found; falling back to...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.16s ===============================
ERROR: InvocationError for command .../setuptools_scm/.tox/py310-test/bin/pytest (exited with code 2)
___________________________________ summary ____________________________________
ERROR:   py310-test: commands failed
```


### Code of Conduct

I agree to follow the PSF Code of Conduct

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setuptools/extern/__init__.py`
Content:
```
1 import sys
2 
3 
4 class VendorImporter:
5     """
6     A PEP 302 meta path importer for finding optionally-vendored
7     or otherwise naturally-installed packages from root_name.
8     """
9 
10     def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
11         self.root_name = root_name
12         self.vendored_names = set(vendored_names)
13         self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
14 
15     @property
16     def search_path(self):
17         """
18         Search first the vendor package then as a natural package.
19         """
20         yield self.vendor_pkg + '.'
21         yield ''
22 
23     def find_module(self, fullname, path=None):
24         """
25         Return self when fullname starts with root_name and the
26         target module is one vendored through this importer.
27         """
28         root, base, target = fullname.partition(self.root_name + '.')
29         if root:
30             return
31         if not any(map(target.startswith, self.vendored_names)):
32             return
33         return self
34 
35     def load_module(self, fullname):
36         """
37         Iterate over the search path to locate and load fullname.
38         """
39         root, base, target = fullname.partition(self.root_name + '.')
40         for prefix in self.search_path:
41             try:
42                 extant = prefix + target
43                 __import__(extant)
44                 mod = sys.modules[extant]
45                 sys.modules[fullname] = mod
46                 return mod
47             except ImportError:
48                 pass
49         else:
50             raise ImportError(
51                 "The '{target}' package is required; "
52                 "normally this is bundled with this package so if you get "
53                 "this warning, consult the packager of your "
54                 "distribution.".format(**locals())
55             )
56 
57     def create_module(self, spec):
58         return self.load_module(spec.name)
59 
60     def exec_module(self, module):
61         pass
62 
63     def install(self):
64         """
65         Install this importer into sys.meta_path if not already present.
66         """
67         if self not in sys.meta_path:
68             sys.meta_path.append(self)
69 
70 
71 names = 'packaging', 'pyparsing', 'ordered_set',
72 VendorImporter(__name__, names, 'setuptools._vendor').install()
73
```

Path: `pkg_resources/extern/__init__.py`
Content:
```
1 import sys
2 
3 
4 class VendorImporter:
5     """
6     A PEP 302 meta path importer for finding optionally-vendored
7     or otherwise naturally-installed packages from root_name.
8     """
9 
10     def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
11         self.root_name = root_name
12         self.vendored_names = set(vendored_names)
13         self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
14 
15     @property
16     def search_path(self):
17         """
18         Search first the vendor package then as a natural package.
19         """
20         yield self.vendor_pkg + '.'
21         yield ''
22 
23     def find_module(self, fullname, path=None):
24         """
25         Return self when fullname starts with root_name and the
26         target module is one vendored through this importer.
27         """
28         root, base, target = fullname.partition(self.root_name + '.')
29         if root:
30             return
31         if not any(map(target.startswith, self.vendored_names)):
32             return
33         return self
34 
35     def load_module(self, fullname):
36         """
37         Iterate over the search path to locate and load fullname.
38         """
39         root, base, target = fullname.partition(self.root_name + '.')
40         for prefix in self.search_path:
41             try:
42                 extant = prefix + target
43                 __import__(extant)
44                 mod = sys.modules[extant]
45                 sys.modules[fullname] = mod
46                 return mod
47             except ImportError:
48                 pass
49         else:
50             raise ImportError(
51                 "The '{target}' package is required; "
52                 "normally this is bundled with this package so if you get "
53                 "this warning, consult the packager of your "
54                 "distribution.".format(**locals())
55             )
56 
57     def create_module(self, spec):
58         return self.load_module(spec.name)
59 
60     def exec_module(self, module):
61         pass
62 
63     def install(self):
64         """
65         Install this importer into sys.meta_path if not already present.
66         """
67         if self not in sys.meta_path:
68             sys.meta_path.append(self)
69 
70 
71 names = 'packaging', 'pyparsing', 'appdirs'
72 VendorImporter(__name__, names).install()
73
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py
--- a/pkg_resources/extern/__init__.py
+++ b/pkg_resources/extern/__init__.py
@@ -1,3 +1,4 @@
+import importlib.util
 import sys
 
 
@@ -20,17 +21,10 @@
         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):
         """
@@ -60,6 +54,13 @@
     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.
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -1,3 +1,4 @@
+import importlib.util
 import sys
 
 
@@ -20,17 +21,10 @@
         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):
         """
@@ -60,6 +54,13 @@
     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.

{"golden_diff": "diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py\n--- a/pkg_resources/extern/__init__.py\n+++ b/pkg_resources/extern/__init__.py\n@@ -1,3 +1,4 @@\n+import importlib.util\n import sys\n \n \n@@ -20,17 +21,10 @@\n         yield self.vendor_pkg + '.'\n         yield ''\n \n-    def find_module(self, fullname, path=None):\n-        \"\"\"\n-        Return self when fullname starts with root_name and the\n-        target module is one vendored through this importer.\n-        \"\"\"\n+    def _module_matches_namespace(self, fullname):\n+        \"\"\"Figure out if the target module is vendored.\"\"\"\n         root, base, target = fullname.partition(self.root_name + '.')\n-        if root:\n-            return\n-        if not any(map(target.startswith, self.vendored_names)):\n-            return\n-        return self\n+        return not root and any(map(target.startswith, self.vendored_names))\n \n     def load_module(self, fullname):\n         \"\"\"\n@@ -60,6 +54,13 @@\n     def exec_module(self, module):\n         pass\n \n+    def find_spec(self, fullname, path=None, target=None):\n+        \"\"\"Return a module spec for vendored names.\"\"\"\n+        return (\n+            importlib.util.spec_from_loader(fullname, self)\n+            if self._module_matches_namespace(fullname) else None\n+        )\n+\n     def install(self):\n         \"\"\"\n         Install this importer into sys.meta_path if not already present.\ndiff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py\n--- a/setuptools/extern/__init__.py\n+++ b/setuptools/extern/__init__.py\n@@ -1,3 +1,4 @@\n+import importlib.util\n import sys\n \n \n@@ -20,17 +21,10 @@\n         yield self.vendor_pkg + '.'\n         yield ''\n \n-    def find_module(self, fullname, path=None):\n-        \"\"\"\n-        Return self when fullname starts with root_name and the\n-        target module is one vendored through this importer.\n-        \"\"\"\n+    def _module_matches_namespace(self, fullname):\n+        \"\"\"Figure out if the target module is vendored.\"\"\"\n         root, base, target = fullname.partition(self.root_name + '.')\n-        if root:\n-            return\n-        if not any(map(target.startswith, self.vendored_names)):\n-            return\n-        return self\n+        return not root and any(map(target.startswith, self.vendored_names))\n \n     def load_module(self, fullname):\n         \"\"\"\n@@ -60,6 +54,13 @@\n     def exec_module(self, module):\n         pass\n \n+    def find_spec(self, fullname, path=None, target=None):\n+        \"\"\"Return a module spec for vendored names.\"\"\"\n+        return (\n+            importlib.util.spec_from_loader(fullname, self)\n+            if self._module_matches_namespace(fullname) else None\n+        )\n+\n     def install(self):\n         \"\"\"\n         Install this importer into sys.meta_path if not already present.\n", "issue": "[Forward compatibility][BUG] pkg_resources.extern.VendorImporter lacks find_spec() method\n### setuptools version\r\n\r\n54.1.2 and main\r\n\r\n### Python version\r\n\r\n3.10.0a7\r\n\r\n### OS\r\n\r\nAll\r\n\r\n### Additional environment information\r\n\r\nWhen running tests for setuptools_scm.\r\n\r\n### Description\r\n\r\nWe get:\r\n\r\n```python-traceback\r\n<frozen importlib._bootstrap>:933: in _find_spec\r\n    ???\r\nE   AttributeError: 'VendorImporter' object has no attribute 'find_spec'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__\r\n    return self._hookexec(self, self.get_hookimpls(), kwargs)\r\n/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec\r\n    return self._inner_hookexec(hook, methods, kwargs)\r\n/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>\r\n    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(\r\n/usr/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file\r\n    elif _is_doctest(config, path, parent):\r\n/usr/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest\r\n    if path.check(fnmatch=glob):\r\n/usr/lib/python3.10/site-packages/py/_path/local.py:387: in check\r\n    return super(LocalPath, self).check(**kw)\r\n/usr/lib/python3.10/site-packages/py/_path/common.py:241: in check\r\n    return self.Checkers(self)._evaluate(kw)\r\n/usr/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate\r\n    if py.code.getrawcode(meth).co_argcount > 1:\r\n/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr\r\n    result = importobj(modpath, attrname)\r\n/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj\r\n    module = __import__(modpath, None, None, ['__doc__'])\r\n/usr/lib/python3.10/site-packages/py/_code/code.py:7: in <module>\r\n    reprlib = py.builtin._tryimport('repr', 'reprlib')\r\n/usr/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport\r\n    __import__(name)\r\n<frozen importlib._bootstrap>:1021: in _find_and_load\r\n    ???\r\n<frozen importlib._bootstrap>:996: in _find_and_load_unlocked\r\n    ???\r\n<frozen importlib._bootstrap>:935: in _find_spec\r\n    ???\r\n<frozen importlib._bootstrap>:908: in _find_spec_legacy\r\n    ???\r\nE   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()\r\n```\r\n\r\nThe traceback is not very helpful, but the VendorImporter is from pkg_resourecs.\r\n\r\nPython added a warning: https://bugs.python.org/issue42134 but other packages treat it as error.\r\n\r\n### Expected behavior\r\n\r\nNo ImportWarning.\r\n\r\n### How to Reproduce\r\n\r\n1. Get Python 3.10.0a7 and tox (e.g. on Fedora via `$ sudo dnf --enablerepo=updates-testing install python3.10 tox`)\r\n2. git clone https://github.com/pypa/setuptools_scm.git and cd in\r\n3. Run `tox -e py310-test`\r\n\r\n### Output\r\n\r\n```console\r\npy310-test develop-inst-nodeps: .../setuptools_scm\r\npy310-test installed: attrs==20.3.0,iniconfig==1.1.1,packaging==20.9,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pytest==6.2.3,-e git+https://github.com/pypa/setuptools_scm.git@abb67b15985f380d8cf4451b9f2ef3dd11cb8a91#egg=setuptools_scm,toml==0.10.2\r\npy310-test run-test-pre: PYTHONHASHSEED='1426720794'\r\npy310-test run-test: commands[0] | pytest\r\n============================= test session starts ==============================\r\nplatform linux -- Python 3.10.0a7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1\r\ncachedir: .tox/py310-test/.pytest_cache\r\nsetuptools version 53.0.0 from '.../setuptools_scm/.tox/py310-test/lib/python3.10/site-packages/setuptools/__init__.py'\r\nsetuptools_scm version 6.0.1 from '.../setuptools_scm/src/setuptools_scm/__init__.py'\r\nrootdir: .../setuptools_scm, configfile: tox.ini, testpaths: testing\r\ncollected 0 items / 1 error\r\n\r\n==================================== ERRORS ====================================\r\n________________________ ERROR collecting test session _________________________\r\n<frozen importlib._bootstrap>:933: in _find_spec\r\n    ???\r\nE   AttributeError: 'VendorImporter' object has no attribute 'find_spec'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n.tox/py310-test/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__\r\n    return self._hookexec(self, self.get_hookimpls(), kwargs)\r\n.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec\r\n    return self._inner_hookexec(hook, methods, kwargs)\r\n.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>\r\n    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(\r\n.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file\r\n    elif _is_doctest(config, path, parent):\r\n.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest\r\n    if path.check(fnmatch=glob):\r\n.tox/py310-test/lib/python3.10/site-packages/py/_path/local.py:387: in check\r\n    return super(LocalPath, self).check(**kw)\r\n.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:241: in check\r\n    return self.Checkers(self)._evaluate(kw)\r\n.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate\r\n    if py.code.getrawcode(meth).co_argcount > 1:\r\n.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr\r\n    result = importobj(modpath, attrname)\r\n.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj\r\n    module = __import__(modpath, None, None, ['__doc__'])\r\n.tox/py310-test/lib/python3.10/site-packages/py/_code/code.py:7: in <module>\r\n    reprlib = py.builtin._tryimport('repr', 'reprlib')\r\n.tox/py310-test/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport\r\n    __import__(name)\r\n<frozen importlib._bootstrap>:1021: in _find_and_load\r\n    ???\r\n<frozen importlib._bootstrap>:996: in _find_and_load_unlocked\r\n    ???\r\n<frozen importlib._bootstrap>:935: in _find_spec\r\n    ???\r\n<frozen importlib._bootstrap>:908: in _find_spec_legacy\r\n    ???\r\nE   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()\r\n=========================== short test summary info ============================\r\nERROR  - ImportWarning: VendorImporter.find_spec() not found; falling back to...\r\n!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!\r\n=============================== 1 error in 0.16s ===============================\r\nERROR: InvocationError for command .../setuptools_scm/.tox/py310-test/bin/pytest (exited with code 2)\r\n___________________________________ summary ____________________________________\r\nERROR:   py310-test: commands failed\r\n```\r\n\r\n\r\n### Code of Conduct\r\n\r\nI agree to follow the PSF Code of Conduct\n", "before_files": [{"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def create_module(self, spec):\n        return self.load_module(spec.name)\n\n    def exec_module(self, module):\n        pass\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'ordered_set',\nVendorImporter(__name__, names, 'setuptools._vendor').install()\n", "path": "setuptools/extern/__init__.py"}, {"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def create_module(self, spec):\n        return self.load_module(spec.name)\n\n    def exec_module(self, module):\n        pass\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'appdirs'\nVendorImporter(__name__, names).install()\n", "path": "pkg_resources/extern/__init__.py"}], "after_files": [{"content": "import importlib.util\nimport sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def _module_matches_namespace(self, fullname):\n        \"\"\"Figure out if the target module is vendored.\"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        return not root and any(map(target.startswith, self.vendored_names))\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def create_module(self, spec):\n        return self.load_module(spec.name)\n\n    def exec_module(self, module):\n        pass\n\n    def find_spec(self, fullname, path=None, target=None):\n        \"\"\"Return a module spec for vendored names.\"\"\"\n        return (\n            importlib.util.spec_from_loader(fullname, self)\n            if self._module_matches_namespace(fullname) else None\n        )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'ordered_set',\nVendorImporter(__name__, names, 'setuptools._vendor').install()\n", "path": "setuptools/extern/__init__.py"}, {"content": "import importlib.util\nimport sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def _module_matches_namespace(self, fullname):\n        \"\"\"Figure out if the target module is vendored.\"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        return not root and any(map(target.startswith, self.vendored_names))\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def create_module(self, spec):\n        return self.load_module(spec.name)\n\n    def exec_module(self, module):\n        pass\n\n    def find_spec(self, fullname, path=None, target=None):\n        \"\"\"Return a module spec for vendored names.\"\"\"\n        return (\n            importlib.util.spec_from_loader(fullname, self)\n            if self._module_matches_namespace(fullname) else None\n        )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'appdirs'\nVendorImporter(__name__, names).install()\n", "path": "pkg_resources/extern/__init__.py"}]}