aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-01-03 06:30:03 -0500
committerJason R. Coombs <jaraco@jaraco.com>2020-01-03 06:45:37 -0500
commit79f1694b05a66cc0fbbbf4e72d63d0a340cf6d84 (patch)
tree1ea77e346fe3df17b39fe0348af9facd116840ec
parenta46a6bfd903ecc292fc3645c37c1b72781528095 (diff)
downloadexternal_python_setuptools-79f1694b05a66cc0fbbbf4e72d63d0a340cf6d84.tar.gz
external_python_setuptools-79f1694b05a66cc0fbbbf4e72d63d0a340cf6d84.tar.bz2
external_python_setuptools-79f1694b05a66cc0fbbbf4e72d63d0a340cf6d84.zip
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.
-rw-r--r--pkg_resources/__init__.py1
-rw-r--r--pkg_resources/py2_warn.py19
2 files changed, 20 insertions, 0 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 2f5aa64a..3fa883ce 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -83,6 +83,7 @@ __import__('pkg_resources.extern.packaging.version')
__import__('pkg_resources.extern.packaging.specifiers')
__import__('pkg_resources.extern.packaging.requirements')
__import__('pkg_resources.extern.packaging.markers')
+__import__('pkg_resources.py2_warn')
__metaclass__ = type
diff --git a/pkg_resources/py2_warn.py b/pkg_resources/py2_warn.py
new file mode 100644
index 00000000..1f29851c
--- /dev/null
+++ b/pkg_resources/py2_warn.py
@@ -0,0 +1,19 @@
+import sys
+import warnings
+import textwrap
+
+
+msg = textwrap.dedent("""
+ You are running Setuptools on Python 2, which is no longer
+ supported and
+ >>> SETUPTOOLS WILL STOP WORKING <<<
+ in a subsequent release. Please ensure you are installing
+ Setuptools using pip 9.x or later or pin to `setuptools<45`
+ in your environment.
+ If you have done those things and are still encountering
+ this message, please comment in
+ https://github.com/pypa/setuptools/issues/1458
+ about the steps that led to this unsupported combination.
+ """)
+
+sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)