From 99bc3b89b06609038f92ce93b7d3da40f846baae Mon Sep 17 00:00:00 2001 From: Stefan Koelle Date: Sun, 2 Aug 2026 08:06:59 +0200 Subject: [PATCH] update build scripts --- scripts/build.cmd | 26 ++------------------------ scripts/build.sh | 12 ------------ scripts/deploy.cmd | 28 ++-------------------------- scripts/deploy.sh | 15 --------------- 4 files changed, 4 insertions(+), 77 deletions(-) diff --git a/scripts/build.cmd b/scripts/build.cmd index a2ac2b0..a41204e 100644 --- a/scripts/build.cmd +++ b/scripts/build.cmd @@ -1,23 +1,9 @@ @echo off -REM Local build-only test script for Windows. -REM Compiles the project WITHOUT uploading to any device. -REM Usage: scripts\build.cmd - setlocal cd /d "%~dp0\.." - set VENV_DIR=.venv-platformio - -REM Prefer the "py" launcher (ships with official Python installer) which -REM reliably picks Python 3, even if "python" on PATH points to an old -REM Python 2.x install. where py >nul 2>nul -if %errorlevel%==0 ( - set PYTHON_CMD=py -3 -) else ( - set PYTHON_CMD=python -) - +if %errorlevel%==0 (set PYTHON_CMD=py -3) else (set PYTHON_CMD=python) if not exist "%VENV_DIR%" ( echo Creating local virtualenv in %VENV_DIR% using: %PYTHON_CMD% %PYTHON_CMD% -m venv "%VENV_DIR%" @@ -25,21 +11,13 @@ if not exist "%VENV_DIR%" ( echo. echo ERROR: Could not create a Python 3 virtualenv. echo Make sure Python 3 is installed from https://www.python.org/downloads/ - echo and that "py -3 --version" or "python --version" reports Python 3.x - echo ^(your "python" currently points to: %PYTHON_CMD%^) exit /b 1 ) "%VENV_DIR%\Scripts\python.exe" -m pip install --upgrade pip "%VENV_DIR%\Scripts\pip.exe" install platformio ) - echo Running build (no upload) ... "%VENV_DIR%\Scripts\pio.exe" run - -if errorlevel 1 ( - echo Build FAILED. - exit /b 1 -) - +if errorlevel 1 (echo Build FAILED. & exit /b 1) echo Build finished successfully. endlocal diff --git a/scripts/build.sh b/scripts/build.sh index dd6aa55..7132ab1 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,25 +1,13 @@ #!/usr/bin/env bash set -euo pipefail - -# Local build-only test script for Linux/macOS. -# Compiles the project WITHOUT uploading to any device. -# Useful to quickly check "does it even compile" without touching the M5Stack. -# -# Usage: -# ./scripts/build.sh - cd "$(dirname "$0")/.." - VENV_DIR=".venv-platformio" - if [ ! -d "$VENV_DIR" ]; then echo "Creating local virtualenv in $VENV_DIR ..." python3 -m venv "$VENV_DIR" "$VENV_DIR/bin/pip" install --upgrade pip "$VENV_DIR/bin/pip" install platformio fi - echo "Running build (no upload) ..." "$VENV_DIR/bin/pio" run - echo "Build finished successfully." diff --git a/scripts/deploy.cmd b/scripts/deploy.cmd index 5385751..3e49586 100644 --- a/scripts/deploy.cmd +++ b/scripts/deploy.cmd @@ -1,24 +1,9 @@ @echo off -REM Build + flash the M5Stack Dashboard project via PlatformIO on Windows. -REM -REM Usage: -REM scripts\deploy.cmd (auto-detect USB port) -REM scripts\deploy.cmd COM5 (force a specific port) -REM -REM Does NOT open the serial monitor afterwards. - setlocal cd /d "%~dp0\.." - set VENV_DIR=.venv-platformio - where py >nul 2>nul -if %errorlevel%==0 ( - set PYTHON_CMD=py -3 -) else ( - set PYTHON_CMD=python -) - +if %errorlevel%==0 (set PYTHON_CMD=py -3) else (set PYTHON_CMD=python) if not exist "%VENV_DIR%" ( echo Creating local virtualenv in %VENV_DIR% using: %PYTHON_CMD% %PYTHON_CMD% -m venv "%VENV_DIR%" @@ -26,16 +11,12 @@ if not exist "%VENV_DIR%" ( echo. echo ERROR: Could not create a Python 3 virtualenv. echo Make sure Python 3 is installed from https://www.python.org/downloads/ - echo and that "py -3 --version" or "python --version" reports Python 3.x - echo ^(your "python" currently points to: %PYTHON_CMD%^) exit /b 1 ) "%VENV_DIR%\Scripts\python.exe" -m pip install --upgrade pip "%VENV_DIR%\Scripts\pip.exe" install platformio ) - set PIO=%VENV_DIR%\Scripts\pio.exe - if "%~1"=="" ( echo Auto-detecting upload port... "%PIO%" run --target upload @@ -43,11 +24,6 @@ if "%~1"=="" ( echo Using forced upload port: %~1 "%PIO%" run --target upload --upload-port %~1 ) - -if errorlevel 1 ( - echo Deploy FAILED. - exit /b 1 -) - +if errorlevel 1 (echo Deploy FAILED. & exit /b 1) echo Build + flash complete. endlocal diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 707bfcb..fb9df48 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,28 +1,14 @@ #!/usr/bin/env bash set -euo pipefail - -# Build + flash the M5Stack Dashboard project via PlatformIO on Linux/macOS. -# -# Usage: -# ./scripts/deploy.sh # auto-detect USB port -# ./scripts/deploy.sh /dev/ttyUSB0 # force a specific port -# -# This script intentionally does NOT open the serial monitor afterwards. -# Uses the same local virtualenv as build.sh, created automatically if missing. - cd "$(dirname "$0")/.." - VENV_DIR=".venv-platformio" - if [ ! -d "$VENV_DIR" ]; then echo "Creating local virtualenv in $VENV_DIR ..." python3 -m venv "$VENV_DIR" "$VENV_DIR/bin/pip" install --upgrade pip "$VENV_DIR/bin/pip" install platformio fi - PIO="$VENV_DIR/bin/pio" - if [ "$#" -ge 1 ]; then PORT="$1" echo "Using forced upload port: $PORT" @@ -31,5 +17,4 @@ else echo "Auto-detecting upload port..." "$PIO" run --target upload fi - echo "Build + flash complete."