@@ -2047,24 +2047,55 @@ def _on_manager_install_finished(self, process, code, status, manager):
20472047
20482048 QApplication .processEvents ()
20492049
2050- def setup_workspace (self , workspace_dir : str ) -> bool :
2050+ def setup_workspace (self , workspace_dir : str , check_tools : bool = True ) -> bool :
20512051 """Setup a workspace with venv and dependencies.
20522052
20532053 This centralizes the workspace setup logic that was previously
20542054 scattered in MainWindow.apply_workspace_selection().
20552055
20562056 Args:
20572057 workspace_dir: Path to the workspace directory
2058+ check_tools: Whether to check and install tools (pyinstaller, nuitka, cx_freeze)
2059+ after venv creation. Defaults to True.
20582060
20592061 Returns:
20602062 bool: True if setup successful, False otherwise
20612063 """
20622064 try :
20632065 workspace_dir = os .path .abspath (workspace_dir )
20642066
2067+ # Resolve venv path first to check if it exists
2068+ existing , default_path = self ._detect_venv_in (workspace_dir )
2069+ venv_path = existing or default_path
2070+
20652071 # Create venv if needed
20662072 self .create_venv_if_needed (workspace_dir )
20672073
2074+ # Check and install tools if requested
2075+ if check_tools :
2076+ # Verify venv exists and is valid before checking tools
2077+ existing_check , _ = self ._detect_venv_in (workspace_dir )
2078+ if existing_check :
2079+ ok , reason = self .validate_venv_strict (existing_check )
2080+ if ok :
2081+ # Verify binding and then check tools
2082+ def _after_binding (ok_bind : bool ):
2083+ if ok_bind :
2084+ self ._safe_log (
2085+ "🔍 Vérification des outils de compilation..."
2086+ )
2087+ self .check_tools_in_venv (existing_check )
2088+ else :
2089+ self ._safe_log (
2090+ "⚠️ Liaison venv invalide, vérification des outils ignorée."
2091+ )
2092+
2093+ self ._verify_venv_binding_async (existing_check , _after_binding )
2094+ else :
2095+ self ._safe_log (
2096+ f"⚠️ Venv invalide, vérification des outils ignorée: { reason } "
2097+ )
2098+
20682099 # Create ARK config if it doesn't exist
20692100 try :
20702101 from Core .ark_config_loader import create_default_ark_config
0 commit comments