Skip to content

Commit

Permalink
Revert __pip-runner__.py changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmoore committed Aug 3, 2022
1 parent ebe491a commit 929a6b3
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/pip/__pip-runner__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from typing import Optional, Sequence, Union

PIP_SOURCES_ROOT = dirname(dirname(__file__))
# Copied from setup.py
PYTHON_REQUIRES = ">=3.7"


class PipImportRedirectingFinder:
Expand All @@ -32,21 +30,7 @@ def find_spec(
return spec


def check_python_version() -> None:
# Import here to ensure the imports happen after the sys.meta_path change.
from pip._vendor.packaging.specifiers import SpecifierSet
from pip._vendor.packaging.version import Version

py_ver = Version("{0.major}.{0.minor}.{0.micro}".format(sys.version_info))
if py_ver not in SpecifierSet(PYTHON_REQUIRES):
raise SystemExit(
f"This version of pip does not support python {py_ver} "
f"(requires {PYTHON_REQUIRES})"
)


sys.meta_path.insert(0, PipImportRedirectingFinder())

assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module"
check_python_version()
runpy.run_module("pip", run_name="__main__", alter_sys=True)

0 comments on commit 929a6b3

Please sign in to comment.