]> crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/_importlib.py
ActualizaciĆ³n de Readme
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / setuptools / _importlib.py
1 import sys
2
3
4 def disable_importlib_metadata_finder(metadata):
5 """
6 Ensure importlib_metadata doesn't provide older, incompatible
7 Distributions.
8
9 Workaround for #3102.
10 """
11 try:
12 import importlib_metadata
13 except ImportError:
14 return
15 except AttributeError:
16 import warnings
17
18 msg = (
19 "`importlib-metadata` version is incompatible with `setuptools`.\n"
20 "This problem is likely to be solved by installing an updated version of "
21 "`importlib-metadata`."
22 )
23 warnings.warn(msg) # Ensure a descriptive message is shown.
24 raise # This exception can be suppressed by _distutils_hack
25
26 if importlib_metadata is metadata:
27 return
28 to_remove = [
29 ob
30 for ob in sys.meta_path
31 if isinstance(ob, importlib_metadata.MetadataPathFinder)
32 ]
33 for item in to_remove:
34 sys.meta_path.remove(item)
35
36
37 if sys.version_info < (3, 10):
38 from setuptools.extern import importlib_metadata as metadata
39 disable_importlib_metadata_finder(metadata)
40 else:
41 import importlib.metadata as metadata # noqa: F401
42
43
44 if sys.version_info < (3, 9):
45 from setuptools.extern import importlib_resources as resources
46 else:
47 import importlib.resources as resources # noqa: F401