Skip to content

Commit 74704a5

Browse files
committed
auto save update
1 parent edb4246 commit 74704a5

6 files changed

Lines changed: 1017 additions & 39 deletions

File tree

ENGINES/cx_freeze/engine.py

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,24 +325,54 @@ def _get_packages_for_pm(self, pm: str) -> list[str]:
325325
return ["build-essential", "python3-dev", "patchelf"]
326326

327327
def build_command(self, gui, file: str) -> list[str]:
328-
"""Build cx_Freeze command."""
328+
"""Build cx_Freeze command using all configuration settings."""
329329
try:
330330
# Load configuration
331331
self.config.load(gui)
332332

333-
# Get configuration values
333+
# Get all configuration values
334334
output_dir = self.config.get(gui, "output_dir", default="dist")
335-
target_name = self.config.get(gui, "target_name", default=None)
335+
target_name = self.config.get(gui, "target_name", default="")
336336
base = self.config.get(gui, "base", default="Console")
337-
338-
# Build command
339-
cmd = [sys.executable, "-m", "cx_Freeze", file, "--target-dir", output_dir]
340-
337+
optimize = self.config.get(gui, "optimize", default=2)
338+
compress = self.config.get(gui, "compress", default=True)
339+
include_msvcr = self.config.get(gui, "include_msvcr", default=False)
340+
silent = self.config.get(gui, "silent", default=False)
341+
build_exe = self.config.get(gui, "build_exe", default="")
342+
343+
# Build base command
344+
cmd = [sys.executable, "-m", "cx_Freeze", file]
345+
346+
# Target directory
347+
cmd.extend(["--target-dir", output_dir])
348+
349+
# Target name
341350
if target_name:
342351
cmd.extend(["--target-name", target_name])
343-
344-
if platform.system() == "Windows" and base != "Console":
352+
353+
# Build exe directory
354+
if build_exe:
355+
cmd.extend(["--build-exe", build_exe])
356+
357+
# Base (Windows only)
358+
if platform.system() == "Windows" and base and base != "Console":
345359
cmd.extend(["--base-name", base])
360+
361+
# Optimization level
362+
if optimize >= 0:
363+
cmd.extend([f"--optimize={optimize}"])
364+
365+
# Compress
366+
if compress:
367+
cmd.append("--compress")
368+
369+
# Include MSVCR
370+
if include_msvcr:
371+
cmd.append("--include-msvcr")
372+
373+
# Silent mode
374+
if silent:
375+
cmd.append("--silent")
346376

347377
return cmd
348378
except Exception as e:

ENGINES/nuitka/engine.py

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,31 +321,71 @@ def _get_packages_for_pm(self, pm: str) -> list[str]:
321321
return ["build-essential", "python3-dev", "patchelf"]
322322

323323
def build_command(self, gui, file: str) -> list[str]:
324-
"""Build Nuitka command."""
324+
"""Build Nuitka command using all configuration settings."""
325325
try:
326326
# Load configuration
327327
self.config.load(gui)
328+
329+
# Use GUI's build command if available (for backward compatibility)
330+
if hasattr(gui, "build_nuitka_command"):
331+
try:
332+
return gui.build_nuitka_command(file)
333+
except Exception:
334+
pass
328335

329-
# Get configuration values
336+
# Get all configuration values
330337
output_dir = self.config.get(gui, "output_dir", default="dist")
338+
standalone = self.config.get(gui, "standalone", default=True)
331339
one_file = self.config.get(gui, "one_file", default=False)
340+
onefile = self.config.get(gui, "onefile", default=False)
332341
optimization = self.config.get(gui, "optimization", default=0)
333-
334-
# Build command
335-
cmd = ["python", "-m", "nuitka", file, "--output-dir", output_dir]
336-
342+
windows_disable_console = self.config.get(gui, "windows_disable_console", default=False)
343+
windows_icon_from_ico = self.config.get(gui, "windows_icon_from_ico", default="")
344+
follow_imports = self.config.get(gui, "follow_imports", default=True)
345+
remove_output = self.config.get(gui, "remove_output", default=True)
346+
jobs = self.config.get(gui, "jobs", default=0)
347+
348+
# Build base command
349+
cmd = ["python", "-m", "nuitka", file]
350+
351+
# Output directory
352+
cmd.extend(["--output-dir", output_dir])
353+
354+
# Standalone mode
355+
if standalone:
356+
cmd.append("--standalone")
357+
358+
# One file modes
337359
if one_file:
338360
cmd.append("--onefile")
339-
361+
if onefile:
362+
cmd.append("--onefile")
363+
364+
# Optimization level
340365
if optimization > 0:
341-
cmd.extend(["--optimize", str(optimization)])
342-
343-
# Use GUI's build command if available (for backward compatibility)
344-
if hasattr(gui, "build_nuitka_command"):
345-
try:
346-
return gui.build_nuitka_command(file)
347-
except Exception:
348-
pass
366+
cmd.extend([f"-O{optimization}"])
367+
368+
# Follow imports
369+
if follow_imports:
370+
cmd.append("--follow-imports")
371+
else:
372+
cmd.append("--nofollow-imports")
373+
374+
# Remove output
375+
if remove_output:
376+
cmd.append("--remove-output")
377+
378+
# Jobs (parallel compilation)
379+
if jobs > 0:
380+
cmd.extend([f"--jobs={jobs}"])
381+
382+
# Windows-specific options
383+
if platform.system() == "Windows":
384+
if windows_disable_console:
385+
cmd.append("--windows-disable-console")
386+
387+
if windows_icon_from_ico and os.path.exists(windows_icon_from_ico):
388+
cmd.extend([f"--windows-icon-from-ico={windows_icon_from_ico}"])
349389

350390
return cmd
351391
except Exception as e:

ENGINES/pyinstaller/engine.py

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)