Skip to content

Commit a513918

Browse files
authored
Remove redundant code for EOL Python 3.7 and older (#423)
* Remove code for Python 3.5 pre-releases * Remove code for Python 3.7
1 parent 3c7d23c commit a513918

File tree

3 files changed

+4
-55
lines changed

3 files changed

+4
-55
lines changed

pyperformance/_pip.py

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
import os.path
33
import sys
44

5-
from . import _pythoninfo, _utils
5+
from . import _utils
66

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

1312

@@ -21,21 +20,6 @@ def get_pkg_name(req):
2120
return req
2221

2322

24-
def get_best_pip_version(python):
25-
"""Return the pip to install for the given Python executable."""
26-
if not python or isinstance(python, str):
27-
info = _pythoninfo.get_info(python)
28-
else:
29-
info = python
30-
# On Python: 3.5a0 <= version < 3.5.0 (final), install pip 7.1.2,
31-
# the last version working on Python 3.5a0:
32-
# https://sourceforge.net/p/pyparsing/bugs/100/
33-
if 0x30500A0 <= info.sys.hexversion < 0x30500F0:
34-
return OLD_PIP
35-
else:
36-
return None
37-
38-
3923
def run_pip(cmd, *args, **kwargs):
4024
"""Return the result of running pip with the given args."""
4125
return _utils.run_python("-m", "pip", cmd, *args, **kwargs)
@@ -90,9 +74,6 @@ def install_pip(
9074

9175
# python get-pip.py
9276
argv = [python, "-u", filename]
93-
version = get_best_pip_version(info or python)
94-
if version:
95-
argv.append(version)
9677
res = _utils.run_cmd(argv, env=env)
9778
ec, _, _ = res
9879
if ec != 0:
@@ -113,14 +94,8 @@ def upgrade_pip(
11394
if not python:
11495
python = getattr(info, "executable", None) or sys.executable
11596

116-
version = get_best_pip_version(info or python)
117-
if version:
118-
reqs = [f"pip=={version}"]
119-
if installer:
120-
reqs.append(f"setuptools=={OLD_SETUPTOOLS}")
121-
else:
122-
# pip 6 is the first version supporting environment markers
123-
reqs = [f"pip>={MIN_PIP}"]
97+
# pip 6 is the first version supporting environment markers
98+
reqs = [f"pip>={MIN_PIP}"]
12499
res = install_requirements(*reqs, python=python, upgrade=True, **kwargs)
125100
ec, _, _ = res
126101
if ec != 0:

pyperformance/compile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,6 @@ def download(self, url, filename):
373373
_utils.download(url, filename)
374374

375375
def _install_pip(self):
376-
# On Python: 3.5a0 <= version < 3.5.0 (final), install pip 7.1.2,
377-
# the last version working on Python 3.5a0:
378-
# https://sourceforge.net/p/pyparsing/bugs/100/
379-
assert self.hexversion > 0x3060000, self.hexversion
380-
381376
# is pip already installed and working?
382377
exitcode = self.run_nocheck(self.program, "-u", "-m", "pip", "--version")
383378
if not exitcode:

pyperformance/tests/__init__.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,6 @@ def decorator(func):
145145
return func
146146

147147

148-
class Compat:
149-
"""A mixin that lets older Pythons use newer unittest features."""
150-
151-
if sys.version_info < (3, 8):
152-
153-
@classmethod
154-
def setUpClass(cls):
155-
super().setUpClass()
156-
cls._cleanups = []
157-
158-
@classmethod
159-
def tearDownClass(cls):
160-
super().tearDownClass()
161-
for cleanup in cls._cleanups:
162-
cleanup()
163-
164-
@classmethod
165-
def addClassCleanup(cls, cleanup):
166-
cls._cleanups.append(cleanup)
167-
168-
169148
#############################
170149
# functional tests
171150

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

183162

184-
class Functional(Compat):
163+
class Functional:
185164
"""A mixin for functional tests.
186165
187166
In this context, "functional" means the test touches the filesystem,

0 commit comments

Comments
 (0)