From 6475a574025b5768ca88d5b037b4a162f8442886 Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Sun, 31 Jan 2016 16:54:43 -0500 Subject: [PATCH] Break Python 3.2 compatibility --- wolfbot.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/wolfbot.py b/wolfbot.py index 785a0a3..683fb86 100755 --- a/wolfbot.py +++ b/wolfbot.py @@ -17,30 +17,37 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +import traceback import sys +import botconfig + if sys.version_info < (3, 2): print("Python 3.2 or newer is required to run the bot.") sys.exit(1) if sys.version_info < (3, 3): - print("*** WARNING ***".center(80), - "Starting February 2016, Python 3.2 support will be officially dropped.", - "The minimum requirement will be increased to Python 3.3", - "Please make sure to upgrade by then, or stick with an older revision.", "", - "Concerns and questions may be asked on the official development channel", - " in ##werewolf-dev over at irc.freenode.net", "", - "You may also open an issue on the issue tracker in the GitHub repository", - " located at https://github.com/lykoss/lykos", "", - "The lifetime of Python 3.2 support may be extended on request.", "", - "Thank you for your interest in this IRC bot!", "", - "- The lykos development team", "", sep="\n", file=sys.stderr) + allow_unsup = getattr(botconfig, "allow_unsupported_Python", None) + # add an "allow_unsupported_Python" attribute in botconfig + # set it to the tuple (3, 2) to prevent the bot from exiting + # this backwards-compatibility fix will not remain for long + # please update to 3.3 if you can. if you can't, you will need + # to stick with an older revision, and new bugfixes/features + # will not be applied to the 3.2-supported versions + # we will also not provide any more support + print("As of the 1st of February 2016, support for Python 3.2 is gone.", + "You need Python 3.3 or above to run the bot from this point onwards.", + "Please upgrade your installed Python version to run the bot.", + "", "Thank you for your interest!", "- The lykos development team", + sep="\n", file=sys.stderr) -import traceback + if allow_unsup != (3, 2): + sys.exit(1) + else: + print("\n...\nFine, fine, I'll run anyway", file=sys.stderr) from oyoyo.client import IRCClient -import botconfig import src from src import handler