forked from Shiyong-Tan/pyOpenLPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_openlpt.bat
More file actions
68 lines (58 loc) · 1.78 KB
/
update_openlpt.bat
File metadata and controls
68 lines (58 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@echo off
title OpenLPT Updater
echo ==========================================
echo OpenLPT Auto-Updater
echo ==========================================
echo.
cd /d "%~dp0"
echo [0/4] Restoring environment variables...
echo.
echo NOTE: If the process pauses below, please type your password (SSH passphrase or Git account password) and press Enter.
echo.
echo [1/4] Pulling latest code from git...
git pull
if %errorlevel% neq 0 (
echo [Error] Git pull failed.
pause
exit /b %errorlevel%
)
echo.
echo [2/4] Activating Conda Environment 'OpenLPT'...
call conda activate OpenLPT
if %errorlevel% neq 0 (
echo [Warning] Failed to activate 'OpenLPT'. Trying to proceed with current env...
)
:: Set consistent build environment for Windows
set "CMAKE_GENERATOR=NMake Makefiles"
set "CMAKE_BUILD_TYPE=Release"
set "CMAKE_GENERATOR_INSTANCE="
set "CMAKE_GENERATOR_PLATFORM="
set "CMAKE_GENERATOR_TOOLSET="
:: Activate VS environment
echo [INFO] Activating Visual Studio environment...
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
echo.
echo [3/4] Update dependencies with Mamba...
call mamba install -c conda-forge --file requirements.txt -y
if %errorlevel% neq 0 (
echo [Error] Mamba install failed.
pause
exit /b %errorlevel%
)
:: Clean previous build to avoid generator mismatch
if exist build rmdir /s /q build
if exist openlpt.egg-info rmdir /s /q openlpt.egg-info
echo.
echo [4/4] Re-installing OpenLPT package...
pip install . --no-build-isolation
if %errorlevel% neq 0 (
echo [Error] Pip install failed.
pause
exit /b %errorlevel%
)
echo.
echo ==========================================
echo Update Successful!
echo ==========================================
echo Please restart OpenLPT manually.
pause