From 64d57ec71f3d97928e633d530a0e4d1439757fb7 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Mon, 4 Dec 2017 12:08:45 -0800 Subject: [PATCH] python-info: avoid setting python_info[version] if python is not on the PATH --- modules/python/functions/python-info | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/python/functions/python-info b/modules/python/functions/python-info index e5eebc1..e5a8339 100644 --- a/modules/python/functions/python-info +++ b/modules/python/functions/python-info @@ -32,10 +32,12 @@ if [[ -n "$CONDA_DEFAULT_ENV" ]]; then python_info[virtualenv]="$virtualenv_formatted" fi -zstyle -s ':prezto:module:python:info:version' format 'version_format' -if [[ -n "$version_format" ]]; then - zformat -f version_formatted "$version_format" "v:${$(python3 --version)#Python }" - python_info[version]="$version_formatted" +if (( $+commands[python] )); then + zstyle -s ':prezto:module:python:info:version' format 'version_format' + if [[ -n "$version_format" ]]; then + zformat -f version_formatted "$version_format" "v:${$(python3 --version)#Python }" + python_info[version]="$version_formatted" + fi fi # }