1a5b35eb54
Python application / build (push) Has been cancelled
- add Local Render Mermaid - add page-starе для указания смещения страниц - add Гиперссылки в документе на списки литературы
93 lines
2.6 KiB
Batchfile
93 lines
2.6 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions
|
|
cd /d "%~dp0"
|
|
chcp 65001 >nul 2>&1
|
|
|
|
set "DO_PAUSE=1"
|
|
set "PYI_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 Каталог: %CD%
|
|
echo Spec: md2gost.fast.spec
|
|
echo Кэш: build-fast\ без --clean, пока не передадите clean
|
|
echo.
|
|
|
|
where python >nul 2>&1
|
|
if errorlevel 1 goto :nopython
|
|
|
|
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 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" goto :notemplate
|
|
|
|
echo [2/4] PlantUML jar + Mermaid assets ...
|
|
python scripts\fetch_plantuml.py
|
|
if not exist "md2gost\vendor\plantuml.jar" goto :nojar
|
|
if not exist "md2gost\diagrams\mermaid.min.js" (
|
|
python scripts\fetch_mermaid.py
|
|
)
|
|
|
|
echo [3/4] PyInstaller onefile, кэш build-fast ...
|
|
python -m PyInstaller --noconfirm %PYI_CLEAN% --workpath build-fast --distpath dist md2gost.fast.spec
|
|
if errorlevel 1 goto :pyifail
|
|
|
|
if not exist "dist\md2gost.exe" goto :noexe
|
|
|
|
echo.
|
|
echo [4/4] Готово:
|
|
echo %CD%\dist\md2gost.exe
|
|
echo.
|
|
echo Двойной клик — GUI. Из консоли: md2gost.exe report.md -o report.docx
|
|
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 Сборка не удалась.
|
|
if "%DO_PAUSE%"=="1" pause
|
|
exit /b 1
|