@@ -289,29 +289,70 @@ def _get_packages_for_pm(self, pm: str) -> list[str]:
289289 return ["binutils" , "patchelf" , "p7zip-full" ]
290290
291291 def build_command (self , gui , file : str ) -> list [str ]:
292- """Build PyInstaller command."""
292+ """Build PyInstaller command using all configuration settings ."""
293293 try :
294- # Get configuration values
295- output_dir = self .config .get (gui , "output_dir" , default = "dist" )
296- one_file = self .config .get (gui , "one_file" , default = False )
297- console = self .config .get (gui , "console" , default = True )
298-
299- # Build command
300- cmd = ["pyinstaller" , file , "--distpath" , output_dir ]
301-
302- if one_file :
303- cmd .append ("--onefile" )
304-
305- if not console :
306- cmd .append ("--windowed" )
307-
294+ # Load configuration
295+ self .config .load (gui )
296+
308297 # Use GUI's build command if available (for backward compatibility)
309298 if hasattr (gui , "build_pyinstaller_command" ):
310299 try :
311300 return gui .build_pyinstaller_command (file )
312301 except Exception :
313302 pass
314303
304+ # Get all configuration values
305+ output_dir = self .config .get (gui , "output_dir" , default = "dist" )
306+ one_file = self .config .get (gui , "one_file" , default = False )
307+ console = self .config .get (gui , "console" , default = True )
308+ windowed = self .config .get (gui , "windowed" , default = False )
309+ icon_path = self .config .get (gui , "icon_path" , default = "" )
310+ upx_dir = self .config .get (gui , "upx_dir" , default = "" )
311+ clean = self .config .get (gui , "clean" , default = False )
312+ debug = self .config .get (gui , "debug" , default = "all" )
313+ optimization_level = self .config .get (gui , "optimization_level" , default = 2 )
314+ strip = self .config .get (gui , "strip" , default = False )
315+
316+ # Build base command
317+ cmd = ["pyinstaller" , file ]
318+
319+ # Output directory
320+ cmd .extend (["--distpath" , output_dir ])
321+
322+ # One file mode
323+ if one_file :
324+ cmd .append ("--onefile" )
325+
326+ # Console/Windowed mode
327+ if windowed or not console :
328+ cmd .append ("--windowed" )
329+ elif console and not windowed :
330+ cmd .append ("--console" )
331+
332+ # Icon
333+ if icon_path and os .path .exists (icon_path ):
334+ cmd .extend (["--icon" , icon_path ])
335+
336+ # UPX directory
337+ if upx_dir and os .path .isdir (upx_dir ):
338+ cmd .extend (["--upx-dir" , upx_dir ])
339+
340+ # Clean build
341+ if clean :
342+ cmd .append ("--clean" )
343+
344+ # Debug level
345+ if debug and debug != "all" :
346+ cmd .extend (["--debug" , debug ])
347+
348+ # Optimization level
349+ if optimization_level >= 0 :
350+ cmd .extend ([f"-O{ optimization_level } " ])
351+
352+ # Strip executable
353+ if strip :
354+ cmd .append ("--strip" )
355+
315356 return cmd
316357 except Exception as e :
317358 safe_log (gui , f"Build command error: { e } " )
0 commit comments