Fix MacOS venv issue.
PiperOrigin-RevId: 353986703 Change-Id: Ia190e0ea4c524f5147e153ece0467cca2bed0fb2
This commit is contained in:
parent
be36503971
commit
9c2bafc235
@ -29,11 +29,18 @@ WIN_GPU_MAX_WHL_SIZE=252M
|
|||||||
function run_smoke_test() {
|
function run_smoke_test() {
|
||||||
VENV_TMP_DIR=$(mktemp -d)
|
VENV_TMP_DIR=$(mktemp -d)
|
||||||
|
|
||||||
|
# Check if in a virtualenv and exit if yes.
|
||||||
|
IN_VENV=$(python -c 'import sys; print("1" if sys.version_info.major == 3 and sys.prefix != sys.base_prefix else "0")')
|
||||||
|
if [[ "$IN_VENV" == "1" ]]; then
|
||||||
|
echo "It appears that we are already in a virtualenv. Deactivating..."
|
||||||
|
deactivate || source deactivate || die "FAILED: Unable to deactivate from existing virtualenv."
|
||||||
|
fi
|
||||||
|
|
||||||
${PYTHON_BIN_PATH} -m virtualenv -p ${PYTHON_BIN_PATH} "${VENV_TMP_DIR}" || \
|
${PYTHON_BIN_PATH} -m virtualenv -p ${PYTHON_BIN_PATH} "${VENV_TMP_DIR}" || \
|
||||||
echo "WARNING: Unable to create virtualenv. Assuming we are in one already."
|
die "FAILED: Unable to create virtualenv"
|
||||||
|
|
||||||
source "${VENV_TMP_DIR}/bin/activate" || \
|
source "${VENV_TMP_DIR}/bin/activate" || \
|
||||||
echo "WARNING: Unable to activate virtualenv. Assuming we are in one already."
|
die "FAILED: Unable to activate virtualenv "
|
||||||
|
|
||||||
# install tensorflow
|
# install tensorflow
|
||||||
python -m pip install ${WHL_NAME} || \
|
python -m pip install ${WHL_NAME} || \
|
||||||
|
@ -289,7 +289,7 @@ fi
|
|||||||
check_global_vars
|
check_global_vars
|
||||||
|
|
||||||
# Check if in a virtualenv and exit if yes.
|
# Check if in a virtualenv and exit if yes.
|
||||||
IN_VENV=$(python -c 'import sys; print("1" if hasattr(sys, "base_prefix") else "0")')
|
IN_VENV=$(python -c 'import sys; print("1" if sys.version_info.major == 3 and sys.prefix != sys.base_prefix else "0")')
|
||||||
if [[ "$IN_VENV" == "1" ]]; then
|
if [[ "$IN_VENV" == "1" ]]; then
|
||||||
echo "It appears that we are already in a virtualenv. Deactivating..."
|
echo "It appears that we are already in a virtualenv. Deactivating..."
|
||||||
deactivate || source deactivate || die "FAILED: Unable to deactivate from existing virtualenv."
|
deactivate || source deactivate || die "FAILED: Unable to deactivate from existing virtualenv."
|
||||||
|
Loading…
Reference in New Issue
Block a user