(root)/
Python-3.11.7/
PC/
layout/
support/
constants.py
       1  """
       2  Constants for generating the layout.
       3  """
       4  
       5  __author__ = "Steve Dower <steve.dower@python.org>"
       6  __version__ = "3.8"
       7  
       8  import os
       9  import re
      10  import struct
      11  import sys
      12  
      13  
      14  def _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", hexversion)
      20  
      21  
      22  def _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  
      30  VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4 = _unpack_hexversion()
      31  VER_SUFFIX = _get_suffix(VER_FIELD4)
      32  VER_FIELD3 = VER_MICRO << 8 | VER_FIELD4
      33  VER_DOT = "{}.{}".format(VER_MAJOR, VER_MINOR)
      34  
      35  PYTHON_DLL_NAME = "python{}{}.dll".format(VER_MAJOR, VER_MINOR)
      36  PYTHON_STABLE_DLL_NAME = "python{}.dll".format(VER_MAJOR)
      37  PYTHON_ZIP_NAME = "python{}{}.zip".format(VER_MAJOR, VER_MINOR)
      38  PYTHON_PTH_NAME = "python{}{}._pth".format(VER_MAJOR, VER_MINOR)
      39  
      40  PYTHON_CHM_NAME = "python{}{}{}{}.chm".format(
      41      VER_MAJOR, VER_MINOR, VER_MICRO, VER_SUFFIX
      42  )