diff options
author | Ali Polatel <hawking@gentoo.org> | 2008-06-20 19:42:36 +0000 |
---|---|---|
committer | Ali Polatel <hawking@gentoo.org> | 2008-06-20 19:42:36 +0000 |
commit | f75e3696d324102b4384afd31fdb53b743a716ef (patch) | |
tree | e05075363763dd01c03093c4b3581616c1e484fc | |
parent | Add lzma to the list of suffixes for man pages. (diff) | |
download | eselect-python-f75e3696d324102b4384afd31fdb53b743a716ef.tar.gz eselect-python-f75e3696d324102b4384afd31fdb53b743a716ef.tar.bz2 eselect-python-f75e3696d324102b4384afd31fdb53b743a716ef.zip |
Implemented --ignore option for update, so it can be used in ebuild's prerm safely.
-rw-r--r-- | python.eselect | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/python.eselect b/python.eselect index 4fc317b..c0da2a4 100644 --- a/python.eselect +++ b/python.eselect @@ -139,18 +139,35 @@ describe_update() { } describe_update_options() { - echo "--if-unset : Do not override existing implementation" + echo "--if-unset : Do not override existing implementation" + echo "--ignore SLOT : Ignore SLOT when setting symlinks" } do_update() { - [[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ - die -q "Usage error" + local if_unset=false ignored_slot= + while [[ $# > 0 ]]; do + case $1 in + --if-unset) + if_unset=true + ;; + --ignore) + ignored_slot=${2} + shift;; + --*) + die -q "Unrecognized option '$1'" + ;; + esac + shift + done if [[ -L "${ROOT}/usr/bin/python" ]]; then - [[ ${1} == "--if-unset" ]] && return + ${if_unset} && return fi local targets=( $(cd "${INTERPRETER_PATH}"; ls python?.?|sort -r) ) target + if [[ -n "${ignored_slot}" ]]; then + targets=( ${targets[@]/python${ignored_slot}/} ) + fi target=${targets[0]} echo "Switching to ${target}" do_set ${target} |