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

Commit

Permalink
Emit a warning when a future-unsupported setuptools version is detect…
Browse files Browse the repository at this point in the history
…ed. Ref #43.
  • Loading branch information
jaraco committed Feb 14, 2019
1 parent 1d0e60b commit b2202f5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
4.4
===

* #43: Detect condition where declarative config will cause
errors and emit a UserWarning with guidance on necessary
actions.

4.3.1
=====

Expand Down
14 changes: 14 additions & 0 deletions ptr.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys as _sys
import operator as _operator
import itertools as _itertools
import warnings as _warnings

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

@staticmethod
def _warn_old_setuptools():
msg = (
"pytest-runner will stop working on this version of setuptools; "
"please upgrade to setuptools 30.4 or later or pin to "
"pytest-runner < 5."
)
ver_str = pkg_resources.get_distribution('setuptools').version
ver = pkg_resources.parse_version(ver_str)
if ver < pkg_resources.parse_version('30.4'):
_warnings.warn(msg)

def run(self):
"""
Override run to ensure requirements are available in this session (but
don't install them anywhere).
"""
self._warn_old_setuptools()
dist = CustomizedDist()
for attr in 'allow_hosts index_url'.split():
setattr(dist, attr, getattr(self, attr))
Expand Down

0 comments on commit b2202f5

Please sign in to comment.