Improve SSL-related version warnings.

This commit is contained in:
Valentin Lorentz 2016-02-24 17:25:51 +01:00
parent e1a86665ae
commit f1390b1aec
2 changed files with 18 additions and 11 deletions

View File

@ -33,11 +33,14 @@
import os import os
import sys import sys
import time import time
import warnings
import datetime import datetime
import tempfile import tempfile
import subprocess import subprocess
from math import ceil from math import ceil
warnings.filterwarnings('always', category=DeprecationWarning)
debug = '--debug' in sys.argv debug = '--debug' in sys.argv
path = os.path.dirname(__file__) path = os.path.dirname(__file__)
@ -237,13 +240,18 @@ setup(
) )
if sys.version_info < (2, 7, 9): if sys.version_info < (2, 7, 9):
sys.stderr.write('+-----------------------------------------------------+\n') warnings.warn('Running Limnoria on Python older than 2.7.9 is not '
sys.stderr.write('| Running Limnoria on Python versions older than |\n') 'recommended because it does not support SSL '
sys.stderr.write('| 2.7.9 is deprecated. |\n') 'certificate verification. For more informations, see: '
sys.stderr.write('| Please consider upgrading to Python 3.4 or greater. |\n') '<http://doc.supybot.aperio.fr/en/latest/use/security.html#ssl-python-versions>',
sys.stderr.write('+-----------------------------------------------------+\n') DeprecationWarning)
sys.stderr.write('\n') elif sys.version_info < (3, 0):
sys.stderr.write('See <http://doc.supybot.aperio.fr/en/latest/use/faq.html#how-to-make-limnoria-use-python-3-instead-of-python-2>\n') pass # fine, for the moment
sys.stderr.write('\n') elif sys.version_info < (3, 4):
warnings.warn('Running Limnoria on Python 3.2 or 3.3 is not '
'recommended because these versions do not support SSL '
'certificate verification. For more informations, see: '
'<http://doc.supybot.aperio.fr/en/latest/use/security.html#ssl-python-versions>',
DeprecationWarning)
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -172,8 +172,7 @@ else:
elif verify: elif verify:
logger.critical('This Python version does not support SSL/TLS ' logger.critical('This Python version does not support SSL/TLS '
'certification authority verification, which makes your ' 'certification authority verification, which makes your '
'connection vulnerable to man-in-the-middle attacks.' 'connection vulnerable to man-in-the-middle attacks. See: '
'You should consider upgrading to Python 3.4 or newer. ' '<http://doc.supybot.aperio.fr/en/latest/use/security.html#ssl-python-versions>')
'See <http://doc.supybot.aperio.fr/en/latest/use/faq.html#how-to-make-limnoria-use-python-3-instead-of-python-2>')
return conn return conn
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: