update script/setup so it works fine on windows (#6087)

This commit is contained in:
NP v/d Spek 2024-01-15 03:08:10 +01:00 committed by GitHub
parent 83baa24022
commit e39099137d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -4,10 +4,13 @@
set -e
cd "$(dirname "$0")/.."
location="venv/bin/activate"
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
python3 -m venv venv
source venv/bin/activate
if [ -f venv/Scripts/activate ]; then
location="venv/Scripts/activate"
fi
source $location;
fi
# Avoid unsafe git error when running inside devcontainer
@ -25,4 +28,4 @@ script/platformio_install_deps.py platformio.ini --libraries --tools --platforms
echo
echo
echo "Virtual environment created; source venv/bin/activate to use it"
echo "Virtual environment created. Run 'source $location' to use it."