Skip to content

Platform vars


File: base/os/platform_vars.py

This file defines platform-specific variables to determine the current operating system. It checks the platform at runtime and sets the three boolean variables: - IS_WIN: True if the current platform is Windows - IS_DARWIN: True if the current platform is macOS - IS_LINUX: True if the current platform is Linux These variables should be used to write platform-specific code.

Functions:

  • invalid_platform

    Function that reports that the platform is invalid and returns 1.

invalid_platform

invalid_platform() -> int

Function that reports that the platform is invalid and returns 1.

Note

This function does not automatically crash the program because this creates problems with pythons static type checker. Therefore, the function needs to be nested inside exit(). Therefore, the function returns a non-zero value.

Returns:

  • int

    1 if the platform is invalid.

Source code in kern_comm_lib/base/os/platform_vars.py
def invalid_platform() -> int:
  """Function that reports that the platform is invalid and returns 1.

  Note:
    This function does not automatically crash the program because this
    creates problems with pythons static type checker. Therefore, the
    function needs to be nested inside exit(). Therefore, the function
    returns a non-zero value.

  Returns:
    1 if the platform is invalid.
  """
  print(f"Invalid platform: {platform.system()}")
  return 1