]> crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/pip/__pip-runner__.py
Se agregan las configuraciones del tarro
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / pip / __pip-runner__.py
1 """Execute exactly this copy of pip, within a different environment.
2
3 This file is named as it is, to ensure that this module can't be imported via
4 an import statement.
5 """
6
7 # /!\ This version compatibility check section must be Python 2 compatible. /!\
8
9 import sys
10
11 # Copied from setup.py
12 PYTHON_REQUIRES = (3, 7)
13
14
15 def version_str(version): # type: ignore
16 return ".".join(str(v) for v in version)
17
18
19 if sys.version_info[:2] < PYTHON_REQUIRES:
20 raise SystemExit(
21 "This version of pip does not support python {} (requires >={}).".format(
22 version_str(sys.version_info[:2]), version_str(PYTHON_REQUIRES)
23 )
24 )
25
26 # From here on, we can use Python 3 features, but the syntax must remain
27 # Python 2 compatible.
28
29 import runpy # noqa: E402
30 from importlib.machinery import PathFinder # noqa: E402
31 from os.path import dirname # noqa: E402
32
33 PIP_SOURCES_ROOT = dirname(dirname(__file__))
34
35
36 class PipImportRedirectingFinder:
37 @classmethod
38 def find_spec(self, fullname, path=None, target=None): # type: ignore
39 if fullname != "pip":
40 return None
41
42 spec = PathFinder.find_spec(fullname, [PIP_SOURCES_ROOT], target)
43 assert spec, (PIP_SOURCES_ROOT, fullname)
44 return spec
45
46
47 sys.meta_path.insert(0, PipImportRedirectingFinder())
48
49 assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module"
50 runpy.run_module("pip", run_name="__main__", alter_sys=True)