clean up pyenv and python resources
parent
755942fcf7
commit
a953a1a6b9
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Bash completion support for pyenv
|
||||||
|
|
||||||
|
if _command_exists pyenv && [[ -r "$(dirname $(readlink -f $(which pyenv)))/../completions/pyenv.bash" ]] ; then
|
||||||
|
source "$(dirname $(readlink -f $(which pyenv)))/../completions/pyenv.bash"
|
||||||
|
fi
|
||||||
|
|
@ -1,12 +1,30 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'load pyenv, if you are using it'
|
about-plugin 'load pyenv, if you are using it'
|
||||||
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
# Load after basher
|
||||||
|
# BASH_IT_LOAD_PRIORITY: 275
|
||||||
|
|
||||||
|
# Don't modify the environment if we can't find the tool:
|
||||||
|
# - Check if in $PATH already
|
||||||
|
# - Check if installed manually to $PYENV_ROOT
|
||||||
|
# - Check if installed manually to $HOME
|
||||||
|
_command_exists pyenv ||
|
||||||
|
[[ -n "$PYENV_ROOT" && -x "$PYENV_ROOT/bin/pyenv" ]] ||
|
||||||
|
[[ -x "$HOME/.pyenv/bin/pyenv" ]] ||
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Set PYENV_ROOT, if not already set
|
||||||
|
export PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}"
|
||||||
|
|
||||||
|
# Add PYENV_ROOT/bin to PATH, if that's where it's installed
|
||||||
|
if ! _command_exists pyenv && [[ -x "$PYENV_ROOT/bin/pyenv" ]] ; then
|
||||||
pathmunge "$PYENV_ROOT/bin"
|
pathmunge "$PYENV_ROOT/bin"
|
||||||
|
|
||||||
[[ `which pyenv 2>/dev/null` ]] && eval "$(pyenv init - bash)"
|
|
||||||
|
|
||||||
#Load pyenv virtualenv if the virtualenv plugin is installed.
|
|
||||||
if pyenv virtualenv-init - &> /dev/null; then
|
|
||||||
eval "$(pyenv virtualenv-init - bash)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Initialize pyenv
|
||||||
|
eval "$(pyenv init - bash)"
|
||||||
|
|
||||||
|
# Load pyenv virtualenv if the plugin is installed
|
||||||
|
! _command_exists 'pyenv virtualenv --help' \
|
||||||
|
"pyenv plugin 'virtualenv' is not installed - skipping" ||
|
||||||
|
eval "$(pyenv virtualenv-init - bash)"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'alias "shttp" to SimpleHTTPServer'
|
about-plugin 'alias "shttp" to SimpleHTTPServer'
|
||||||
|
|
||||||
if [ $(uname) = "Linux" ]
|
# Load after pyenv
|
||||||
then
|
# BASH_IT_LOAD_PRIORITY: 285
|
||||||
|
|
||||||
|
# Check python version to ensure pyenv can find python
|
||||||
|
{ _command_exists python && python --version &>/dev/null ; } || return 0
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == 'Linux' ]] ; then
|
||||||
alias shttp='python2 -m SimpleHTTPServer'
|
alias shttp='python2 -m SimpleHTTPServer'
|
||||||
else
|
else
|
||||||
alias shttp='python -m SimpleHTTPServer'
|
alias shttp='python -m SimpleHTTPServer'
|
||||||
|
|
@ -14,9 +19,9 @@ function pyedit() {
|
||||||
example '$ pyedit requests'
|
example '$ pyedit requests'
|
||||||
group 'python'
|
group 'python'
|
||||||
|
|
||||||
xpyc=`python -c "import os, sys; f = open(os.devnull, 'w'); sys.stderr = f; module = __import__('$1'); sys.stdout.write(module.__file__)"`
|
xpyc=$(python -c "import os, sys; f = open(os.devnull, 'w'); sys.stderr = f; module = __import__('$1'); sys.stdout.write(module.__file__)")
|
||||||
|
|
||||||
if [ "$xpyc" == "" ]; then
|
if [[ "$xpyc" == "" ]]; then
|
||||||
echo "Python module $1 not found"
|
echo "Python module $1 not found"
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue