Skip to content

Commit 4d1d161

Browse files
committed
Added check_system_packages function to check for system package availability
1 parent 7fd14b7 commit 4d1d161

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Core/sys_deps.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,23 @@ def install_packages_linux(
920920
return None
921921

922922

923+
def check_system_packages(packages: list[str]) -> bool:
924+
"""
925+
Check if system packages/tools are installed.
926+
Returns True if all packages/tools are available, False otherwise.
927+
Uses shutil.which() to check for command availability.
928+
"""
929+
try:
930+
if not packages:
931+
return True
932+
for pkg in packages:
933+
if pkg and not shutil.which(pkg):
934+
return False
935+
return True
936+
except Exception:
937+
return False
938+
939+
923940
def install_system_packages(packages: list[str], gui) -> bool:
924941
"""
925942
Install system packages using the appropriate package manager.

0 commit comments

Comments
 (0)