@@ -57,6 +57,16 @@ def log_i18n_level(gui, level: str, fr: str, en: str) -> None:
5757 pass
5858
5959
60+ def _log_tools (gui , level : str , stage : str , fr : str , en : str ) -> None :
61+ """Standardized tools-install log line with stage prefix."""
62+ log_i18n_level (
63+ gui ,
64+ level ,
65+ f"[tools:{ stage } ] { fr } " ,
66+ f"[tools:{ stage } ] { en } " ,
67+ )
68+
69+
6070class CompilerEngine :
6171 """
6272 Base class for a pluggable compilation engine.
@@ -214,9 +224,10 @@ def ensure_tools_installed(self, gui) -> bool:
214224 missing_system .append (tool )
215225
216226 if missing_system :
217- log_i18n_level (
227+ _log_tools (
218228 gui ,
219229 "info" ,
230+ "system" ,
220231 f"Installation des outils système manquants: { missing_system } " ,
221232 f"Installing missing system tools: { missing_system } " ,
222233 )
@@ -233,32 +244,36 @@ def ensure_tools_installed(self, gui) -> bool:
233244 # Wait for completion with timeout
234245 if process .waitForFinished (600000 ): # 10 minutes
235246 if process .exitCode () == 0 :
236- log_i18n_level (
247+ _log_tools (
237248 gui ,
238249 "success" ,
250+ "system" ,
239251 f"Outils système installés avec succès: { missing_system } " ,
240252 f"System tools installed successfully: { missing_system } " ,
241253 )
242254 else :
243- log_i18n_level (
255+ _log_tools (
244256 gui ,
245257 "error" ,
258+ "system" ,
246259 f"Échec installation outils système: { missing_system } (code: { process .exitCode ()} )" ,
247260 f"System tools installation failed: { missing_system } (code: { process .exitCode ()} )" ,
248261 )
249262 system_phase_ok = False
250263 else :
251- log_i18n_level (
264+ _log_tools (
252265 gui ,
253266 "warning" ,
267+ "system" ,
254268 "Timeout lors de l'installation des outils système" ,
255269 "Timeout during system tools installation" ,
256270 )
257271 system_phase_ok = False
258272 else :
259- log_i18n_level (
273+ _log_tools (
260274 gui ,
261275 "error" ,
276+ "system" ,
262277 "Impossible de démarrer l'installation des outils système" ,
263278 "Unable to start system tools installation" ,
264279 )
@@ -296,32 +311,36 @@ def ensure_tools_installed(self, gui) -> bool:
296311 if process :
297312 if process .waitForFinished (600000 ): # 10 minutes
298313 if process .exitCode () == 0 :
299- log_i18n_level (
314+ _log_tools (
300315 gui ,
301316 "success" ,
317+ "system" ,
302318 f"Outils Windows installés: { missing_system } " ,
303319 f"Windows tools installed: { missing_system } " ,
304320 )
305321 else :
306- log_i18n_level (
322+ _log_tools (
307323 gui ,
308324 "error" ,
325+ "system" ,
309326 f"Échec installation Windows: { missing_system } " ,
310327 f"Windows installation failed: { missing_system } " ,
311328 )
312329 system_phase_ok = False
313330 else :
314- log_i18n_level (
331+ _log_tools (
315332 gui ,
316333 "warning" ,
334+ "system" ,
317335 "Timeout lors de l'installation Windows" ,
318336 "Timeout during Windows installation" ,
319337 )
320338 system_phase_ok = False
321339 else :
322- log_i18n_level (
340+ _log_tools (
323341 gui ,
324342 "warning" ,
343+ "system" ,
325344 "winget non disponible, installation manuelle requise" ,
326345 "winget not available, manual installation required" ,
327346 )
@@ -333,50 +352,56 @@ def ensure_tools_installed(self, gui) -> bool:
333352 )
334353 system_phase_ok = False
335354 else :
336- log_i18n_level (
355+ _log_tools (
337356 gui ,
338357 "warning" ,
358+ "system" ,
339359 f"Aucun équivalent Windows pour: { missing_system } " ,
340360 f"No Windows equivalent for: { missing_system } " ,
341361 )
342362 else :
343- log_i18n_level (
363+ _log_tools (
344364 gui ,
345365 "warning" ,
366+ "system" ,
346367 "Plateforme non supportée pour l'installation automatique" ,
347368 "Platform not supported for automatic installation" ,
348369 )
349370 system_phase_ok = False
350371 else :
351- log_i18n_level (
372+ _log_tools (
352373 gui ,
353374 "success" ,
375+ "system" ,
354376 f"Tous les outils système sont déjà installés: { system_tools } " ,
355377 f"All system tools are already installed: { system_tools } " ,
356378 )
357379
358380 except Exception as e :
359- log_i18n_level (
381+ _log_tools (
360382 gui ,
361383 "warning" ,
384+ "system" ,
362385 f"Erreur lors de la vérification/installation des outils système: { e } " ,
363386 f"Error checking/installing system tools: { e } " ,
364387 )
365388 system_phase_ok = False
366389
367390 if not system_phase_ok :
368- log_i18n_level (
391+ _log_tools (
369392 gui ,
370393 "warning" ,
394+ "system" ,
371395 "Installation système incomplète/échouée; passage à l'installation Python." ,
372396 "System installation failed/incomplete; continuing with Python installation." ,
373397 )
374398
375399 # Install Python tools only after system phase has ended.
376400 if can_install_python and missing_python :
377- log_i18n_level (
401+ _log_tools (
378402 gui ,
379403 "info" ,
404+ "python" ,
380405 f"Installation des outils Python manquants: { missing_python } " ,
381406 f"Installing missing Python tools: { missing_python } " ,
382407 )
@@ -388,9 +413,10 @@ def ensure_tools_installed(self, gui) -> bool:
388413 python_venv_path , missing_python
389414 )
390415 except Exception as e :
391- log_i18n_level (
416+ _log_tools (
392417 gui ,
393418 "warning" ,
419+ "python" ,
394420 f"Erreur lors de l'installation des outils Python: { e } " ,
395421 f"Error during Python tools installation: { e } " ,
396422 )
0 commit comments