python 2.6 and older don't have "bin/python" as symlink.

so we must traverse files like "bin/python*" to obtain canonical name..
This commit is contained in:
Yamashita Yuu
2012-09-28 20:11:06 +09:00
parent bd38d39ea4
commit 67fc864252

View File

@@ -115,10 +115,22 @@ fi
BOOTSTRAP_PYTHON_BIN="${PYTHON_PREFIX}/bin/python" BOOTSTRAP_PYTHON_BIN="${PYTHON_PREFIX}/bin/python"
PYTHON_BIN="${VIRTUALENV_PATH}/bin/python" PYTHON_BIN="${VIRTUALENV_PATH}/bin/python"
# obtain actual name of python executable # find canonical name of python executable.
while test -L "${BOOTSTRAP_PYTHON_BIN}"; do # virtualenv will create "bin/python" executable as same name as its bootstraped python.
if test -L "${BOOTSTRAP_PYTHON_BIN}"; then
while test -L "${BOOTSTRAP_PYTHON_BIN}"; do # retrieve symlinks
BOOTSTRAP_PYTHON_BIN="$(dirname "${BOOTSTRAP_PYTHON_BIN}")/$(resolve_link "${BOOTSTRAP_PYTHON_BIN}")" BOOTSTRAP_PYTHON_BIN="$(dirname "${BOOTSTRAP_PYTHON_BIN}")/$(resolve_link "${BOOTSTRAP_PYTHON_BIN}")"
done done
else
# python 2.6 and older don't have "bin/python" as symlink.
# so we must traverse files like "bin/python*" to obtain canonical name.
for python in ${PYTHON_PREFIX}/bin/python*; do
if ( basename "$python" | grep '^python[0-9][0-9]*\.[0-9][0-9]*$' && cmp "$BOOTSTRAP_PYTHON_BIN" "$python" ) >/dev/null; then
BOOTSTRAP_PYTHON_BIN="${python}"
break
fi
done
fi
# create virtualenv # create virtualenv
"${BOOTSTRAP_PYTHON_BIN}" "${PYTHON_VIRTUALENV_ROOT}/libexec/virtualenv.py" "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" "${BOOTSTRAP_PYTHON_BIN}" "${PYTHON_VIRTUALENV_ROOT}/libexec/virtualenv.py" "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}"