From 3719ddac038947bdb3a6c46ef4b3563510ffe684 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Sun, 19 May 2024 14:25:05 +0200 Subject: [PATCH] automatically propose to setup virtualenv if platformio is having issues in native build (#3923) --- bin/build-native.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/build-native.sh b/bin/build-native.sh index 9d31d091a..e8ed61bcf 100755 --- a/bin/build-native.sh +++ b/bin/build-native.sh @@ -2,6 +2,17 @@ set -e +platformioFailed() { + [[ $VIRTUAL_ENV != "" ]] && exit 1 # don't hint at virtualenv if it's already in use + echo -e "\nThere were issues running platformio and you are not using a virtual environment." \ + "\nYou may try setting up virtualenv and downloading the latest platformio from pip:" \ + "\n\tvirtualenv venv" \ + "\n\tsource venv/bin/activate" \ + "\n\tpip install platformio" \ + "\n\t./bin/build-native.sh # retry building" + exit 1 +} + VERSION=$(bin/buildinfo.py long) SHORT_VERSION=$(bin/buildinfo.py short) @@ -13,8 +24,8 @@ mkdir -p $OUTDIR/ rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update --environment native -pio run --environment native +platformio pkg update --environment native || platformioFailed +pio run --environment native || platformioFailed cp .pio/build/native/program "$OUTDIR/meshtasticd_linux_$(uname -m)" cp bin/device-install.* $OUTDIR cp bin/device-update.* $OUTDIR