@@ -195,60 +195,55 @@ def _tr(fr, en):
195195 # Utiliser VenvManager s'il est là, sinon fallback pip
196196 vm = getattr (gui , "venv_manager" , None )
197197 if vm :
198- # Fast non-blocking heuristic; if present, proceed
198+ # Check if already installed
199199 if vm .is_tool_installed (vroot , "pyinstaller" ):
200+ try :
201+ gui .log .append (
202+ gui .tr (
203+ "✅ PyInstaller déjà installé" ,
204+ "✅ PyInstaller already installed" ,
205+ )
206+ )
207+ except Exception :
208+ pass
200209 return True
201- # Async confirm, then install if missing
210+
211+ # Install synchronously (blocking) to ensure it's ready before build
202212 try :
203213 gui .log .append (
204214 gui .tr (
205- "🔎 Vérification de PyInstaller dans le venv (asynchrone) …" ,
206- "🔎 Verifying PyInstaller in venv (async) …" ,
215+ "📦 Installation de PyInstaller dans le venv…" ,
216+ "📦 Installing PyInstaller in venv…" ,
207217 )
208218 )
209219 except Exception :
210220 pass
211-
212- def _on_check (ok : bool ):
221+
222+ vm .ensure_tools_installed (vroot , ["pyinstaller" ])
223+
224+ # Verify installation
225+ if vm .is_tool_installed (vroot , "pyinstaller" ):
213226 try :
214- if ok :
215- try :
216- gui .log .append (
217- gui .tr (
218- "✅ PyInstaller déjà installé" ,
219- "✅ PyInstaller already installed" ,
220- )
221- )
222- except Exception :
223- pass
224- else :
225- try :
226- gui .log .append (
227- gui .tr (
228- "📦 Installation de PyInstaller dans le venv (asynchrone)…" ,
229- "📦 Installing PyInstaller in venv (async)…" ,
230- )
231- )
232- except Exception :
233- pass
234- vm .ensure_tools_installed (vroot , ["pyinstaller" ])
227+ gui .log .append (
228+ gui .tr (
229+ "✅ PyInstaller installé avec succès" ,
230+ "✅ PyInstaller installed successfully" ,
231+ )
232+ )
235233 except Exception :
236234 pass
237-
238- try :
239- vm .is_tool_installed_async (vroot , "pyinstaller" , _on_check )
240- except Exception :
235+ return True
236+ else :
241237 try :
242238 gui .log .append (
243239 gui .tr (
244- "📦 Installation de PyInstaller dans le venv (asynchrone)… " ,
245- "📦 Installing PyInstaller in venv (async)… " ,
240+ "❌ Échec de l'installation de PyInstaller " ,
241+ "❌ Failed to install PyInstaller " ,
246242 )
247243 )
248244 except Exception :
249245 pass
250- vm .ensure_tools_installed (vroot , ["pyinstaller" ])
251- return False
246+ return False
252247 else :
253248 return self ._ensure_tool_with_pip (gui , vroot , "pyinstaller" )
254249 except Exception :
@@ -363,7 +358,7 @@ def build_command(self, gui, file: str) -> list[str]:
363358
364359 def program_and_args (self , gui , file : str ) -> Optional [tuple [str , list [str ]]]:
365360 cmd = self .build_command (gui , file )
366- # Resolve pyinstaller binary from venv via VenvManager
361+ # Resolve python from venv via VenvManager
367362 try :
368363 vm = getattr (gui , "venv_manager" , None )
369364 vroot = vm .resolve_project_venv () if vm else None
@@ -379,21 +374,21 @@ def program_and_args(self, gui, file: str) -> Optional[tuple[str, list[str]]]:
379374 vbin = os .path .join (
380375 vroot , "Scripts" if platform .system () == "Windows" else "bin"
381376 )
382- pyinstaller_path = os .path .join (
377+ python_path = os .path .join (
383378 vbin ,
384- "pyinstaller " if platform .system () != "Windows" else "pyinstaller.exe " ,
379+ "python.exe " if platform .system () == "Windows" else "python " ,
385380 )
386- if not os .path .isfile (pyinstaller_path ):
381+ if not os .path .isfile (python_path ):
387382 gui .log .append (
388383 gui .tr (
389- "❌ pyinstaller non trouvé dans le venv : " ,
390- "❌ pyinstaller not found in venv: " ,
384+ "❌ python non trouvé dans le venv : " ,
385+ "❌ python not found in venv: " ,
391386 )
392- + str (pyinstaller_path )
387+ + str (python_path )
393388 )
394389 gui .show_error_dialog (os .path .basename (file ))
395390 return None
396- return pyinstaller_path , cmd [1 :]
391+ return python_path , cmd [1 :]
397392 except Exception :
398393 return None
399394
0 commit comments