Mercurial > hg-stable
changeset 44933:4c53c12b92d5
setup: require a Python version with modern SSL features
This increases the minimum security baseline of Mercurial and enables us to
remove compatibility code for supporting older, less secure Python versions.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Fri, 29 May 2020 21:07:26 +0200 |
parents | 47b3c8383cc1 |
children | 7c19eb372438 |
files | setup.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Sat May 30 03:46:59 2020 +0200 +++ b/setup.py Fri May 29 21:07:26 2020 +0200 @@ -83,6 +83,21 @@ printf(error, file=sys.stderr) sys.exit(1) +import ssl + +try: + ssl.SSLContext +except AttributeError: + error = """ +The `ssl` module does not have the `SSLContext` class. This indicates an old +Python version which does not support modern security features (which were +added to Python 2.7 as part of "PEP 466"). Please make sure you have installed +at least Python 2.7.9 or a Python version with backports of these security +features. +""" + printf(error, file=sys.stderr) + sys.exit(1) + if sys.version_info[0] >= 3: DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] else: