mirror of https://github.com/leafspark/AutoGGUF
ci: add optimized build scripts using Nuitka
This commit is contained in:
parent
ac725c678b
commit
a8ed4a87b1
|
@ -24,12 +24,14 @@ src/*
|
||||||
docs/*
|
docs/*
|
||||||
!docs/*.py
|
!docs/*.py
|
||||||
|
|
||||||
# Allow assets folder, but only .svg, .png, and .ico files
|
# Allow assets folder, but only .svg, .png, .rc and .ico files
|
||||||
!assets/
|
!assets/
|
||||||
assets/*
|
assets/*
|
||||||
!assets/*.svg
|
!assets/*.svg
|
||||||
!assets/*.png
|
!assets/*.png
|
||||||
!assets/*.ico
|
!assets/*.ico
|
||||||
|
!assets/*.rc
|
||||||
|
!assets/*.res
|
||||||
|
|
||||||
# Allow .github folder and its contents
|
# Allow .github folder and its contents
|
||||||
!.github/
|
!.github/
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
IDI_ICON1 ICON "favicon.ico"
|
|
@ -0,0 +1,26 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
if "%1"=="" (
|
||||||
|
echo Usage: build_fast.bat [RELEASE^|DEV]
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set COMMON_FLAGS=--standalone --enable-plugin=pyside6 --include-data-dir=assets=assets
|
||||||
|
|
||||||
|
if /I "%1"=="RELEASE" (
|
||||||
|
echo Building RELEASE version...
|
||||||
|
python -m nuitka %COMMON_FLAGS% --windows-console-mode=disable --output-dir=build\release src\main.py --lto=yes
|
||||||
|
) else if /I "%1"=="DEV" (
|
||||||
|
echo Building DEV version...
|
||||||
|
python -m nuitka %COMMON_FLAGS% --output-dir=build\dev src\main.py
|
||||||
|
) else (
|
||||||
|
echo Invalid argument. Use RELEASE or DEV.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Build failed.
|
||||||
|
exit /b 1
|
||||||
|
) else (
|
||||||
|
echo Build completed successfully.
|
||||||
|
)
|
|
@ -57,10 +57,14 @@ def open_file_safe(file_path, mode="r"):
|
||||||
|
|
||||||
|
|
||||||
def resource_path(relative_path):
|
def resource_path(relative_path):
|
||||||
try:
|
if hasattr(sys, "_MEIPASS"):
|
||||||
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
# PyInstaller path
|
||||||
base_path = sys._MEIPASS
|
base_path = sys._MEIPASS
|
||||||
except Exception:
|
elif "__compiled__" in globals():
|
||||||
|
# Nuitka path
|
||||||
|
base_path = os.path.dirname(sys.executable)
|
||||||
|
else:
|
||||||
|
# Regular Python path
|
||||||
base_path = os.path.abspath(".")
|
base_path = os.path.abspath(".")
|
||||||
|
|
||||||
return os.path.join(base_path, relative_path)
|
return os.path.join(base_path, relative_path)
|
||||||
|
|
Loading…
Reference in New Issue