mirror of
https://github.com/Niko1221/Strata.git
synced 2026-11-07 14:21:06 -10:00
package_terminal.py builds the terminal archive for windows-x86_64 (.zip), linux-x86_64 and darwin-arm64 (.tar.gz) from the pinned python-build-standalone CPython 3.12.15 (SHA-256 per target, from the release's SHA256SUMS) and a per-target lock, packaging/locks/runtime-<target>-cp312.txt, installed with pip --require-hashes --no-deps --only-binary=:all: at BUILD time only (pip is the interpreter's own, no upgrade; the result must equal the lock). packaging/lock_wheels.py makes a lock. Console-script launchers that name the build path are removed; a VERSION file and the read-only gguf_reader tool join the payload. - bin/strata.cmd and bin/strata.ps1 (Windows), bin/strata (POSIX): the bundled runtime first, PYTHONNOUSERSITE=1, no PYTHONHOME/PYTHONPATH; a path with spaces works. - START-HERE.bat, SETUP.bat, UPDATE.bat, setup.sh, update.sh use a python/ folder beside them when present (no Python lookup or install). - strata --version (one line: version and interpreter), strata serve --engine mock, a typed exit-5 message when the server's packages are missing (strata.py preflight). - packaging/smoke_terminal.py extracts an archive in a clean env (space in the path, PATH without Python, dead proxy) and runs --version, doctor, profile list, install, serve --engine mock (health, models, a chat answer). - tests/terminal/test_packaging_pins.py: digests, lock shape and agreement with requirements.txt, launcher order.
83 lines
3.8 KiB
Batchfile
83 lines
3.8 KiB
Batchfile
@echo off
|
|
rem Update Strata without starting the model (#475): the newest code (git pull, when this folder is a git clone), then
|
|
rem what START-HERE.bat does before a start - the engine (a new one when this version needs it), the Python packages,
|
|
rem each installed model's settings and draft subset. The model files are not touched. Start the model later with
|
|
rem START-HERE.bat. Options are passed on to setup.py. The bundled Python (python\ beside this file) is used when
|
|
rem there is one: START-HERE.bat, which this file runs, picks it.
|
|
setlocal
|
|
title Strata - update
|
|
cd /d "%~dp0"
|
|
rem All of it in one block: cmd reads a .bat file while it runs it, and the git pull can change this very file.
|
|
(
|
|
if exist ".git" (
|
|
where git >nul 2>nul || (
|
|
echo This folder is a git clone, but git is not on PATH: install Git for Windows ^(winget install Git.Git^)
|
|
echo or run "git pull" here yourself, then run UPDATE.bat again.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo Getting the newest Strata ^(git pull^) ...
|
|
git pull --ff-only
|
|
if errorlevel 1 (
|
|
rem The history was rewritten on 2026-10-06, see #1276: a clone from before has no commit in common with origin/main.
|
|
set "REWR="
|
|
git merge-base HEAD origin/main >nul 2>nul
|
|
if errorlevel 1 set "REWR=1"
|
|
git rev-parse --is-shallow-repository 2>nul | findstr /x true >nul && set "REWR="
|
|
if defined REWR (
|
|
echo.
|
|
echo This clone is on the repository's old history ^(cleaned up on 2026-10-06^): it has no commit in common
|
|
echo with origin/main, so it cannot be updated by git pull.
|
|
set "DIRTY="
|
|
for /f "delims=" %%i in ('git status --porcelain --untracked-files^=no') do set "DIRTY=1"
|
|
if defined DIRTY (
|
|
echo You have local changes to tracked files here, so nothing was touched. To move to the new history
|
|
echo yourself ^(your untracked files, models and settings stay where they are^):
|
|
echo git branch pre-cleanup-backup
|
|
echo git stash push
|
|
echo git checkout -B main origin/main
|
|
echo then run UPDATE.bat again.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
set "BK=pre-cleanup-backup"
|
|
git rev-parse --verify -q refs/heads/pre-cleanup-backup >nul 2>nul && set "BK=pre-cleanup-backup-%RANDOM%"
|
|
set "BR=main"
|
|
for /f "delims=" %%i in ('git symbolic-ref --short -q HEAD 2^>nul') do set "BR=%%i"
|
|
call git branch %%BK%% HEAD
|
|
if errorlevel 1 (
|
|
echo Could not make the backup branch: nothing was updated.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
call git checkout -q -B %%BR%% origin/main
|
|
if errorlevel 1 (
|
|
call git branch -D %%BK%% >nul 2>nul
|
|
echo.
|
|
echo Could not move to the new history ^(the reason is above^): nothing was updated. By hand:
|
|
echo git checkout -B main origin/main
|
|
pause
|
|
exit /b 1
|
|
)
|
|
call echo Moved to the new history. Your old commits are kept in the branch %%BK%%.
|
|
echo Untracked files ^(models, settings, the engine^) were not touched.
|
|
) else (
|
|
echo.
|
|
echo git pull did not succeed ^(the reason is above^): nothing was updated. Files you changed here can stop it:
|
|
echo "git status" lists them.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
) else (
|
|
echo This copy of Strata was not made with git, so it cannot fetch new files itself. Download the newest one:
|
|
echo https://github.com/Niko1221/Strata/archive/refs/heads/main.zip
|
|
echo unzip it anywhere and run START-HERE.bat ^(or UPDATE.bat^) in it: it finds the model files in Strata-data
|
|
echo and sets itself up the same way - nothing big is downloaded again.
|
|
echo Checking this copy's engine and settings meanwhile ...
|
|
)
|
|
call "%~dp0START-HERE.bat" --update %*
|
|
if not errorlevel 1 pause
|
|
exit /b
|
|
)
|