Browse Source

Replace pythonz with pyenv

Depending on Python to manage Python is silly.
master
Sorin Ionescu 12 years ago
parent
commit
459238b2bb
  1. 20
      modules/python/README.md
  2. 43
      modules/python/init.zsh

20
modules/python/README.md

@ -6,15 +6,15 @@ Enables local Python and local Python package installation. @@ -6,15 +6,15 @@ Enables local Python and local Python package installation.
Local Python Installation
-------------------------
[pythonz][4] builds and installs multiple Python versions locally in the home
[pyenv][4] builds and installs multiple Python versions locally in the home
directory.
This module prepends the pythonz directory to the path variable to enable the
execution of `pythonz`.
This module prepends the pyenv directory to the path variable to enable the
execution of `pyenv`.
### Usage
Install Python versions with `pythonz install` into *~/.pythonz/pythons*.
Install Python versions with `pyenv install` into *~/.pyenv/versions*.
Local Package Installation
--------------------------
@ -66,16 +66,6 @@ Aliases @@ -66,16 +66,6 @@ Aliases
- `py` is short for `python`.
### Pythonz
- `pyz` is short for `pythonz`.
- `pyzc` removes stale source folders and archives.
- `pyzi` installs Python versions.
- `pyzl` lists installed Python versions.
- `pyzL` lists available Python versions.
- `pyzu` updates itself to the latest version.
- `pyzx` uninstalls Python versions.
Functions
---------
@ -105,6 +95,6 @@ Authors @@ -105,6 +95,6 @@ Authors
[1]: http://www.python.org/dev/peps/pep-0370/
[2]: http://www.doughellmann.com/projects/virtualenvwrapper/
[3]: http://pypi.python.org/pypi/virtualenv
[4]: http://saghul.github.com/pythonz/
[4]: https://github.com/yyuu/pyenv
[5]: https://github.com/sorin-ionescu/prezto/issues

43
modules/python/init.zsh

@ -6,29 +6,35 @@ @@ -6,29 +6,35 @@
# Sebastian Wiesner <lunaryorn@googlemail.com>
#
# Load pythonz into the shell session.
if [[ -s $HOME/.pythonz/bin/pythonz ]]; then
path=($HOME/.pythonz/bin $path)
fi
# Load manually installed pyenv into the shell session.
if [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then
path=("$HOME/.pyenv/bin" $path)
eval "$(pyenv init -)"
# Return if requirements are not found.
if (( ! $+commands[python] && ! $+commands[pythonz] )); then
return 1
fi
# Load package manager installed pyenv into the shell session.
elif (( $+commands[pyenv] )); then
eval "$(pyenv init -)"
# Prepend PEP 370 per user site packages directory, which defaults to
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH.
if [[ "$OSTYPE" == darwin* ]]; then
path=($HOME/Library/Python/*/bin(N) $path)
else
# This is subject to change.
path=($HOME/.local/bin $path)
if [[ "$OSTYPE" == darwin* ]]; then
path=($HOME/Library/Python/*/bin(N) $path)
else
# This is subject to change.
path=($HOME/.local/bin $path)
fi
fi
# Return if requirements are not found.
if (( ! $+commands[python] && ! $+commands[pyenv] )); then
return 1
fi
# Load virtualenvwrapper into the shell session.
if (( $+commands[virtualenvwrapper_lazy.sh] )); then
# Set the directory where virtual environments are stored.
export WORKON_HOME=$HOME/.virtualenvs
export WORKON_HOME="$HOME/.virtualenvs"
# Disable the virtualenv prompt.
VIRTUAL_ENV_DISABLE_PROMPT=1
@ -42,14 +48,3 @@ fi @@ -42,14 +48,3 @@ fi
alias py='python'
# pythonz
if (( $+commands[pythonz] )); then
alias pyz='pythonz'
alias pyzc='pythonz cleanup'
alias pyzi='pythonz install'
alias pyzl='pythonz list'
alias pyzL='pythonz list -a'
alias pyzu='pythonz update'
alias pyzx='pythonz uninstall'
fi

Loading…
Cancel
Save