Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit b2202f5

Browse files
committed
Emit a warning when a future-unsupported setuptools version is detected. Ref #43.
1 parent 1d0e60b commit b2202f5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
4.4
2+
===
3+
4+
* #43: Detect condition where declarative config will cause
5+
errors and emit a UserWarning with guidance on necessary
6+
actions.
7+
18
4.3.1
29
=====
310

ptr.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys as _sys
99
import operator as _operator
1010
import itertools as _itertools
11+
import warnings as _warnings
1112

1213
try:
1314
# ensure that map has the same meaning on Python 2
@@ -153,11 +154,24 @@ def install_extra_dists(self, dist):
153154
results = list(map(dist.fetch_build_eggs, matching_extras))
154155
return _itertools.chain.from_iterable(results)
155156

157+
@staticmethod
158+
def _warn_old_setuptools():
159+
msg = (
160+
"pytest-runner will stop working on this version of setuptools; "
161+
"please upgrade to setuptools 30.4 or later or pin to "
162+
"pytest-runner < 5."
163+
)
164+
ver_str = pkg_resources.get_distribution('setuptools').version
165+
ver = pkg_resources.parse_version(ver_str)
166+
if ver < pkg_resources.parse_version('30.4'):
167+
_warnings.warn(msg)
168+
156169
def run(self):
157170
"""
158171
Override run to ensure requirements are available in this session (but
159172
don't install them anywhere).
160173
"""
174+
self._warn_old_setuptools()
161175
dist = CustomizedDist()
162176
for attr in 'allow_hosts index_url'.split():
163177
setattr(dist, attr, getattr(self, attr))

0 commit comments

Comments
 (0)