|
| 1 | +@echo off |
| 2 | +setlocal EnableDelayedExpansion |
| 3 | +cd /d %~dp0 |
| 4 | + |
| 5 | +set "ARTIFACT_ZIP=%~1" |
| 6 | + |
| 7 | +if "!ARTIFACT_ZIP!"=="" ( |
| 8 | + echo [ERROR] Please specify the path to the downloaded zip file. |
| 9 | + echo Usage: %0 [Path to StateGo-Release.zip] |
| 10 | + exit /b 1 |
| 11 | +) |
| 12 | + |
| 13 | +if not exist "!ARTIFACT_ZIP!" ( |
| 14 | + echo [ERROR] File not found: !ARTIFACT_ZIP! |
| 15 | + exit /b 1 |
| 16 | +) |
| 17 | + |
| 18 | +if not exist "winPython" ( |
| 19 | + echo [ERROR] 'winPython' folder not found in the current directory. |
| 20 | + echo Please run this script from the repository root where 'winPython' folder exists. |
| 21 | + exit /b 1 |
| 22 | +) |
| 23 | + |
| 24 | +set WORK_DIR=Work\FullArchiveTemp |
| 25 | +set OUTPUT_ZIP=StateGo_Full_with_Python.zip |
| 26 | + |
| 27 | +echo : |
| 28 | +echo : Cleaning up work directory... |
| 29 | +if exist "%WORK_DIR%" rmdir /s /q "%WORK_DIR%" |
| 30 | +md "%WORK_DIR%" |
| 31 | + |
| 32 | +echo : |
| 33 | +echo : Extracting artifact zip... |
| 34 | +powershell -Command "Expand-Archive -Path '%ARTIFACT_ZIP%' -DestinationPath '%WORK_DIR%' -Force" |
| 35 | + |
| 36 | +echo : |
| 37 | +echo : Copying winPython... |
| 38 | +robocopy winPython "%WORK_DIR%\winPython" /MIR /NFL /NDL /NJH /NJS |
| 39 | +:: robocopy returns exit code 1-3 for success, so resetting errorlevel implies failure check logic needs to be careful. |
| 40 | +:: But for standard batch execution, we can ignore the exit code unless it's >= 8. |
| 41 | +if %ERRORLEVEL% GEQ 8 ( |
| 42 | + echo [ERROR] Robocopy failed. |
| 43 | + exit /b 1 |
| 44 | +) |
| 45 | + |
| 46 | +echo : |
| 47 | +echo : Creating final zip archive... |
| 48 | +if exist "%OUTPUT_ZIP%" del "%OUTPUT_ZIP%" |
| 49 | +powershell -Command "Compress-Archive -Path '%WORK_DIR%\*' -DestinationPath '%OUTPUT_ZIP%'" |
| 50 | + |
| 51 | +echo : |
| 52 | +echo : Cleanup... |
| 53 | +rmdir /s /q "%WORK_DIR%" |
| 54 | + |
| 55 | +echo : |
| 56 | +echo : DONE! |
| 57 | +echo : Created: %~dp0%OUTPUT_ZIP% |
| 58 | +echo : |
| 59 | +pause |
0 commit comments