Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions pyperformance/_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import os.path
import sys

from . import _pythoninfo, _utils
from . import _utils

GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
# pip 6 is the first version supporting environment markers
MIN_PIP = "6.0"
OLD_PIP = "7.1.2"
OLD_SETUPTOOLS = "18.5"


Expand All @@ -21,21 +20,6 @@ def get_pkg_name(req):
return req


def get_best_pip_version(python):
"""Return the pip to install for the given Python executable."""
if not python or isinstance(python, str):
info = _pythoninfo.get_info(python)
else:
info = python
# On Python: 3.5a0 <= version < 3.5.0 (final), install pip 7.1.2,
# the last version working on Python 3.5a0:
# https://sourceforge.net/p/pyparsing/bugs/100/
if 0x30500A0 <= info.sys.hexversion < 0x30500F0:
return OLD_PIP
else:
return None


def run_pip(cmd, *args, **kwargs):
"""Return the result of running pip with the given args."""
return _utils.run_python("-m", "pip", cmd, *args, **kwargs)
Expand Down Expand Up @@ -90,9 +74,6 @@ def install_pip(

# python get-pip.py
argv = [python, "-u", filename]
version = get_best_pip_version(info or python)
if version:
argv.append(version)
res = _utils.run_cmd(argv, env=env)
ec, _, _ = res
if ec != 0:
Expand All @@ -113,14 +94,8 @@ def upgrade_pip(
if not python:
python = getattr(info, "executable", None) or sys.executable

version = get_best_pip_version(info or python)
if version:
reqs = [f"pip=={version}"]
if installer:
reqs.append(f"setuptools=={OLD_SETUPTOOLS}")
else:
# pip 6 is the first version supporting environment markers
reqs = [f"pip>={MIN_PIP}"]
# pip 6 is the first version supporting environment markers
reqs = [f"pip>={MIN_PIP}"]
res = install_requirements(*reqs, python=python, upgrade=True, **kwargs)
ec, _, _ = res
if ec != 0:
Expand Down
5 changes: 0 additions & 5 deletions pyperformance/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,6 @@ def download(self, url, filename):
_utils.download(url, filename)

def _install_pip(self):
# On Python: 3.5a0 <= version < 3.5.0 (final), install pip 7.1.2,
# the last version working on Python 3.5a0:
# https://sourceforge.net/p/pyparsing/bugs/100/
assert self.hexversion > 0x3060000, self.hexversion

# is pip already installed and working?
exitcode = self.run_nocheck(self.program, "-u", "-m", "pip", "--version")
if not exitcode:
Expand Down
23 changes: 1 addition & 22 deletions pyperformance/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,6 @@ def decorator(func):
return func


class Compat:
"""A mixin that lets older Pythons use newer unittest features."""

if sys.version_info < (3, 8):

@classmethod
def setUpClass(cls):
super().setUpClass()
cls._cleanups = []

@classmethod
def tearDownClass(cls):
super().tearDownClass()
for cleanup in cls._cleanups:
cleanup()

@classmethod
def addClassCleanup(cls, cleanup):
cls._cleanups.append(cleanup)


#############################
# functional tests

Expand All @@ -181,7 +160,7 @@ def SLOW(f):
return unittest.skip("way too slow")(mark("slow", f))


class Functional(Compat):
class Functional:
"""A mixin for functional tests.

In this context, "functional" means the test touches the filesystem,
Expand Down
Loading