diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-05-23 15:12:06 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-05-23 15:12:06 +0000 |
commit | d50be44f967b342ad89d6a600cf0605ef9bf831e (patch) | |
tree | e3af6f223fea6eab15af5a68536039f80f69bb92 | |
parent | Make sure ROOT doesn't have two slashes at the end, fixing bug 240149. (diff) | |
download | eselect-python-d50be44f967b342ad89d6a600cf0605ef9bf831e.tar.gz eselect-python-d50be44f967b342ad89d6a600cf0605ef9bf831e.tar.bz2 eselect-python-d50be44f967b342ad89d6a600cf0605ef9bf831e.zip |
Improve handling of symlinks.
-rw-r--r-- | python.eselect | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/python.eselect b/python.eselect index ca655d2..82ba77f 100644 --- a/python.eselect +++ b/python.eselect @@ -23,8 +23,19 @@ find_targets() { # try to remove python and python.1 symlinks remove_symlinks() { + local symlink symlink_target symlink_target_found rm -f "${INTERPRETER_PATH}"{idle,pydoc,python,python-config} &>/dev/null && \ rm -f "${MAN_PATH}"python.1{,.gz,.bz2,.lzma} &>/dev/null + for symlink in "${INTERPRETER_PATH}python"? ; do + [[ ! -L "${symlink}" ]] && continue + symlink_target_found=0 + for symlink_target in "${symlink}".? ; do + [[ -f "${symlink_target}" ]] && symlink_target_found=1 + done + if [[ "${symlink_target_found}" -eq 0 ]] ; then + rm -f "${symlink}" + fi + done } # set a man page symlink @@ -63,13 +74,14 @@ set_symlinks() { set_man_symlink "${target}" pushd "${INTERPRETER_PATH}" 1>/dev/null - ln -nfs "${INTERPRETER_PATH}${target}" python - ln -nfs "${INTERPRETER_PATH}${target/python/python-config-}" python-config - ln -nfs "${INTERPRETER_PATH}${target/python/pydoc}" pydoc - ln -nfs "${INTERPRETER_PATH}${target/python/idle}" idle - # 2to3 for 2.6 and 3.0 + ln -nfs "${target}" python + ln -nfs "${target}" "${target%.*}" + ln -nfs "${target/python/python-config-}" python-config + ln -nfs "${target/python/pydoc}" pydoc + ln -nfs "${target/python/idle}" idle + # 2to3 for >=2.6 if [[ -f "${INTERPRETER_PATH}${target/python/2to3-}" ]]; then - ln -nfs "${INTERPRETER_PATH}${target/python/2to3-}" 2to3 + ln -nfs "${target/python/2to3-}" 2to3 fi popd 1>/dev/null |