2626
2727# Nouvelle version de try_start_processes pour gérer les fichiers ignorés dynamiquement
2828def _continue_compile_all (self ):
29- # Charger la configuration ARK
29+ # Charger la configuration ARK complète
3030 ark_config = load_ark_config (self .workspace_dir )
3131 exclusion_patterns = ark_config .get ("exclusion_patterns" , [])
32+ inclusion_patterns = ark_config .get ("inclusion_patterns" , ["**/*.py" ])
3233 auto_detect_entry_points = ark_config .get ("auto_detect_entry_points" , True )
34+ compile_only_main_ark = ark_config .get ("compile_only_main" , False )
35+ main_file_names_ark = ark_config .get ("main_file_names" , ["main.py" , "app.py" ])
3336
3437 # Déplacé depuis compile_all pour poursuivre après BCASL sans bloquer l'UI
38+ # Compteurs pour les exclusions
39+ exclusion_counts = {
40+ "site_packages" : 0 ,
41+ "ark_patterns" : 0 ,
42+ "no_entry_point" : 0 ,
43+ "read_error" : 0 ,
44+ "not_exists" : 0
45+ }
46+
3547 def is_executable_script (path ):
3648 # Vérifie que le fichier existe, n'est pas dans site-packages, et contient un point d'entrée
3749 if not os .path .exists (path ):
38- self . log . append ( f"❌ Fichier inexistant : { path } " )
50+ exclusion_counts [ "not_exists" ] += 1
3951 return False
4052
4153 # Vérifier les patterns d'exclusion depuis ARK_Main_Config.yml
4254 if should_exclude_file (path , self .workspace_dir , exclusion_patterns ):
43- self . log . append ( f"⏩ Ignoré (pattern d'exclusion ARK) : { path } " )
55+ exclusion_counts [ "ark_patterns" ] += 1
4456 return False
4557
4658 if "site-packages" in path :
47- self . log . append ( f"⏩ Ignoré (site-packages) : { path } " )
59+ exclusion_counts [ "site_packages" ] += 1
4860 return False
4961
5062 # Si auto_detect_entry_points est désactivé, accepter tous les fichiers
@@ -60,10 +72,10 @@ def is_executable_script(path):
6072 ):
6173 return True
6274 else :
63- self . log . append ( f"⏩ Ignoré (pas de point d'entrée) : { path } " )
75+ exclusion_counts [ "no_entry_point" ] += 1
6476 return False
6577 except Exception as e :
66- self . log . append ( f"⏩ Ignoré (erreur lecture) : { path } ( { e } )" )
78+ exclusion_counts [ "read_error" ] += 1
6779 return False
6880
6981 # Détection du compilateur actif
@@ -75,10 +87,6 @@ def is_executable_script(path):
7587 if self .compiler_tabs .currentIndex () == 1 : # 0 = PyInstaller, 1 = Nuitka
7688 use_nuitka = True
7789
78- # Utiliser la configuration ARK pour déterminer les fichiers à compiler
79- compile_only_main_ark = ark_config .get ("compile_only_main" , False )
80- main_file_names_ark = ark_config .get ("main_file_names" , ["main.py" , "app.py" ])
81-
8290 # L'option UI a priorité sur la config ARK
8391 compile_only_main = self .opt_main_only .isChecked () if hasattr (self , "opt_main_only" ) else compile_only_main_ark
8492
@@ -90,13 +98,11 @@ def is_executable_script(path):
9098 else :
9199 files_ok = [f for f in self .python_files if is_executable_script (f )]
92100 self .queue = [(f , True ) for f in files_ok ]
93- len (files_ok )
94101 else :
95102 # PyInstaller : applique la logique main.py/app.py uniquement si l'option est cochée
96103 if self .selected_files :
97104 files_ok = [f for f in self .selected_files if is_executable_script (f )]
98105 self .queue = [(f , True ) for f in files_ok ]
99- len (files_ok )
100106 elif compile_only_main :
101107 # Utiliser les noms de fichiers depuis la config ARK
102108 files = [
@@ -106,17 +112,34 @@ def is_executable_script(path):
106112 ]
107113 files_ok = [f for f in files if is_executable_script (f )]
108114 self .queue = [(f , True ) for f in files_ok ]
109- len (files_ok )
110115 if not files_ok :
111116 main_names_str = ", " .join (main_file_names_ark )
112117 self .log .append (
113- f"⚠️ Aucun fichier exécutable trouvé parmi : { main_names_str } \n "
118+ f"❌ Aucun fichier exécutable trouvé parmi : { main_names_str } \n "
119+ f" Raison : Les fichiers spécifiés n'ont pas de point d'entrée (if __name__ == '__main__') ou n'existent pas.\n "
114120 )
121+ self .set_controls_enabled (True )
122+ if hasattr (self , "compiler_tabs" ) and self .compiler_tabs :
123+ self .compiler_tabs .setEnabled (True )
115124 return
116125 else :
117126 files_ok = [f for f in self .python_files if is_executable_script (f )]
118127 self .queue = [(f , True ) for f in files_ok ]
119- len (files_ok )
128+
129+ # Vérifier s'il y a des fichiers à compiler
130+ if not files_ok :
131+ self .log .append (
132+ f"❌ Aucun fichier exécutable à compiler.\n "
133+ f" Raisons possibles :\n "
134+ f" • Aucun fichier Python sélectionné ou dans le workspace\n "
135+ f" • Les fichiers n'ont pas de point d'entrée (if __name__ == '__main__')\n "
136+ f" • Les fichiers sont dans site-packages ou correspondent à des patterns d'exclusion\n "
137+ f" • Les fichiers n'existent pas ou ne sont pas accessibles\n "
138+ )
139+ self .set_controls_enabled (True )
140+ if hasattr (self , "compiler_tabs" ) and self .compiler_tabs :
141+ self .compiler_tabs .setEnabled (True )
142+ return
120143
121144 self .current_compiling .clear ()
122145 self .processes .clear ()
@@ -125,8 +148,13 @@ def is_executable_script(path):
125148 # Afficher les informations de configuration ARK
126149 if ark_config :
127150 self .log .append ("📋 Configuration ARK chargée depuis ARK_Main_Config.yml\n " )
151+ # Afficher les paramètres de compilation utilisés
152+ self .log .append (f" • Patterns d'inclusion : { ', ' .join (inclusion_patterns )} \n " )
153+ self .log .append (f" • Patterns d'exclusion : { len (exclusion_patterns )} pattern(s)\n " )
154+ self .log .append (f" • Détection point d'entrée : { 'Activée' if auto_detect_entry_points else 'Désactivée' } \n " )
155+ self .log .append (f" • Compiler uniquement main : { 'Oui' if compile_only_main else 'Non' } \n " )
128156
129- self .log .append ("🔨 Compilation parallèle démarrée...\n " )
157+ self .log .append (f "🔨 Compilation parallèle démarrée ( { len ( files_ok ) } fichier(s)) ...\n " )
130158
131159 self .set_controls_enabled (False )
132160 self .try_start_processes ()
@@ -224,77 +252,3 @@ def _after_bcasl(_report):
224252 except Exception :
225253 pass
226254 return
227-
228- def is_executable_script (path ):
229- # Vérifie que le fichier existe, n'est pas dans site-packages, et contient un point d'entrée
230- if not os .path .exists (path ):
231- self .log .append (f"❌ Fichier inexistant : { path } " )
232- return False
233- if "site-packages" in path :
234- self .log .append (f"⏩ Ignoré (site-packages) : { path } " )
235- return False
236- try :
237- with open (path , encoding = "utf-8" ) as f :
238- content = f .read ()
239- if (
240- "if __name__ == '__main__'" in content
241- or 'if __name__ == "__main__"' in content
242- ):
243- return True
244- else :
245- self .log .append (f"⏩ Ignoré (pas de point d'entrée) : { path } " )
246- return False
247- except Exception as e :
248- self .log .append (f"⏩ Ignoré (erreur lecture) : { path } ({ e } )" )
249- return False
250-
251- # Détection du compilateur actif
252- use_nuitka = False
253- if hasattr (self , "compiler_tabs" ) and self .compiler_tabs :
254- self .compiler_tabs .setEnabled (
255- False
256- ) # Désactive les onglets au début de la compilation
257- if self .compiler_tabs .currentIndex () == 1 : # 0 = PyInstaller, 1 = Nuitka
258- use_nuitka = True
259-
260- # Sélection des fichiers à compiler selon le compilateur
261- if use_nuitka :
262- # Nuitka : compile tous les fichiers sélectionnés ou tous les fichiers du workspace
263- if self .selected_files :
264- files_ok = [f for f in self .selected_files if is_executable_script (f )]
265- else :
266- files_ok = [f for f in self .python_files if is_executable_script (f )]
267- self .queue = [(f , True ) for f in files_ok ]
268- len (files_ok )
269- else :
270- # PyInstaller : applique la logique main.py/app.py uniquement si l'option est cochée
271- if self .selected_files :
272- files_ok = [f for f in self .selected_files if is_executable_script (f )]
273- self .queue = [(f , True ) for f in files_ok ]
274- len (files_ok )
275- elif self .opt_main_only .isChecked ():
276- files = [
277- f
278- for f in self .python_files
279- if os .path .basename (f ) in ("main.py" , "app.py" )
280- ]
281- files_ok = [f for f in files if is_executable_script (f )]
282- self .queue = [(f , True ) for f in files_ok ]
283- len (files_ok )
284- if not files_ok :
285- self .log .append (
286- "⚠️ Aucun main.py ou app.py exécutable trouvé dans le workspace.\n "
287- )
288- return
289- else :
290- files_ok = [f for f in self .python_files if is_executable_script (f )]
291- self .queue = [(f , True ) for f in files_ok ]
292- len (files_ok )
293-
294- self .current_compiling .clear ()
295- self .processes .clear ()
296- self .progress .setRange (0 , 0 ) # Mode indéterminé pendant toute la compilation
297- self .log .append ("🔨 Compilation parallèle démarrée...\n " )
298-
299- self .set_controls_enabled (False )
300- self .try_start_processes ()
0 commit comments