This commit is contained in:
+49
-45
@@ -1,70 +1,46 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
chcp 65001 >nul
|
||||
cd /d "%~dp0"
|
||||
chcp 65001 >nul 2>&1
|
||||
|
||||
set "DO_PAUSE=1"
|
||||
set "PYI_CLEAN="
|
||||
for %%A in (%*) do (
|
||||
if /i "%%~A"=="nopause" set "DO_PAUSE=0"
|
||||
if /i "%%~A"=="clean" set "PYI_CLEAN=--clean"
|
||||
)
|
||||
if /i "%~1"=="nopause" set "DO_PAUSE=0"
|
||||
if /i "%~2"=="nopause" set "DO_PAUSE=0"
|
||||
if /i "%~1"=="clean" set "PYI_CLEAN=--clean"
|
||||
if /i "%~2"=="clean" set "PYI_CLEAN=--clean"
|
||||
|
||||
echo === md2gost: быстрая сборка exe (onefile, шрифты + plantuml.jar) ===
|
||||
echo === md2gost: быстрая сборка exe, onefile, шрифты и plantuml.jar ===
|
||||
echo Каталог: %CD%
|
||||
echo Spec: md2gost.fast.spec
|
||||
echo Кэш: build-fast\ (без --clean, пока не передадите clean)
|
||||
echo Кэш: build-fast\ без --clean, пока не передадите clean
|
||||
echo.
|
||||
|
||||
where python >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Python не найден в PATH. Установите Python 3.10+ и отметьте "Add python.exe to PATH".
|
||||
goto :fail
|
||||
)
|
||||
if errorlevel 1 goto :nopython
|
||||
|
||||
python -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)"
|
||||
if errorlevel 1 (
|
||||
echo Нужен Python 3.10 или новее.
|
||||
python --version
|
||||
goto :fail
|
||||
)
|
||||
python -c "import sys; raise SystemExit(sys.hexversion < 0x030A0000)"
|
||||
if errorlevel 1 goto :oldpython
|
||||
|
||||
echo [1/4] Зависимости ...
|
||||
python -c "import PyInstaller, matplotlib, docx, marko, lxml, pygments, PIL, freetype, latex2mathml, requests, docxcompose" 1>nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo Ставлю проект + PyInstaller + matplotlib ...
|
||||
python -m pip install -q -e . "pyinstaller>=6.0" "matplotlib>=3.7"
|
||||
if errorlevel 1 (
|
||||
echo Не удалось поставить зависимости.
|
||||
goto :fail
|
||||
)
|
||||
) else (
|
||||
echo Уже стоят, pip пропускаю.
|
||||
)
|
||||
if not errorlevel 1 goto :deps_ok
|
||||
echo Ставлю проект + PyInstaller + matplotlib ...
|
||||
python -m pip install -q -e . "pyinstaller>=6.0" "matplotlib>=3.7"
|
||||
if errorlevel 1 goto :pipfail
|
||||
:deps_ok
|
||||
|
||||
if not exist "md2gost\Template.docx" (
|
||||
echo Нет md2gost\Template.docx — сборка бессмысленна.
|
||||
goto :fail
|
||||
)
|
||||
if not exist "md2gost\Template.docx" goto :notemplate
|
||||
|
||||
echo [2/4] PlantUML jar (обязателен, вшивается в exe) ...
|
||||
echo [2/4] PlantUML jar, обязателен, вшивается в exe ...
|
||||
python scripts\fetch_plantuml.py
|
||||
if not exist "md2gost\vendor\plantuml.jar" (
|
||||
echo Нет md2gost\vendor\plantuml.jar — portable exe без jar не собираем.
|
||||
goto :fail
|
||||
)
|
||||
if not exist "md2gost\vendor\plantuml.jar" goto :nojar
|
||||
|
||||
echo [3/4] PyInstaller onefile, кэш build-fast ...
|
||||
python -m PyInstaller --noconfirm %PYI_CLEAN% --workpath build-fast --distpath dist md2gost.fast.spec
|
||||
if errorlevel 1 (
|
||||
echo PyInstaller завершился с ошибкой.
|
||||
goto :fail
|
||||
)
|
||||
if errorlevel 1 goto :pyifail
|
||||
|
||||
if not exist "dist\md2gost.exe" (
|
||||
echo dist\md2gost.exe не появился.
|
||||
goto :fail
|
||||
)
|
||||
if not exist "dist\md2gost.exe" goto :noexe
|
||||
|
||||
echo.
|
||||
echo [4/4] Готово:
|
||||
@@ -74,10 +50,38 @@ echo Двойной клик — GUI. Из консоли: md2gost.exe report.md
|
||||
echo Повторно без clean — быстрее за счёт кэша Analysis.
|
||||
echo Полный пересбор: build-exe-fast.bat clean
|
||||
echo.
|
||||
|
||||
if "%DO_PAUSE%"=="1" pause
|
||||
exit /b 0
|
||||
|
||||
:nopython
|
||||
echo Python не найден в PATH. Установите Python 3.10+ и отметьте "Add python.exe to PATH".
|
||||
goto :fail
|
||||
|
||||
:oldpython
|
||||
echo Нужен Python 3.10 или новее.
|
||||
python --version
|
||||
goto :fail
|
||||
|
||||
:pipfail
|
||||
echo Не удалось поставить зависимости.
|
||||
goto :fail
|
||||
|
||||
:notemplate
|
||||
echo Нет md2gost\Template.docx — сборка бессмысленна.
|
||||
goto :fail
|
||||
|
||||
:nojar
|
||||
echo Нет md2gost\vendor\plantuml.jar — portable exe без jar не собираем.
|
||||
goto :fail
|
||||
|
||||
:pyifail
|
||||
echo PyInstaller завершился с ошибкой.
|
||||
goto :fail
|
||||
|
||||
:noexe
|
||||
echo dist\md2gost.exe не появился.
|
||||
goto :fail
|
||||
|
||||
:fail
|
||||
echo.
|
||||
echo Сборка не удалась.
|
||||
|
||||
Reference in New Issue
Block a user