comparison setup.py @ 44874: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 fd3b94f1712d
children 95c832849955
comparison
equal deleted inserted replaced
44873:47b3c8383cc1 44874:4c53c12b92d5
78 Python {py} detected. 78 Python {py} detected.
79 {pip} 79 {pip}
80 """.format( 80 """.format(
81 py=sys.version_info, pip=pip_message 81 py=sys.version_info, pip=pip_message
82 ) 82 )
83 printf(error, file=sys.stderr)
84 sys.exit(1)
85
86 import ssl
87
88 try:
89 ssl.SSLContext
90 except AttributeError:
91 error = """
92 The `ssl` module does not have the `SSLContext` class. This indicates an old
93 Python version which does not support modern security features (which were
94 added to Python 2.7 as part of "PEP 466"). Please make sure you have installed
95 at least Python 2.7.9 or a Python version with backports of these security
96 features.
97 """
83 printf(error, file=sys.stderr) 98 printf(error, file=sys.stderr)
84 sys.exit(1) 99 sys.exit(1)
85 100
86 if sys.version_info[0] >= 3: 101 if sys.version_info[0] >= 3:
87 DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] 102 DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']