66# CONFIGURATION INI FILE USAGE
77
88SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
9+ PIO_VENV_ROOT=" ${HOME} /.platformio/penv"
910
1011BUILD_ALL=0
1112RUN_BUILD=0
@@ -96,6 +97,7 @@ function show_help {
9697 echo " other options:"
9798 echo " -y # answers any questions with Y automatically, for unattended builds"
9899 echo " -h # this help"
100+ echo " -V # Override default Python virtual environment location (e.g. \" -V ~/.platformio/penv\" )"
99101 echo " "
100102 echo " Additional Args can be accepted to pass values onto sub processes where supported."
101103 echo " e.g. ./build.sh -p APPLE -- -DFOO=BAR"
@@ -116,7 +118,7 @@ if [ $# -eq 0 ] ; then
116118 show_help
117119fi
118120
119- while getopts " abcde:fgG:hi:l:mnp:s:St:uyz " flag
121+ while getopts " abcde:fgG:hi:l:mnp:s:St:uyzV: " flag
120122do
121123 case " $flag " in
122124 a) BUILD_ALL=1 ;;
138140 G) CMAKE_GENERATOR=${OPTARG} ;;
139141 y) ANSWER_YES=1 ;;
140142 z) ZIP_MODE=1 ;;
143+ V) PIO_VENV_ROOT=${OPTARG} ;;
141144 h) show_help ;;
142145 * ) show_help ;;
143146 esac
@@ -156,6 +159,15 @@ if [ $BUILD_ALL -eq 1 ] ; then
156159 exit $?
157160fi
158161
162+ # Set up the virtual environment if it exists
163+ if [[ -d " $PIO_VENV_ROOT " && " $VIRTUAL_ENV " != " $PIO_VENV_ROOT " ]] ; then
164+ echo " Activating virtual environment"
165+ [[ -z " $VIRTUAL_ENV " ]] && deactivate & > /dev/null
166+ source " $PIO_VENV_ROOT /bin/activate"
167+ else
168+ echo " Warning: Virtual environment not found in $PIO_VENV_ROOT . Continuing without it."
169+ fi
170+
159171# #############################################################
160172# PC BUILD using cmake
161173if [ ! -z " $PC_TARGET " ] ; then
0 commit comments