|
89 | 89 | ) |
90 | 90 |
|
91 | 91 | # Importations de EngineLoader |
92 | | -from EngineLoader.registry import get_engine |
| 92 | +from EngineLoader.registry import get_engine, create |
93 | 93 |
|
94 | 94 | __all__ = [ |
95 | 95 | # compiler.py |
@@ -187,12 +187,13 @@ def compile_all(self) -> None: |
187 | 187 | if not engine_id: |
188 | 188 | engine_id = "pyinstaller" # Moteur par défaut |
189 | 189 |
|
190 | | - # Obtenir le moteur |
191 | | - engine = get_engine(engine_id) |
192 | | - if not engine: |
| 190 | + # Obtenir le moteur (instance) |
| 191 | + try: |
| 192 | + engine = create(engine_id) |
| 193 | + except Exception as e: |
193 | 194 | self.log_i18n( |
194 | | - f"❌ Moteur de compilation '{engine_id}' non trouvé.", |
195 | | - f"❌ Compilation engine '{engine_id}' not found.", |
| 195 | + f"❌ Erreur création moteur '{engine_id}': {e}", |
| 196 | + f"❌ Engine creation error '{engine_id}': {e}", |
196 | 197 | ) |
197 | 198 | return |
198 | 199 |
|
@@ -376,19 +377,19 @@ def start_compilation_process(self, engine_id: str, file_path: str) -> bool: |
376 | 377 | Returns: |
377 | 378 | True if compilation started, False otherwise |
378 | 379 | """ |
379 | | - # Obtenir le moteur |
380 | | - engine = get_engine(engine_id) |
381 | | - if not engine: |
| 380 | + # Obtenir le moteur (instance) |
| 381 | + try: |
| 382 | + engine = create(engine_id) |
| 383 | + except Exception as e: |
382 | 384 | self.log_i18n( |
383 | | - f"❌ Moteur '{engine_id}' non trouvé.", |
384 | | - f"❌ Engine '{engine_id}' not found.", |
| 385 | + f"❌ Erreur création moteur '{engine_id}': {e}", |
| 386 | + f"❌ Engine creation error '{engine_id}': {e}", |
385 | 387 | ) |
386 | 388 | return False |
387 | 389 |
|
388 | 390 | # Vérifier les prérequis |
389 | | - if hasattr(engine, "ensure_tools_installed"): |
390 | | - if not engine.ensure_tools_installed(self): |
391 | | - return False |
| 391 | + if not engine.ensure_tools_installed(self): |
| 392 | + return False |
392 | 393 |
|
393 | 394 | # Construire la commande |
394 | 395 | cmd = engine.build_command(self, file_path) |
@@ -530,7 +531,10 @@ def handle_finished(self, return_code: int, info: dict) -> None: |
530 | 531 | # Appeler on_success du moteur si disponible |
531 | 532 | engine_id = info.get("engine") |
532 | 533 | if engine_id: |
533 | | - engine = get_engine(engine_id) |
| 534 | + try: |
| 535 | + engine = create(engine_id) |
| 536 | + except Exception: |
| 537 | + engine = None |
534 | 538 | if engine and hasattr(engine, "on_success"): |
535 | 539 | file_path = info.get("file") |
536 | 540 | if file_path: |
|
0 commit comments