Skip to content

Commit 87388a9

Browse files
committed
Refactor SysDependencyManager and remove standalone check_system_packages function
1 parent d755571 commit 87388a9

2 files changed

Lines changed: 5 additions & 48 deletions

File tree

Core/sys_deps.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ def install_packages_linux(
919919
except Exception:
920920
return None
921921

922-
923922
def check_system_packages(packages: list[str]) -> bool:
924923
"""
925924
Check if system packages/tools are installed.
@@ -935,46 +934,3 @@ def check_system_packages(packages: list[str]) -> bool:
935934
return True
936935
except Exception:
937936
return False
938-
939-
940-
def install_system_packages(packages: list[str], gui) -> bool:
941-
"""
942-
Install system packages using the appropriate package manager.
943-
Returns True if successful, False otherwise.
944-
"""
945-
try:
946-
manager = SysDependencyManager(gui)
947-
system = platform.system().lower()
948-
949-
if system == "linux":
950-
# For Linux, use the install_packages_linux method
951-
process = manager.install_packages_linux(packages)
952-
if process:
953-
# Wait for completion (simplified - in practice should be async)
954-
process.waitForFinished(300000) # 5 minutes timeout
955-
return process.exitCode() == 0
956-
elif system == "windows":
957-
# For Windows, convert package names to winget format
958-
# This is a simplified mapping - in practice would need proper mapping
959-
winget_packages = []
960-
for pkg in packages:
961-
# Basic mapping - would need expansion for real use
962-
if pkg == "build-essential":
963-
winget_packages.append({"id": "Microsoft.VisualStudio.2022.BuildTools"})
964-
elif pkg == "python3-dev":
965-
winget_packages.append({"id": "Python.Python.3"})
966-
else:
967-
# Generic fallback
968-
winget_packages.append({"id": pkg})
969-
970-
process = manager.install_packages_windows(winget_packages)
971-
if process:
972-
process.waitForFinished(300000) # 5 minutes timeout
973-
return process.exitCode() == 0
974-
else:
975-
# Unsupported platform
976-
return False
977-
978-
return False
979-
except Exception:
980-
return False

TODO.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
2-
1- [x] reparer l'erreur comme quoi le build commande des engine ne fonctionne pas .
3-
2- [x] mettre à jours les documentations dans docs/.
4-
3- [x] revoir le readme.md, contributing.md, and supported_matrix.md .
1+
- [ ] Move check_system_packages inside SysDependencyManager class as @staticmethod
2+
- [ ] Remove the standalone check_system_packages function
3+
- [ ] Update import in Core/engines_loader/base.py to import SysDependencyManager
4+
- [ ] Change the call in base.py to use SysDependencyManager.check_system_packages
5+
- [ ] Test the changes

0 commit comments

Comments
 (0)