Skip to content

Commit

Permalink
Add obnoxious warning about Python 2 being unsupported on this releas…
Browse files Browse the repository at this point in the history
…e with guidance on how to avoid the warning and what to do if that guidance was ineffective.
  • Loading branch information
jaraco committed Jan 3, 2020
1 parent a46a6bf commit 79f1694
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
__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
Expand Down
19 changes: 19 additions & 0 deletions pkg_resources/py2_warn.py
Original file line number Diff line number Diff line change
@@ -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)

4 comments on commit 79f1694

@calebwoofenden
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this import is failing and causing errors when we are trying to run PyInstaller. See #1963. I think instead of __import__('pkg_resources.py2_warn') you just want from . import py2_warn, similar to how on line 79 you see from . import py31compat.

@jpeg13
Copy link

@jpeg13 jpeg13 commented on 79f1694 Jan 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this import is failing and causing errors when we are trying to run PyInstaller. See #1963. I think instead of __import__('pkg_resources.py2_warn') you just want from . import py2_warn, similar to how on line 79 you see from . import py31compat.

Hi, same issue with cx_Freeze.

@jaraco
Copy link
Member Author

@jaraco jaraco commented on 79f1694 Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please report the details in the bug.

@stevenliu1970
Copy link

@stevenliu1970 stevenliu1970 commented on 79f1694 Feb 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve the problem temporarily

#__import__('pkg_resources.py2_warn')
#changed by Steven
import pkg_resources.py2_warn

Please sign in to comment.