Skip to content

Commit c67d156

Browse files
committed
Amélioration: appel automatique de on_success (ouverture du dossier de sortie) après compilation réussie
1 parent 73e9382 commit c67d156

4 files changed

Lines changed: 30 additions & 6 deletions

File tree

Core/Compiler/engine_runner.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,21 @@ def _read_stream(stream, callback):
430430
stdout_thread.join()
431431
stderr_thread.join()
432432

433-
return {
434-
"success": process.returncode == 0,
435-
"return_code": process.returncode,
436-
"command": command,
437-
"error": None if process.returncode == 0 else "Build failed",
438-
}
433+
# Call on_success hook if compilation succeeded
434+
if process.returncode == 0:
435+
try:
436+
if hasattr(engine_instance, "on_success"):
437+
engine_instance.on_success(bridge, str(entry_path))
438+
except Exception:
439+
pass
440+
441+
return {
442+
"success": process.returncode == 0,
443+
"return_code": process.returncode,
444+
"command": command,
445+
"error": None if process.returncode == 0 else "Build failed",
446+
}
447+
439448

440449

441450
# -- helpers ------------------------------------------------------------------

engines/cx_freeze/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def preflight(self, gui, file: str) -> bool:
6666

6767
def build_command(self, context: BuildContext) -> list[str]:
6868
"""Build a cx_Freeze command line from a normalized build context."""
69+
self._last_context = context
6970
cfg = getattr(self, "_config_overrides", {})
7071
if not isinstance(cfg, dict):
7172
cfg = {}
@@ -149,6 +150,10 @@ def on_success(self, gui, file: str) -> None:
149150
"success",
150151
"Compilation CX_Freeze terminée avec succès.",
151152
)
153+
154+
# Open output directory automatically
155+
if hasattr(self, "_last_context") and self._last_context:
156+
self.open_output_dir(self._last_context.output_dir)
152157
except Exception:
153158
pass
154159

engines/nuitka/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def preflight(self, gui, file: str) -> bool:
7171

7272
def build_command(self, context: BuildContext) -> list[str]:
7373
"""Build a Nuitka command line from a normalized build context."""
74+
self._last_context = context
7475
cfg = getattr(self, "_config_overrides", {})
7576
if not isinstance(cfg, dict):
7677
cfg = {}
@@ -172,6 +173,10 @@ def on_success(self, gui, file: str) -> None:
172173
"success",
173174
"Compilation Nuitka terminée avec succès.",
174175
)
176+
177+
# Open output directory automatically
178+
if hasattr(self, "_last_context") and self._last_context:
179+
self.open_output_dir(self._last_context.output_dir)
175180
except Exception:
176181
pass
177182

engines/pyinstaller/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def preflight(self, gui, file: str) -> bool:
6666

6767
def build_command(self, context: BuildContext) -> list[str]:
6868
"""Build a PyInstaller command line from a normalized build context."""
69+
self._last_context = context
6970
cfg = getattr(self, "_config_overrides", {})
7071
if not isinstance(cfg, dict):
7172
cfg = {}
@@ -154,6 +155,10 @@ def on_success(self, gui, file: str) -> None:
154155
"success",
155156
"Compilation PyInstaller terminée avec succès.",
156157
)
158+
159+
# Open output directory automatically
160+
if hasattr(self, "_last_context") and self._last_context:
161+
self.open_output_dir(self._last_context.output_dir)
157162
except Exception:
158163
pass
159164

0 commit comments

Comments
 (0)