From f1390b1aecd1cdff9e6983780f21d3b753a41131 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 24 Feb 2016 17:25:51 +0100 Subject: [PATCH] Improve SSL-related version warnings. --- setup.py | 24 ++++++++++++++++-------- src/utils/net.py | 5 ++--- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 0b80c3ae1..5d69b5906 100644 --- a/setup.py +++ b/setup.py @@ -33,11 +33,14 @@ import os import sys import time +import warnings import datetime import tempfile import subprocess from math import ceil +warnings.filterwarnings('always', category=DeprecationWarning) + debug = '--debug' in sys.argv path = os.path.dirname(__file__) @@ -237,13 +240,18 @@ setup( ) if sys.version_info < (2, 7, 9): - sys.stderr.write('+-----------------------------------------------------+\n') - sys.stderr.write('| Running Limnoria on Python versions older than |\n') - sys.stderr.write('| 2.7.9 is deprecated. |\n') - sys.stderr.write('| Please consider upgrading to Python 3.4 or greater. |\n') - sys.stderr.write('+-----------------------------------------------------+\n') - sys.stderr.write('\n') - sys.stderr.write('See \n') - sys.stderr.write('\n') + warnings.warn('Running Limnoria on Python older than 2.7.9 is not ' + 'recommended because it does not support SSL ' + 'certificate verification. For more informations, see: ' + '', + DeprecationWarning) +elif sys.version_info < (3, 0): + pass # fine, for the moment +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: ' + '', + DeprecationWarning) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/src/utils/net.py b/src/utils/net.py index 74e2fa981..2cd7656f3 100644 --- a/src/utils/net.py +++ b/src/utils/net.py @@ -172,8 +172,7 @@ else: elif verify: logger.critical('This Python version does not support SSL/TLS ' 'certification authority verification, which makes your ' - 'connection vulnerable to man-in-the-middle attacks.' - 'You should consider upgrading to Python 3.4 or newer. ' - 'See ') + 'connection vulnerable to man-in-the-middle attacks. See: ' + '') return conn # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: