Skip to content

Commit

Permalink
Use VIRTUAL_ENV same way as pyenv, fixes #114
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed Jun 2, 2024
1 parent d19749d commit 550bea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions default/patches/environment
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ deactivate () {
fi

unset VIRTUAL_ENV
unset VIRTUAL_ENV_PROMPT
unset VERILATOR_ROOT
unset GHDL_PREFIX
if [ ! "${1-}" = "nondestructive" ] ; then
Expand All @@ -55,7 +56,8 @@ else
release_topdir_abs="$(realpath "$release_current_dir")"
fi

export VIRTUAL_ENV='___BRANDING___'
export VIRTUAL_ENV="$release_topdir_abs"
export VIRTUAL_ENV_PROMPT='___BRANDING___'

_OLD_ENVIRONMENT_PATH="$PATH"
PATH="$release_topdir_abs/bin:$release_topdir_abs/py3bin:$PATH"
Expand All @@ -70,9 +72,9 @@ fi
_OLD_ENVIRONMENT_PS1="${PS1-}"
if [ -n "${ZSH_VERSION-}" ] ; then
autoload -U colors && colors
PS1="%{$fg[magenta]%}(${VIRTUAL_ENV})%{$reset_color%} ${PS1-}"
PS1="%{$fg[magenta]%}(${VIRTUAL_ENV_PROMPT})%{$reset_color%} ${PS1-}"
else
PS1="\[\033[1;35m\]\342\246\227${VIRTUAL_ENV}\342\246\230\[\033[0m\] ${PS1-}"
PS1="\[\033[1;35m\]\342\246\227${VIRTUAL_ENV_PROMPT}\342\246\230\[\033[0m\] ${PS1-}"
fi
export PS1

Expand Down
6 changes: 4 additions & 2 deletions default/patches/environment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function deactivate -d "Deactivate the ___BRANDING___ virtual environment"
end

set --erase VIRTUAL_ENV
set --erase VIRTUAL_ENV_PROMPT
set --erase VERILATOR_ROOT
set --erase GHDL_PREFIX

Expand All @@ -38,7 +39,8 @@ else
set --global release_topdir_abs (realpath $release_current_dir)
end

set --export VIRTUAL_ENV '___BRANDING___'
set --export VIRTUAL_ENV "$release_topdir_abs"
set --export VIRTUAL_ENV_PROMPT '___BRANDING___'

set --global _OLD_ENVIRONMENT_PATH "$PATH"
set --export PATH "$release_topdir_abs/bin:$release_topdir_abs/py3bin:$PATH"
Expand All @@ -51,7 +53,7 @@ end
functions --copy fish_prompt _old_environment_fish_prompt
function fish_prompt -d "Write out the prompt"
set_color magenta
echo -n -s '(' $VIRTUAL_ENV ') '
echo -n -s '(' $VIRTUAL_ENV_PROMPT ') '
set_color normal
_old_environment_fish_prompt
end
Expand Down

0 comments on commit 550bea1

Please sign in to comment.