Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare Sopel to adapt its output when py2 officially dies #1756

Merged
merged 1 commit into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Sopel requires ``backports.ssl_match_hostname`` to be installed. Use
``yum install python-backports.ssl_match_hostname`` to install it, or download
and install it manually `from PyPI <https://pypi.org/project/backports.ssl_match_hostname>`_.

Note: Python 2.x is near end of life. Sopel support at that point is TBD.
Note: Python 2.x is near end of life. Sopel will drop support in version 8.0.

In the source directory (whether cloned or from the tarball) run
``setup.py install``. You can then run ``sopel`` to configure and start the
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import unicode_literals, absolute_import, print_function, division

import sys
import time

try:
from setuptools import setup, __version__ as setuptools_version
Expand Down Expand Up @@ -38,7 +39,11 @@
# this fucking question, and if you get here you should go RTGDMFM.
raise ImportError('Sopel requires Python 2.7+ or 3.3+.')
if sys.version_info.major == 2:
print('Warning: Python 2.x is near end of life. Sopel support at that point is TBD.', file=sys.stderr)
if time.time() >= 1577836800: # 2020-01-01 00:00:00 UTC
state = 'is near end of life'
else:
state = 'has reached end of life and will receive no further updates'
print('Warning: Python 2.x %s. Sopel will drop support in version 8.0.' % state, file=sys.stderr)


def read_reqs(path):
Expand Down
6 changes: 5 additions & 1 deletion sopel/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
tools.stderr('Error: Requires Python 2.7 or later. Try python2.7 sopel')
sys.exit(1)
if sys.version_info.major == 2:
tools.stderr('Warning: Python 2.x is near end of life. Sopel support at that point is TBD.')
if time.time() >= 1577836800: # 2020-01-01 00:00:00 UTC
state = 'is near end of life'
else:
state = 'has reached end of life and will receive no further updates'
tools.stderr('Warning: Python 2.x %s. Sopel will drop support in version 8.0.' % state)
if sys.version_info.major == 3 and sys.version_info.minor < 3:
tools.stderr('Error: When running on Python 3, Python 3.3 is required.')
sys.exit(1)
Expand Down