You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
912 B
36 lines
912 B
#
|
|
# Exposes information about the Python environment via the $python_info
|
|
# associative array.
|
|
#
|
|
# Authors:
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
#
|
|
|
|
local version
|
|
local version_format
|
|
local version_formatted
|
|
local virtualenv_format
|
|
local virtualenv_formatted
|
|
|
|
# Clean up previous $python_info.
|
|
unset python_info
|
|
typeset -gA python_info
|
|
|
|
if (( $+commands[pyenv] )); then
|
|
version="${"$(pyenv version)"%% *}"
|
|
fi
|
|
|
|
# Format version.
|
|
if [[ -n "$version" ]]; then
|
|
zstyle -s ':prezto:module:python:info:version' format 'version_format'
|
|
zformat -f version_formatted "$version_format" "v:$version"
|
|
python_info[version]="${version_formatted}"
|
|
fi
|
|
|
|
# Format virtualenv.
|
|
if [[ -n "$VIRTUAL_ENV" ]]; then
|
|
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'
|
|
zformat -f virtualenv_formatted "$virtualenv_format" "v:${VIRTUAL_ENV:t}"
|
|
python_info[virtualenv]="$virtualenv_formatted"
|
|
fi
|