]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/pip/__pip-runner__.py
Archivo de configuraciĆ³n de la terminal
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / pip / __pip-runner__.py
CommitLineData
53e6db90
DC
1"""Execute exactly this copy of pip, within a different environment.
2
3This file is named as it is, to ensure that this module can't be imported via
4an import statement.
5"""
6
7# /!\ This version compatibility check section must be Python 2 compatible. /!\
8
9import sys
10
11# Copied from setup.py
12PYTHON_REQUIRES = (3, 7)
13
14
15def version_str(version): # type: ignore
16 return ".".join(str(v) for v in version)
17
18
19if 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
29import runpy # noqa: E402
30from importlib.machinery import PathFinder # noqa: E402
31from os.path import dirname # noqa: E402
32
33PIP_SOURCES_ROOT = dirname(dirname(__file__))
34
35
36class 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
47sys.meta_path.insert(0, PipImportRedirectingFinder())
48
49assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module"
50runpy.run_module("pip", run_name="__main__", alter_sys=True)