@@ -906,134 +906,6 @@ def cancel_all_compilations(self):
906906 )
907907
908908
909- def build_pyinstaller_command (self , file ):
910- cmd = ["pyinstaller" ]
911- if self .opt_onefile .isChecked ():
912- cmd .append ("--onefile" )
913- if self .opt_windowed .isChecked ():
914- cmd .append ("--windowed" )
915- if self .opt_noconfirm .isChecked ():
916- cmd .append ("--noconfirm" )
917- if self .opt_clean .isChecked ():
918- cmd .append ("--clean" )
919- if self .opt_noupx .isChecked ():
920- cmd .append ("--noupx" )
921- if self .opt_debug .isChecked ():
922- cmd .append ("--debug" )
923- if self .icon_path :
924- cmd .append (f"--icon={ self .icon_path } " )
925- # Ajout des fichiers/dossiers de données PyInstaller
926- if hasattr (self , "pyinstaller_data" ):
927- for src , dest in self .pyinstaller_data :
928- cmd .append (f"--add-data={ src } :{ dest } " )
929- # Auto ajout des hooks/plugins via détection
930- try :
931- auto_map = compute_for_all (self ) or {}
932- auto_args = auto_map .get ("pyinstaller" , [])
933- if auto_args :
934- cmd .extend (auto_args )
935- except Exception as e :
936- try :
937- self .log .append (f"⚠️ Auto-détection PyInstaller: { e } " )
938- except Exception :
939- pass
940- cmd .append (file )
941-
942- custom_name = self .output_name_input .text ().strip ()
943- if custom_name :
944- output_name = (
945- custom_name + ".exe" if platform .system () == "Windows" else custom_name
946- )
947- else :
948- base_name = os .path .splitext (os .path .basename (file ))[0 ]
949- output_name = (
950- base_name + ".exe" if platform .system () == "Windows" else base_name
951- )
952- cmd += ["--name" , output_name ]
953-
954- # Dossier de sortie
955- output_dir = self .output_dir_input .text ().strip ()
956- if output_dir :
957- cmd += ["--distpath" , output_dir ]
958909
959- return cmd
960910
961911
962- def build_nuitka_command (self , file ):
963- cmd = ["python3" , "-m" , "nuitka" ]
964- if self .nuitka_onefile and self .nuitka_onefile .isChecked ():
965- cmd .append ("--onefile" )
966- if self .nuitka_standalone and self .nuitka_standalone .isChecked ():
967- cmd .append ("--standalone" )
968- import platform
969-
970- if (
971- self .nuitka_disable_console
972- and self .nuitka_disable_console .isChecked ()
973- and platform .system () == "Windows"
974- ):
975- cmd .append ("--windows-disable-console" )
976- if self .nuitka_show_progress and self .nuitka_show_progress .isChecked ():
977- cmd .append ("--show-progress" )
978- # Ajout automatique du plugin PySide6 ou PyQt6 si utilisé, mais jamais les deux
979- plugins = []
980- # Champ nuitka_plugins supprimé: les plugins sont gérés automatiquement
981- # Forcer l'ajout de pyside6 ou pyqt6 si importés dans le projet
982- found_pyside6 = False
983- found_pyqt6 = False
984- try :
985- with open (file , encoding = "utf-8" ) as f :
986- content = f .read ()
987- if "import PySide6" in content or "from PySide6" in content :
988- found_pyside6 = True
989- if "import PyQt6" in content or "from PyQt6" in content :
990- found_pyqt6 = True
991- except Exception :
992- pass
993- # Ne jamais activer les deux plugins Qt en même temps
994- if found_pyside6 :
995- if "pyqt6" in plugins :
996- plugins .remove ("pyqt6" )
997- if "pyside6" not in plugins :
998- plugins .append ("pyside6" )
999- elif found_pyqt6 :
1000- if "pyside6" in plugins :
1001- plugins .remove ("pyside6" )
1002- if "pyqt6" not in plugins :
1003- plugins .append ("pyqt6" )
1004- # Si les deux sont dans la liste, n'en garder qu'un (priorité à pyside6)
1005- if "pyside6" in plugins and "pyqt6" in plugins :
1006- plugins .remove ("pyqt6" )
1007- for plugin in plugins :
1008- cmd .append (f"--plugin-enable={ plugin } " )
1009- # Auto ajout des plugins Nuitka via détection
1010- try :
1011- auto_map = compute_for_all (self ) or {}
1012- auto_nuitka_args = auto_map .get ("nuitka" , [])
1013- for a in auto_nuitka_args :
1014- if a not in cmd :
1015- cmd .append (a )
1016- except Exception as e :
1017- try :
1018- self .log .append (f"⚠️ Auto-détection Nuitka: { e } " )
1019- except Exception :
1020- pass
1021- # Nuitka icon: priorité à self.nuitka_icon_path si défini, sinon self.icon_path
1022- import platform
1023-
1024- if platform .system () == "Windows" :
1025- if hasattr (self , "nuitka_icon_path" ) and self .nuitka_icon_path :
1026- cmd .append (f"--windows-icon-from-ico={ self .nuitka_icon_path } " )
1027- elif self .icon_path :
1028- cmd .append (f"--windows-icon-from-ico={ self .icon_path } " )
1029- if self .nuitka_output_dir and self .nuitka_output_dir .text ().strip ():
1030- cmd .append (f"--output-dir={ self .nuitka_output_dir .text ().strip ()} " )
1031- # Ajout des fichiers de données Nuitka
1032- if hasattr (self , "nuitka_data_files" ):
1033- for src , dest in self .nuitka_data_files :
1034- cmd .append (f"--include-data-files={ src } ={ dest } " )
1035- if hasattr (self , "nuitka_data_dirs" ):
1036- for src , dest in self .nuitka_data_dirs :
1037- cmd .append (f"--include-data-dir={ src } ={ dest } " )
1038- cmd .append (file )
1039- return cmd
0 commit comments