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