Skip to content

Commit

Permalink
Update setupenv.sh
Browse files Browse the repository at this point in the history
Use python virtualenv to avoid PEP 668

Signed-off-by: Hao, Ruomeng <[email protected]>
  • Loading branch information
ruomengh committed Mar 1, 2024
1 parent 50b8a45 commit 956eff6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions setupenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@

CURR_DIR=$(pwd)

# setup PYTHONPATH
python3 -m pip install pip -U
python3 -m pip install "cctrusted_base @ git+https://github.com/cc-api/cc-trusted-api.git#subdirectory=common/python"
export PYTHONPATH=$PYTHONPATH:$CURR_DIR/src/python
# setup virtualenv and PYTHONPATH
apt-get install -y python3-virtualenv

if [[ ! -d ${CURR_DIR}/venv ]]; then
python3 -m virtualenv -p python3 ${CURR_DIR}/venv
source ${CURR_DIR}/venv/bin/activate
python3 -m pip install "cctrusted_base @ git+https://github.com/cc-api/cc-trusted-api.git#subdirectory=common/python"
python3 -m pip install -r $CURR_DIR/src/python/requirements.txt
export PYTHONPATH=$PYTHONPATH:$CURR_DIR/src/python
if [ ! $? -eq 0 ]; then
echo "Failed to install python PIP packages, please check your proxy (https_proxy) or setup PyPi mirror."
deactivate
rm ${CURR_DIR}/venv -fr
return 1
fi
else
source ${CURR_DIR}/venv/bin/activate
fi

0 comments on commit 956eff6

Please sign in to comment.