调整文件目录

This commit is contained in:
2026-07-07 14:37:04 +08:00
parent 98a1e9d371
commit 295558836b
53 changed files with 22339 additions and 4242 deletions
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+153
View File
@@ -0,0 +1,153 @@
@echo off
chcp 65001 >nul
cd /d "%~dp0"
set "ROOT=%~dp0.."
set "TOOLS=%ROOT%\tools"
set "NAME=Mazda-EZ6-Installer"
set "SRC=Mazda-EZ6_Installer.py"
set "ICON=%~dp0app.ico"
title %NAME% - Cython Build
echo ============================================================
echo %NAME% - Cython Build
echo ============================================================
echo.
where python >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python not found
pause
exit /b 1
)
for /f "delims=" %%i in ('where python') do set "PY=%%i"
echo Python: %PY%
if not exist "%SRC%" (
echo [ERROR] Source not found: %SRC%
pause
exit /b 1
)
if not exist "%ICON%" (
echo [ERROR] Icon not found: %ICON%
pause
exit /b 1
)
if not exist "%TOOLS%\adb.exe" (
echo [ERROR] adb.exe not found in %TOOLS%
pause
exit /b 1
)
if not exist "%TOOLS%\AdbWinApi.dll" (
echo [ERROR] AdbWinApi.dll not found in %TOOLS%
pause
exit /b 1
)
if not exist "%TOOLS%\AdbWinUsbApi.dll" (
echo [ERROR] AdbWinUsbApi.dll not found in %TOOLS%
pause
exit /b 1
)
echo [1/6] Installing deps...
"%PY%" -m pip install pyinstaller cython -q
if errorlevel 1 (
"%PY%" -m pip install pyinstaller cython -q -i https://pypi.tuna.tsinghua.edu.cn/simple
)
if errorlevel 1 (
echo [ERROR] Dependency install failed
pause
exit /b 1
)
echo [2/6] Clean...
if exist "dist_cy" rmdir /s /q dist_cy 2>nul
if exist "build" rmdir /s /q build 2>nul
if exist "dist" rmdir /s /q dist 2>nul
if exist "%NAME%.spec" del /q "%NAME%.spec" 2>nul
echo [3/6] Cython compile...
mkdir dist_cy 2>nul
copy "%SRC%" "dist_cy\_core.py" >nul
if errorlevel 1 (
echo [ERROR] Copy source failed
pause
exit /b 1
)
"%PY%" -c "open('dist_cy/setup_cython.py','w',encoding='utf-8').write('from setuptools import setup\nfrom Cython.Build import cythonize\nsetup(ext_modules=cythonize(\"_core.py\", compiler_directives={\"language_level\":\"3\"}))\n')"
if errorlevel 1 (
echo [ERROR] Failed to create Cython setup script
pause
exit /b 1
)
cd dist_cy
"%PY%" setup_cython.py build_ext --inplace
if errorlevel 1 (
cd ..
echo [ERROR] Cython failed. Build stopped.
pause
exit /b 1
)
set "PYD="
for %%f in (_core*.pyd) do set "PYD=%%f"
if "%PYD%"=="" (
cd ..
echo [ERROR] No Cython PYD generated. Build stopped.
pause
exit /b 1
)
echo PYD: %PYD%
copy "%PYD%" "_core.pyd" >nul
if errorlevel 1 (
cd ..
echo [ERROR] Failed to copy Cython PYD
pause
exit /b 1
)
"%PY%" -c "open('launcher.py','w',encoding='utf-8').write('# -*- coding: utf-8 -*-\nfrom _core import main\nmain()\n')"
if errorlevel 1 (
cd ..
echo [ERROR] Failed to create launcher.py
pause
exit /b 1
)
echo [4/6] Copy resources...
copy "%TOOLS%\adb.exe" . >nul
copy "%TOOLS%\AdbWinApi.dll" . >nul
copy "%TOOLS%\AdbWinUsbApi.dll" . >nul
copy "%ICON%" . >nul
if errorlevel 1 (
cd ..
echo [ERROR] Copy resources failed
pause
exit /b 1
)
echo [5/6] PyInstaller...
"%PY%" -m PyInstaller --onefile --windowed --name="%NAME%" --icon="app.ico" --add-data "app.ico;." --add-data "adb.exe;." --add-data "AdbWinApi.dll;." --add-data "AdbWinUsbApi.dll;." --add-binary "_core.pyd;." --hidden-import=queue --hidden-import=threading --hidden-import=tkinter --hidden-import=tkinter.filedialog --hidden-import=tkinter.messagebox --hidden-import=tkinter.scrolledtext --hidden-import=tkinter.ttk --hidden-import=json --hidden-import=urllib --hidden-import=urllib.error --hidden-import=urllib.parse --hidden-import=urllib.request --collect-all tkinter --uac-admin launcher.py
if errorlevel 1 (
cd ..
echo [ERROR] PyInstaller failed
pause
exit /b 1
)
echo [6/6] Cleanup...
del /q _core.py _core.c _core.pyd %PYD% launcher.py setup_cython.py adb.exe AdbWinApi.dll AdbWinUsbApi.dll app.ico 2>nul
rmdir /s /q build 2>nul
cd ..
echo.
echo Done.
if exist "dist_cy\dist\%NAME%.exe" (
echo Output: dist_cy\dist\%NAME%.exe
) else (
echo [ERROR] Output exe was not generated
pause
exit /b 1
)
pause