forked from pkerichang/pybind11_generics
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.bashrc_python
32 lines (28 loc) · 1018 Bytes
/
.bashrc_python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# BCAD virtualenv activation script.
# use a default virtualenv location if none are specified,
# and also will source a ".bashrc_pypath" file to setup PYTHONPATH
# if it exists.
# set BCAD_PY_ROOT value if not defined
if [ -z "${BCAD_PY_ROOT}" ]; then
export BCAD_PY_ROOT="/tools/bag3/pyusr"
fi
# check that BCAD_PY_ROOT is a valid Python installation
PYTHON_BIN="${BCAD_PY_ROOT}/bin/python"
if ! [ -x "${PYTHON_BIN}" ]; then
echo "[ERROR] ${PYTHON_BIN} is not a valid python executable." >&2
exit 1
fi
# update PATH and Python related variables
export PATH="${BCAD_PY_ROOT}/bin:${PATH}"
unset PYTHONHOME
PYPATH_FILE=".bashrc_pypath"
if [ -f "${PYPATH_FILE}" ]; then
source "${PYPATH_FILE}"
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r 2> /dev/null
fi