setup.py
branchstable
changeset 45181 28163c5de797
parent 45132 9d532329ee97
child 45269 8bc9d045005a
equal deleted inserted replaced
45092:e699cebc3ae9 45181:28163c5de797
    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 """
       
    98     printf(error, file=sys.stderr)
       
    99     sys.exit(1)
       
   100 
       
   101 # ssl.HAS_TLSv1* are preferred to check support but they were added in Python
       
   102 # 3.7. Prior to CPython commit 6e8cda91d92da72800d891b2fc2073ecbc134d98
       
   103 # (backported to the 3.7 branch), ssl.PROTOCOL_TLSv1_1 / ssl.PROTOCOL_TLSv1_2
       
   104 # were defined only if compiled against a OpenSSL version with TLS 1.1 / 1.2
       
   105 # support. At the mentioned commit, they were unconditionally defined.
       
   106 _notset = object()
       
   107 has_tlsv1_1 = getattr(ssl, 'HAS_TLSv1_1', _notset)
       
   108 if has_tlsv1_1 is _notset:
       
   109     has_tlsv1_1 = getattr(ssl, 'PROTOCOL_TLSv1_1', _notset) is not _notset
       
   110 has_tlsv1_2 = getattr(ssl, 'HAS_TLSv1_2', _notset)
       
   111 if has_tlsv1_2 is _notset:
       
   112     has_tlsv1_2 = getattr(ssl, 'PROTOCOL_TLSv1_2', _notset) is not _notset
       
   113 if not (has_tlsv1_1 or has_tlsv1_2):
       
   114     error = """
       
   115 The `ssl` module does not advertise support for TLS 1.1 or TLS 1.2.
       
   116 Please make sure that your Python installation was compiled against an OpenSSL
       
   117 version enabling these features (likely this requires the OpenSSL version to
       
   118 be at least 1.0.1).
       
   119 """
    83     printf(error, file=sys.stderr)
   120     printf(error, file=sys.stderr)
    84     sys.exit(1)
   121     sys.exit(1)
    85 
   122 
    86 if sys.version_info[0] >= 3:
   123 if sys.version_info[0] >= 3:
    87     DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
   124     DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
  1394             # HOME is shadowed like this)
  1431             # HOME is shadowed like this)
  1395             import pwd
  1432             import pwd
  1396 
  1433 
  1397             env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir
  1434             env['HOME'] = pwd.getpwuid(os.getuid()).pw_dir
  1398 
  1435 
  1399         cargocmd = ['cargo', 'rustc', '-vv', '--release']
  1436         cargocmd = ['cargo', 'rustc', '--release']
  1400 
  1437 
  1401         feature_flags = []
  1438         feature_flags = []
  1402 
  1439 
  1403         if sys.version_info[0] == 3 and self.py3_features is not None:
  1440         if sys.version_info[0] == 3 and self.py3_features is not None:
  1404             feature_flags.append(self.py3_features)
  1441             feature_flags.append(self.py3_features)
  1656 
  1693 
  1657     dllexcludes = os.environ.get('HG_PY2EXE_EXTRA_DLL_EXCLUDES')
  1694     dllexcludes = os.environ.get('HG_PY2EXE_EXTRA_DLL_EXCLUDES')
  1658     if dllexcludes:
  1695     if dllexcludes:
  1659         py2exedllexcludes.extend(dllexcludes.split(' '))
  1696         py2exedllexcludes.extend(dllexcludes.split(' '))
  1660 
  1697 
       
  1698 if os.environ.get('PYOXIDIZER'):
       
  1699     hgbuild.sub_commands.insert(0, ('build_hgextindex', None))
       
  1700 
  1661 if os.name == 'nt':
  1701 if os.name == 'nt':
  1662     # Windows binary file versions for exe/dll files must have the
  1702     # Windows binary file versions for exe/dll files must have the
  1663     # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
  1703     # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
  1664     setupversion = setupversion.split(r'+', 1)[0]
  1704     setupversion = setupversion.split(r'+', 1)[0]
  1665 
  1705