# Eryn Wells <eryn@erynwells.me>

autoload -Uz prepend_to_path

init_env_python() {
    local pythonRoot="$HOME/Library/Python"
    if [[ -d "$pythonRoot" ]]; then
        for f in $pythonRoot/*; do
            prepend_to_path "$f/bin"
        done
    fi

    local python27SitePackages="$pythonroot/2.7/lib/python/site-packages"
    if [[ -d "$python27SitePackages" ]]; then
        if [[ ! -z $PYTHONPATH ]]; then
            PYTHONPATH=$python27SitePackages:$PYTHONPATH
        else
            PYTHONPATH=$python27SitePackages
        fi
    fi

    export PYTHONPATH

    if which virtualenvwrapper.sh &> /dev/null; then
        export WORKON_HOME="$HOME/src/py/.envs"
        source `which virtualenvwrapper.sh`
    fi
}

init_env_python "$@"
