MCPcopy
hub / github.com/zai-org/Open-AutoGLM / check_system_requirements

Function check_system_requirements

main.py:37–269  ·  view source on GitHub ↗

Check system requirements before running the agent. Checks: 1. ADB/HDC/iOS tools installed 2. At least one device connected 3. ADB Keyboard installed on the device (for ADB only) 4. WebDriverAgent running (for iOS only) Args: device_type: Type of device tool (A

(
    device_type: DeviceType = DeviceType.ADB, wda_url: str = "http://localhost:8100"
)

Source from the content-addressed store, hash-verified

35
36
37def check_system_requirements(
38 device_type: DeviceType = DeviceType.ADB, wda_url: str = "http://localhost:8100"
39) -> bool:
40 """
41 Check system requirements before running the agent.
42
43 Checks:
44 1. ADB/HDC/iOS tools installed
45 2. At least one device connected
46 3. ADB Keyboard installed on the device (for ADB only)
47 4. WebDriverAgent running (for iOS only)
48
49 Args:
50 device_type: Type of device tool (ADB, HDC, or IOS).
51 wda_url: WebDriverAgent URL (for iOS only).
52
53 Returns:
54 True if all checks pass, False otherwise.
55 """
56 print("🔍 Checking system requirements...")
57 print("-" * 50)
58
59 all_passed = True
60
61 # Determine tool name and command
62 if device_type == DeviceType.IOS:
63 tool_name = "libimobiledevice"
64 tool_cmd = "idevice_id"
65 else:
66 tool_name = "ADB" if device_type == DeviceType.ADB else "HDC"
67 tool_cmd = "adb" if device_type == DeviceType.ADB else "hdc"
68
69 # Check 1: Tool installed
70 print(f"1. Checking {tool_name} installation...", end=" ")
71 if shutil.which(tool_cmd) is None:
72 print("❌ FAILED")
73 print(f" Error: {tool_name} is not installed or not in PATH.")
74 print(f" Solution: Install {tool_name}:")
75 if device_type == DeviceType.ADB:
76 print(" - macOS: brew install android-platform-tools")
77 print(" - Linux: sudo apt install android-tools-adb")
78 print(
79 " - Windows: Download from https://developer.android.com/studio/releases/platform-tools"
80 )
81 elif device_type == DeviceType.HDC:
82 print(
83 " - Download from HarmonyOS SDK or https://gitee.com/openharmony/docs"
84 )
85 print(" - Add to PATH environment variable")
86 else: # IOS
87 print(" - macOS: brew install libimobiledevice")
88 print(" - Linux: sudo apt-get install libimobiledevice-utils")
89 all_passed = False
90 else:
91 # Double check by running version command
92 try:
93 if device_type == DeviceType.ADB:
94 version_cmd = [tool_cmd, "version"]

Callers 1

mainFunction · 0.70

Calls 4

is_wda_readyMethod · 0.95
get_wda_statusMethod · 0.95
XCTestConnectionClass · 0.90
runMethod · 0.45

Tested by

no test coverage detected