Browse Source

Replace pythonz with pyenv

Depending on Python to manage Python is silly.
master
Sorin Ionescu 11 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.
Local Python 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. directory.
This module prepends the pythonz directory to the path variable to enable the This module prepends the pyenv directory to the path variable to enable the
execution of `pythonz`. execution of `pyenv`.
### Usage ### Usage
Install Python versions with `pythonz install` into *~/.pythonz/pythons*. Install Python versions with `pyenv install` into *~/.pyenv/versions*.
Local Package Installation Local Package Installation
-------------------------- --------------------------
@ -66,16 +66,6 @@ Aliases
- `py` is short for `python`. - `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 Functions
--------- ---------
@ -105,6 +95,6 @@ Authors
[1]: http://www.python.org/dev/peps/pep-0370/ [1]: http://www.python.org/dev/peps/pep-0370/
[2]: http://www.doughellmann.com/projects/virtualenvwrapper/ [2]: http://www.doughellmann.com/projects/virtualenvwrapper/
[3]: http://pypi.python.org/pypi/virtualenv [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 [5]: https://github.com/sorin-ionescu/prezto/issues

43
modules/python/init.zsh

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