mesaport.Installer.syscheck

 1import platform
 2
 3import cpuinfo
 4
 5def whichos():
 6    """Determine the OS type.
 7
 8    Raises:
 9        OSError: If OS is not compatible.
10
11    Returns:
12        str: OS type. 
13    """
14    if "macOS" in platform.platform():
15        manufacturer = cpuinfo.get_cpu_info().get('brand_raw')
16        arch = 'Intel' if 'intel' in manufacturer.lower() else 'ARM'
17        return f"macOS-{arch}"
18    elif "Linux" in platform.platform():
19        return "Linux"
20    else:
21        raise OSError(f"OS {platform.platform()} not compatible.")
22        
def whichos():
 6def whichos():
 7    """Determine the OS type.
 8
 9    Raises:
10        OSError: If OS is not compatible.
11
12    Returns:
13        str: OS type. 
14    """
15    if "macOS" in platform.platform():
16        manufacturer = cpuinfo.get_cpu_info().get('brand_raw')
17        arch = 'Intel' if 'intel' in manufacturer.lower() else 'ARM'
18        return f"macOS-{arch}"
19    elif "Linux" in platform.platform():
20        return "Linux"
21    else:
22        raise OSError(f"OS {platform.platform()} not compatible.")

Determine the OS type.

Raises:
  • OSError: If OS is not compatible.
Returns:

str: OS type.