from setuphelpers import * def get_computer_type(): chassis_types = run_powershell( '(Get-CimInstance Win32_SystemEnclosure).ChassisTypes' ) if not isinstance(chassis_types, list): chassis_types = [chassis_types] laptop_types = {8, 9, 10, 14, 30, 31, 32} desktop_types = {3, 4, 5, 6, 7, 13, 15, 16, 24} chassis = {int(t) for t in chassis_types if t is not None} if chassis & laptop_types: return "laptop" elif chassis & desktop_types: return "desktop" else: return "unknown" def install(): computer_type = get_computer_type() if computer_type == "laptop": print("Portable détecté") # Configuration laptop elif computer_type == "desktop": print("Poste fixe détecté") # Configuration desktop else: print("Type de machine inconnu")