summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Polatel <hawking@gentoo.org>2008-05-21 12:28:45 +0000
committerAli Polatel <hawking@gentoo.org>2008-05-21 12:28:45 +0000
commit38433ef66ea4a93fc3546c1e462bc7b9b4725a34 (patch)
tree7162ec3f53e645f94c79a9afe032562bf87a5f34
parentTag version 20080124 (diff)
downloadeselect-python-38433ef66ea4a93fc3546c1e462bc7b9b4725a34.tar.gz
eselect-python-38433ef66ea4a93fc3546c1e462bc7b9b4725a34.tar.bz2
eselect-python-38433ef66ea4a93fc3546c1e462bc7b9b4725a34.zip
Implement update --if-unset. Borrowed from vi.eselect
-rw-r--r--python.eselect11
1 files changed, 11 insertions, 0 deletions
diff --git a/python.eselect b/python.eselect
index 645bdec..cb973a6 100644
--- a/python.eselect
+++ b/python.eselect
@@ -138,7 +138,18 @@ describe_update() {
echo "Switch to the most recent CPython."
}
+describe_update_options() {
+ echo "--if-unset : Do not override existing implementation"
+}
+
do_update() {
+ [[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \
+ die -q "Usage error"
+
+ if [[ -L "${ROOT}/usr/bin/python" ]]; then
+ [[ ${1} == "--if-unset" ]] && return
+ fi
+
local targets=( $(cd "${INTERPRETER_PATH}"; ls python?.?|sort -r) ) target
target=${targets[0]}
echo "Switching to ${target}"