[zsh] Make init_env_python a function inside of its script file
This commit is contained in:
parent
aa6e81fdeb
commit
dd7de9628e
1 changed files with 24 additions and 22 deletions
|
@ -1,28 +1,30 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
local pythonRoot
|
autoload -Uz prepend_to_path
|
||||||
local python27SitePackages
|
|
||||||
|
|
||||||
pythonRoot="$HOME/Library/Python"
|
init_env_python() {
|
||||||
if [[ -d "$pythonRoot" ]]; then
|
local pythonRoot="$HOME/Library/Python"
|
||||||
for f in `ls "$pythonRoot"`; do
|
if [[ -d "$pythonRoot" ]]; then
|
||||||
prepend_to_path "$pythonRoot/$f/bin"
|
for f in "$pythonRoot/*"; do
|
||||||
done
|
prepend_to_path "$f/bin"
|
||||||
fi
|
done
|
||||||
|
|
||||||
python27SitePackages="$pythonroot/2.7/lib/python/site-packages"
|
|
||||||
if [[ -d "$python27SitePackages" ]]; then
|
|
||||||
if [[ ! -z $PYTHONPATH ]]; then
|
|
||||||
PYTHONPATH=$python27SitePackages:$PYTHONPATH
|
|
||||||
else
|
|
||||||
PYTHONPATH=$python27SitePackages
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
export PYTHONPATH
|
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
|
||||||
|
|
||||||
if which virtualenvwrapper.sh &> /dev/null; then
|
export PYTHONPATH
|
||||||
export WORKON_HOME="$HOME/src/py/.envs"
|
|
||||||
source `which virtualenvwrapper.sh`
|
if which virtualenvwrapper.sh &> /dev/null; then
|
||||||
fi
|
export WORKON_HOME="$HOME/src/py/.envs"
|
||||||
|
source `which virtualenvwrapper.sh`
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
init_env_python "$@"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue