summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2010-08-02 16:23:53 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2010-08-02 16:23:53 +0000
commitdf0781351b8cae036ea77acdf69a087d1a90337b (patch)
treed7c4a0604d8b68ac5261176e95be2038fcae1a4b
parentHandle files specific to Mac OS X (bug #310551). (diff)
downloadeselect-python-df0781351b8cae036ea77acdf69a087d1a90337b.tar.gz
eselect-python-df0781351b8cae036ea77acdf69a087d1a90337b.tar.bz2
eselect-python-df0781351b8cae036ea77acdf69a087d1a90337b.zip
Print improved error message when no Python interpreter is available.
-rw-r--r--python.eselect28
1 files changed, 16 insertions, 12 deletions
diff --git a/python.eselect b/python.eselect
index d3912b6..f72e5cc 100644
--- a/python.eselect
+++ b/python.eselect
@@ -56,8 +56,8 @@ EOF
remove_symlinks() {
local symlink symlink_target symlink_target_found
if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then
- rm -f "${INTERPRETER_PATH}"{idle,pydoc,python,python-config,pythonw} &>/dev/null || return 1
- rm -f "${MAN_PATH}"python.1{,.gz,.bz2,.lzma,.xz} &>/dev/null || return 1
+ rm -f "${INTERPRETER_PATH}"{idle,pydoc,python,python-config,pythonw} &> /dev/null || return 1
+ rm -f "${MAN_PATH}"python.1{,.gz,.bz2,.lzma,.xz} &> /dev/null || return 1
fi
for symlink in "${INTERPRETER_PATH}python"?; do
@@ -91,9 +91,9 @@ set_man_symlink() {
return 1
fi
- pushd "${MAN_PATH}" 1>/dev/null
+ pushd "${MAN_PATH}" 1> /dev/null
ln -nfs "${target}${extension}" "python${extension}"
- popd 1>/dev/null
+ popd 1> /dev/null
}
# Set python-config script and appropriate symlinks
@@ -115,7 +115,7 @@ set_scripts_and_symlinks() {
set_man_symlink "${target}"
fi
- pushd "${INTERPRETER_PATH}" 1>/dev/null
+ pushd "${INTERPRETER_PATH}" 1> /dev/null
ln -nfs "${target}" "${target%.*}"
if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then
@@ -140,15 +140,15 @@ set_scripts_and_symlinks() {
local framework_dir="${INTERPRETER_PATH%/bin/}/lib/Python.framework"
if [[ -d "${framework_dir}" ]]; then
local version="${target#python}"
- pushd "${framework_dir}" 1>/dev/null
+ pushd "${framework_dir}" 1> /dev/null
ln -nfs "Versions/${version}/Headers"
ln -nfs "Versions/${version}/Python"
ln -nfs "Versions/${version}/Resources"
- popd 1>/dev/null
+ popd 1> /dev/null
fi
fi
- popd 1>/dev/null
+ popd 1> /dev/null
else
die -q "Target \"${1}\" doesn't appear to be valid!"
fi
@@ -392,16 +392,20 @@ do_update() {
interpreters="python3.?"
fi
- targets=($(cd "${INTERPRETER_PATH}"; ls ${interpreters} | sort -r))
+ targets=($(cd "${INTERPRETER_PATH}"; ls ${interpreters} 2> /dev/null | sort -r))
# Ignore slots
for slot in ${ignored_slots[@]}; do
targets=(${targets[@]/python${slot}/})
done
- target=${targets[0]}
- echo "Switching to ${target}"
- do_set ${python_version_option} ${target}
+ if [[ ${#targets[@]} -gt 0 ]]; then
+ target=${targets[0]}
+ echo "Switching to ${target}"
+ do_set ${python_version_option} ${target}
+ else
+ die -q "No Python interpreter available"
+ fi
}
# vim: set ft=eselect :