From c54edfad9cd7626b4eca74bb8b8c5708e7e387bd Mon Sep 17 00:00:00 2001 From: Holger Just Date: Fri, 27 Apr 2012 14:56:38 +0200 Subject: [PATCH] Cleanup python bin paths --- .bashrc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.bashrc b/.bashrc index b39bafc..7b51e78 100755 --- a/.bashrc +++ b/.bashrc @@ -87,23 +87,19 @@ case `uname` in alias ls='ls -G' - python="$(which python)" - python_path="" # Find correct python bin path with multiple Pythons installed by Homebrew - if [[ "$python" =~ ^/usr/local/bin ]]; then + if [[ "$(which python)" =~ ^/usr/local/bin ]]; then # Python comes from Homebrew - target=$(readlink "$python") - if [[ $? ]]; then - # the python binary is a symlink - python_path=$(cd "$(dirname "$python")" && cd "$(dirname "$target")" && pwd) - fi + for p in $(ls -1d /usr/local/Cellar/python/*/bin | sort -r); do + export PATH=$p:$PATH + done fi - for p in "$python_path" /usr/local/*/bin /usr/*/bin; do + for p in /usr/local/*/bin /usr/*/bin; do if [[ -n "$p" ]]; then export PATH=$p:$PATH fi done - unset p python python_path + unset p export PG_DATA=/usr/local/var/postgres