Compare commits
4
Commits
724c2d62f9
...
3fe45fa4d5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fe45fa4d5 | ||
|
|
1ab8af8fe2 | ||
|
|
bfbbd537d5 | ||
|
|
a33736742a |
No files matched your search
@@ -5,45 +5,45 @@ Działa na Windows 10/11 i macOS 13 (Ventura) lub nowszym, na Macach z Intelem i
|
|||||||
|
|
||||||
Repozytorium: https://gitea.kota-app.com/kkallas/kota-technician-tool (dostęp nadaje właściciel repozytorium).
|
Repozytorium: https://gitea.kota-app.com/kkallas/kota-technician-tool (dostęp nadaje właściciel repozytorium).
|
||||||
|
|
||||||
## Instalacja
|
## Dla technika: dwa pliki
|
||||||
|
|
||||||
Wybierz jeden sposób. Nie trzymaj narzędzia w folderze Google Drive ani OneDrive.
|
| System | Aktualizacja | Uruchomienie |
|
||||||
|
|---|---|---|
|
||||||
|
| Windows | `update_windows.bat` | `run_windows.bat` |
|
||||||
|
| macOS | `update_macos.command` | `run_macos.command` |
|
||||||
|
|
||||||
### A. Paczka zip (najprościej)
|
- **Aktualizacja** sprawdza na Gitea najnowszą wydaną wersję i pobiera tylko to, co się zmieniło
|
||||||
|
(pliki programu, firmware i potrzebne biblioteki). Uruchom ją, gdy firmware team ogłosi nową wersję,
|
||||||
|
albo po prostu przed wyjazdem do klienta. Pokazuje, co się zmieniło.
|
||||||
|
- **Uruchomienie** startuje program. Nie łączy się z Gitea, działa też bez internetu (po pierwszej aktualizacji).
|
||||||
|
|
||||||
|
Nie trzymaj folderu narzędzia w Google Drive ani OneDrive.
|
||||||
|
|
||||||
|
## Pierwsza instalacja (raz na komputer)
|
||||||
|
|
||||||
1. Na Gitea otwórz **Releases** i przy najnowszej wersji pobierz **Source Code (ZIP)**.
|
1. Na Gitea otwórz **Releases** i przy najnowszej wersji pobierz **Source Code (ZIP)**.
|
||||||
2. Rozpakuj do zwykłego folderu, np. `Dokumenty\KOTA\technician-tool`.
|
2. Rozpakuj do zwykłego folderu, np. `Dokumenty\KOTA\technician-tool` (macOS: `~/Documents/KOTA/technician-tool`).
|
||||||
3. Nowa wersja: pobierz nowy zip i rozpakuj obok (albo w miejsce starego folderu).
|
3. Uruchom plik aktualizacji dla swojego systemu. Za pierwszym razem:
|
||||||
|
- połączy folder z Gitea i zapyta o login do Gitea (hasło lub token); system je zapamięta,
|
||||||
|
- zainstaluje brakujące narzędzia za Twoją zgodą: Git (Windows: przez winget; macOS: Apple Command Line Tools
|
||||||
|
- po ich instalacji uruchom aktualizację jeszcze raz) oraz `uv` (menedżer Pythona, tylko dla bieżącego
|
||||||
|
użytkownika),
|
||||||
|
- pobierze biblioteki Pythona (1–2 minuty, potrzebny internet).
|
||||||
|
4. Uruchom program plikiem `run_...`.
|
||||||
|
|
||||||
### B. Git (aktualizacja jednym poleceniem)
|
**macOS:** jeśli Finder odpowie, że pliku nie można uruchomić (zdarza się po rozpakowaniu zip), otwórz Terminal,
|
||||||
|
wpisz `bash ` (ze spacją), przeciągnij `update_macos.command` do okna i naciśnij Enter. Po pierwszej aktualizacji
|
||||||
|
oba pliki `.command` dają się już otwierać dwuklikiem.
|
||||||
|
|
||||||
Wymaga zainstalowanego gita (Windows: https://git-scm.com, macOS: `xcode-select --install`).
|
Zamiast zip można też zrobić `git clone https://gitea.kota-app.com/kkallas/kota-technician-tool.git` i dalej
|
||||||
|
używać tych samych dwóch plików.
|
||||||
|
|
||||||
```
|
Konkretna starsza wersja (np. do serwisu nietypowego boxa): w folderze narzędzia `git switch --detach v0.8`;
|
||||||
git clone https://gitea.kota-app.com/kkallas/kota-technician-tool.git
|
kolejna aktualizacja wraca do najnowszej.
|
||||||
```
|
|
||||||
|
|
||||||
Przy pierwszym połączeniu podaj login i hasło (lub token) do Gitea; system je zapamięta.
|
Wszystkie wersje używają jednego środowiska Pythona poza folderem narzędzia:
|
||||||
Aktualizacja do najnowszej wersji, w folderze `kota-technician-tool`:
|
`%LOCALAPPDATA%\KotaTechnicianTool\venv` (Windows), `~/Library/Caches/KotaTechnicianTool/venv` (macOS).
|
||||||
|
Stare środowiska `venv-0.x` z poprzednich wersji można usunąć.
|
||||||
```
|
|
||||||
git pull
|
|
||||||
```
|
|
||||||
|
|
||||||
Konkretna wersja, np. na potrzeby serwisu starszego boxa: `git switch --detach v0.8`, powrót: `git switch main`.
|
|
||||||
|
|
||||||
## Uruchomienie
|
|
||||||
|
|
||||||
**Windows:** dwuklik `run_windows.bat`.
|
|
||||||
|
|
||||||
**macOS:** dwuklik `run_macos.command`. Jeśli Finder odpowie, że pliku nie można uruchomić (zdarza się po
|
|
||||||
rozpakowaniu zip), otwórz Terminal, wpisz `bash ` (ze spacją), przeciągnij plik do okna i naciśnij Enter.
|
|
||||||
Na stałe naprawia to `chmod +x run_macos.command`. Przy instalacji przez git ten problem nie występuje.
|
|
||||||
|
|
||||||
Przy pierwszym uruchomieniu skrypt proponuje instalację `uv` (menedżer Pythona, tylko dla bieżącego użytkownika)
|
|
||||||
i pobiera biblioteki. Potrzebny jest internet, trwa to 1–2 minuty. Kolejne starty są natychmiastowe.
|
|
||||||
Środowisko Pythona jest poza folderem narzędzia:
|
|
||||||
`%LOCALAPPDATA%\KotaTechnicianTool\venv-<wersja>` (Windows), `~/Library/Caches/KotaTechnicianTool/venv-<wersja>` (macOS).
|
|
||||||
|
|
||||||
Sesje, kopie zapasowe flash i ustawienia są w `~/KotaTechnicianTool` (Windows: `C:\Users\<użytkownik>\KotaTechnicianTool`).
|
Sesje, kopie zapasowe flash i ustawienia są w `~/KotaTechnicianTool` (Windows: `C:\Users\<użytkownik>\KotaTechnicianTool`).
|
||||||
|
|
||||||
@@ -64,8 +64,9 @@ najnowszy build jest na górze. Nowy build: wrzuć plik do `firmware/` i kliknij
|
|||||||
|
|
||||||
- Praca nad zmianą: gałąź (`git switch -c feature/<nazwa>`) → commity z przechodzącymi testami →
|
- Praca nad zmianą: gałąź (`git switch -c feature/<nazwa>`) → commity z przechodzącymi testami →
|
||||||
`git push -u origin feature/<nazwa>` → pull request na Gitea → merge do `main`.
|
`git push -u origin feature/<nazwa>` → pull request na Gitea → merge do `main`.
|
||||||
- Wydanie wersji: numer w `pyproject.toml`, `kota_tech/__init__.py` i skryptach `run_*`, tag `vX.Y`
|
- Wydanie wersji: numer w `pyproject.toml`, `kota_tech/__init__.py` i `uv.lock`, tag `vX.Y`
|
||||||
(`git tag -a vX.Y -m "Technician tool vX.Y"`, `git push origin vX.Y`), opis w **Releases** na Gitea.
|
(`git tag -a vX.Y -m "Technician tool vX.Y"`, `git push origin vX.Y`), opis w **Releases** na Gitea.
|
||||||
|
Aktualizacja techników bierze **tylko tagi `v*`** – zmiany w `main` bez tagu do nich nie trafiają.
|
||||||
- Nie commitujemy `ENV.TXT` z prawdziwym tokenem ani haseł Wi-Fi.
|
- Nie commitujemy `ENV.TXT` z prawdziwym tokenem ani haseł Wi-Fi.
|
||||||
- Testy:
|
- Testy:
|
||||||
|
|
||||||
@@ -73,4 +74,4 @@ najnowszy build jest na górze. Nowy build: wrzuć plik do `firmware/` i kliknij
|
|||||||
uv run --frozen pytest -q
|
uv run --frozen pytest -q
|
||||||
```
|
```
|
||||||
|
|
||||||
Zmiany w wersjach: `docs/CHANGES-v0.7.md`, `docs/CHANGES-v0.8.md`; historia v0.1–v0.8 jest w tagach gita.
|
Zmiany w wersjach: `docs/CHANGES-v0.*.md`; historia v0.1–v0.8 jest w tagach gita.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Technician tool v0.9 - changes
|
||||||
|
|
||||||
|
- Two files per system for technicians: `update_windows.bat` / `update_macos.command` (update) and
|
||||||
|
`run_windows.bat` / `run_macos.command` (start).
|
||||||
|
- Update: checks Gitea for the newest release tag `vX.Y`, downloads only what changed (git), shows the list of
|
||||||
|
changes, protects files edited by hand (asks first), connects a folder unpacked from a release zip on first
|
||||||
|
run, installs git / uv when missing (asks first) and brings the Python libraries up to date.
|
||||||
|
- One shared Python environment for all versions: `KotaTechnicianTool/venv` (was `venv-0.x` per version).
|
||||||
|
- A developer copy on a branch is left alone by the update script (use `git pull`).
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
"""KOTA sensorbox technician tool."""
|
"""KOTA sensorbox technician tool."""
|
||||||
|
|
||||||
__version__ = "0.8.0"
|
__version__ = "0.9.0"
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "kota-technician-tool"
|
name = "kota-technician-tool"
|
||||||
version = "0.8.0"
|
version = "0.9.0"
|
||||||
description = "KOTA sensorbox technician diagnostic tool (demo)"
|
description = "KOTA sensorbox technician diagnostic tool (demo)"
|
||||||
requires-python = ">=3.11,<3.14"
|
requires-python = ">=3.11,<3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ cd "$(dirname "$0")" || exit 1
|
|||||||
|
|
||||||
# If Finder refuses to open this file (Google Drive drops the executable bit), run it once as:
|
# If Finder refuses to open this file (Google Drive drops the executable bit), run it once as:
|
||||||
# bash run_macos.command (or: chmod +x run_macos.command)
|
# bash run_macos.command (or: chmod +x run_macos.command)
|
||||||
# Keep the virtual environment out of the (Google Drive) tool folder.
|
# One shared Python environment for every version (update_macos.command keeps it current).
|
||||||
export UV_PROJECT_ENVIRONMENT="$HOME/Library/Caches/KotaTechnicianTool/venv-0.8"
|
export UV_PROJECT_ENVIRONMENT="$HOME/Library/Caches/KotaTechnicianTool/venv"
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
if ! command -v uv >/dev/null 2>&1; then
|
if ! command -v uv >/dev/null 2>&1; then
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
setlocal
|
setlocal
|
||||||
cd /d "%~dp0"
|
cd /d "%~dp0"
|
||||||
|
|
||||||
rem Keep the virtual environment out of the (Google Drive) tool folder.
|
rem One shared Python environment for every version (update_windows.bat keeps it current).
|
||||||
set "UV_PROJECT_ENVIRONMENT=%LOCALAPPDATA%\KotaTechnicianTool\venv-0.8"
|
set "UV_PROJECT_ENVIRONMENT=%LOCALAPPDATA%\KotaTechnicianTool\venv"
|
||||||
set "PATH=%USERPROFILE%\.local\bin;%PATH%"
|
set "PATH=%USERPROFILE%\.local\bin;%PATH%"
|
||||||
|
|
||||||
where uv >nul 2>nul
|
where uv >nul 2>nul
|
||||||
|
|||||||
Executable
+74
@@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# KOTA Sensorbox Technician Tool - update to the newest released version.
|
||||||
|
# Checks Gitea for the newest release tag (vX.Y) and downloads only what changed (git).
|
||||||
|
# Works in a git clone and in a folder unpacked from a release zip (it is connected on first run).
|
||||||
|
# If Finder refuses to open this file, run it once as: bash update_macos.command
|
||||||
|
cd "$(dirname "$0")" || exit 1
|
||||||
|
|
||||||
|
REPO_URL="${KOTA_REPO_URL:-https://gitea.kota-app.com/kkallas/kota-technician-tool.git}"
|
||||||
|
export UV_PROJECT_ENVIRONMENT="${UV_PROJECT_ENVIRONMENT:-$HOME/Library/Caches/KotaTechnicianTool/venv}"
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
[ -z "$KOTA_NO_PAUSE" ] && [ -t 0 ] && read -r -p "Press Enter to close..." _
|
||||||
|
exit "$1"
|
||||||
|
}
|
||||||
|
fail() { echo; echo "[!] $*"; echo "[!] Update did not finish."; finish 1; }
|
||||||
|
|
||||||
|
# ---- git (macOS: the Command Line Tools installer offers it) --------------
|
||||||
|
if ! git --version >/dev/null 2>&1; then
|
||||||
|
if [ "$(uname)" = Darwin ]; then
|
||||||
|
xcode-select --install >/dev/null 2>&1
|
||||||
|
fail "Git is being installed (Apple Command Line Tools). Run this again when the installer has finished."
|
||||||
|
fi
|
||||||
|
fail "Git is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ---- connect a folder unpacked from a zip ----------------------------------
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
echo "Connecting this folder to $REPO_URL ..."
|
||||||
|
git init -q && git remote add origin "$REPO_URL" || fail "Cannot set up git in this folder."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A developer copy follows a branch; it is updated with "git pull", not here.
|
||||||
|
if git rev-parse -q --verify HEAD >/dev/null 2>&1 && branch=$(git symbolic-ref -q --short HEAD); then
|
||||||
|
echo "This is a developer copy on branch $branch. Update it with: git pull"
|
||||||
|
finish 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking for a new version..."
|
||||||
|
git fetch --quiet --force --tags origin ||
|
||||||
|
fail "Cannot reach $REPO_URL. Check the Internet connection and your Gitea login, then try again."
|
||||||
|
|
||||||
|
latest=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
||||||
|
[ -n "$latest" ] || fail "No released version found on the server."
|
||||||
|
current=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
||||||
|
|
||||||
|
if [ "$current" = "$latest" ]; then
|
||||||
|
echo "You already have the newest version $latest."
|
||||||
|
else
|
||||||
|
if [ -n "$current" ]; then
|
||||||
|
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||||
|
echo "Some tool files in this folder were changed by hand. They will be replaced by $latest."
|
||||||
|
read -r -p "Continue? [y/N] " answer
|
||||||
|
[[ "$answer" =~ ^[Yy]$ ]] || fail "Cancelled."
|
||||||
|
fi
|
||||||
|
echo "Updating $current -> $latest. Changes:"
|
||||||
|
git --no-pager log --oneline --no-decorate "$current..$latest"
|
||||||
|
else
|
||||||
|
echo "Installing $latest..."
|
||||||
|
fi
|
||||||
|
git -c advice.detachedHead=false checkout -q -f "$latest" || fail "Checkout of $latest failed."
|
||||||
|
echo "Now on $latest."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ---- Python libraries (only what changed) ----------------------------------
|
||||||
|
if ! command -v uv >/dev/null 2>&1; then
|
||||||
|
echo "Installing uv (Python package runner, current user only)..."
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh || fail "uv installation failed. Ask the firmware team for help."
|
||||||
|
fi
|
||||||
|
echo "Checking Python libraries..."
|
||||||
|
uv sync --frozen --no-dev --python 3.12 --quiet || fail "Installing Python libraries failed."
|
||||||
|
echo
|
||||||
|
echo "Done. Start the tool with run_macos.command."
|
||||||
|
finish 0
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
@echo off
|
||||||
|
rem KOTA Sensorbox Technician Tool - update to the newest released version.
|
||||||
|
rem Checks Gitea for the newest release tag (vX.Y) and downloads only what changed (git).
|
||||||
|
rem Works in a git clone and in a folder unpacked from a release zip (it is connected on first run).
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
cd /d "%~dp0"
|
||||||
|
title KOTA Technician Tool - update
|
||||||
|
|
||||||
|
if not defined KOTA_REPO_URL set "KOTA_REPO_URL=https://gitea.kota-app.com/kkallas/kota-technician-tool.git"
|
||||||
|
set "UV_PROJECT_ENVIRONMENT=%LOCALAPPDATA%\KotaTechnicianTool\venv"
|
||||||
|
set "PATH=%USERPROFILE%\.local\bin;%ProgramFiles%\Git\cmd;%PATH%"
|
||||||
|
|
||||||
|
rem ---- git ----------------------------------------------------------------
|
||||||
|
where git >nul 2>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Git is not installed. It is needed to download updates.
|
||||||
|
choice /m "Install Git for Windows now"
|
||||||
|
if errorlevel 2 goto :fail
|
||||||
|
winget install --id Git.Git -e --source winget --accept-package-agreements
|
||||||
|
where git >nul 2>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Git installation failed. Install it from https://git-scm.com and run this again.
|
||||||
|
goto :fail
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
rem ---- connect a folder unpacked from a zip ---------------------------------
|
||||||
|
if not exist ".git" (
|
||||||
|
echo Connecting this folder to %KOTA_REPO_URL% ...
|
||||||
|
git init -q || goto :fail
|
||||||
|
git remote add origin "%KOTA_REPO_URL%" || goto :fail
|
||||||
|
)
|
||||||
|
|
||||||
|
rem A developer copy follows a branch; it is updated with "git pull", not here.
|
||||||
|
git rev-parse -q --verify HEAD >nul 2>nul
|
||||||
|
if not errorlevel 1 (
|
||||||
|
for /f "delims=" %%b in ('git symbolic-ref -q --short HEAD 2^>nul') do (
|
||||||
|
echo This is a developer copy on branch %%b. Update it with: git pull
|
||||||
|
goto :done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Checking for a new version...
|
||||||
|
git fetch --quiet --force --tags origin
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Cannot reach %KOTA_REPO_URL%.
|
||||||
|
echo Check the Internet connection and your Gitea login, then try again.
|
||||||
|
goto :fail
|
||||||
|
)
|
||||||
|
|
||||||
|
set "LATEST="
|
||||||
|
for /f "delims=" %%t in ('git tag -l "v*" --sort^=-v:refname') do if not defined LATEST set "LATEST=%%t"
|
||||||
|
if not defined LATEST (
|
||||||
|
echo ERROR: No released version found on the server.
|
||||||
|
goto :fail
|
||||||
|
)
|
||||||
|
set "CURRENT="
|
||||||
|
for /f "delims=" %%t in ('git describe --tags --exact-match HEAD 2^>nul') do set "CURRENT=%%t"
|
||||||
|
|
||||||
|
if "%CURRENT%"=="%LATEST%" (
|
||||||
|
echo You already have the newest version %LATEST%.
|
||||||
|
goto :deps
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined CURRENT (
|
||||||
|
for /f "delims=" %%s in ('git status --porcelain --untracked-files^=no') do set "DIRTY=1"
|
||||||
|
if defined DIRTY (
|
||||||
|
echo Some tool files in this folder were changed by hand. They will be replaced by %LATEST%.
|
||||||
|
choice /m "Continue"
|
||||||
|
if errorlevel 2 goto :fail
|
||||||
|
)
|
||||||
|
echo Updating %CURRENT% -^> %LATEST%. Changes:
|
||||||
|
git --no-pager log --oneline --no-decorate "%CURRENT%..%LATEST%"
|
||||||
|
) else (
|
||||||
|
echo Installing %LATEST%...
|
||||||
|
)
|
||||||
|
git -c advice.detachedHead=false checkout -q -f "%LATEST%"
|
||||||
|
if errorlevel 1 goto :fail
|
||||||
|
echo Now on %LATEST%.
|
||||||
|
|
||||||
|
rem ---- Python libraries (only what changed) ----------------------------------
|
||||||
|
:deps
|
||||||
|
where uv >nul 2>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Installing uv ^(Python package runner, current user only^)...
|
||||||
|
powershell -NoProfile -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
||||||
|
)
|
||||||
|
where uv >nul 2>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: uv installation failed. Ask the firmware team for help.
|
||||||
|
goto :fail
|
||||||
|
)
|
||||||
|
echo Checking Python libraries...
|
||||||
|
uv sync --frozen --no-dev --python 3.12 --quiet
|
||||||
|
if errorlevel 1 goto :fail
|
||||||
|
echo.
|
||||||
|
echo Done. Start the tool with run_windows.bat.
|
||||||
|
|
||||||
|
:done
|
||||||
|
if not defined KOTA_NO_PAUSE pause
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
:fail
|
||||||
|
echo.
|
||||||
|
echo ERROR: Update did not finish.
|
||||||
|
if not defined KOTA_NO_PAUSE pause
|
||||||
|
exit /b 1
|
||||||
@@ -250,7 +250,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kota-technician-tool"
|
name = "kota-technician-tool"
|
||||||
version = "0.8.0"
|
version = "0.9.0"
|
||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "esptool" },
|
{ name = "esptool" },
|
||||||
|
|||||||
Reference in new issue
Block a user