Skip to content

Commit 79f1694

Browse files
committed
Add obnoxious warning about Python 2 being unsupported on this release with guidance on how to avoid the warning and what to do if that guidance was ineffective.
1 parent a46a6bf commit 79f1694

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

pkg_resources/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
__import__('pkg_resources.extern.packaging.specifiers')
8484
__import__('pkg_resources.extern.packaging.requirements')
8585
__import__('pkg_resources.extern.packaging.markers')
86+
__import__('pkg_resources.py2_warn')
8687

8788

8889
__metaclass__ = type

pkg_resources/py2_warn.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
import warnings
3+
import textwrap
4+
5+
6+
msg = textwrap.dedent("""
7+
You are running Setuptools on Python 2, which is no longer
8+
supported and
9+
>>> SETUPTOOLS WILL STOP WORKING <<<
10+
in a subsequent release. Please ensure you are installing
11+
Setuptools using pip 9.x or later or pin to `setuptools<45`
12+
in your environment.
13+
If you have done those things and are still encountering
14+
this message, please comment in
15+
https://github.com/pypa/setuptools/issues/1458
16+
about the steps that led to this unsupported combination.
17+
""")
18+
19+
sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)

0 commit comments

Comments
 (0)