1""" 2Constants for generating the layout. 3""" 4 5__author__ = "Steve Dower <steve.dower@python.org>" 6__version__ = "3.8" 7 8import os 9import struct 10import sys 11 12 13def _unpack_hexversion(): 14 try: 15 hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16) 16 except (TypeError, ValueError): 17 hexversion = sys.hexversion 18 return struct.pack(">i", hexversion) 19 20 21def _get_suffix(field4): 22 name = {0xA0: "a", 0xB0: "b", 0xC0: "rc"}.get(field4 & 0xF0, "") 23 if name: 24 serial = field4 & 0x0F 25 return f"{name}{serial}" 26 return "" 27 28 29VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4 = _unpack_hexversion() 30VER_SUFFIX = _get_suffix(VER_FIELD4) 31VER_FIELD3 = VER_MICRO << 8 | VER_FIELD4 32VER_DOT = "{}.{}".format(VER_MAJOR, VER_MINOR) 33 34PYTHON_DLL_NAME = "python{}{}.dll".format(VER_MAJOR, VER_MINOR) 35PYTHON_STABLE_DLL_NAME = "python{}.dll".format(VER_MAJOR) 36PYTHON_ZIP_NAME = "python{}{}.zip".format(VER_MAJOR, VER_MINOR) 37PYTHON_PTH_NAME = "python{}{}._pth".format(VER_MAJOR, VER_MINOR) 38 39PYTHON_CHM_NAME = "python{}{}{}{}.chm".format( 40 VER_MAJOR, VER_MINOR, VER_MICRO, VER_SUFFIX 41) 42 43FREETHREADED_PYTHON_DLL_NAME = "python{}{}t.dll".format(VER_MAJOR, VER_MINOR) 44FREETHREADED_PYTHON_STABLE_DLL_NAME = "python{}t.dll".format(VER_MAJOR) 45