Skip to content

Commit

Permalink
Fix vf globalpackages toggle. Fixes #251
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer committed Oct 9, 2024
1 parent 0cff4b8 commit adec285
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions virtualfish/virtual.fish
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ function __vfsupport_globalpackages_enable --description "Enable global site pac
argparse -n "vf globalpackages enable" "q/quiet" -- $argv
pushd $VIRTUAL_ENV
if test -e $VIRTUALFISH_VENV_CONFIG_FILE # PEP 405
command sed -i '/include-system-site-packages/ s/\(true\|false\)/true/' $VIRTUALFISH_VENV_CONFIG_FILE
command sed -i -E 's/include-system-site-packages = false/include-system-site-packages = true/' $VIRTUALFISH_VENV_CONFIG_FILE
else # legacy
# use site-packages/.. to avoid ending up in python-wheels
pushd $VIRTUAL_ENV/lib/python*/site-packages/..
Expand All @@ -730,7 +730,7 @@ function __vfsupport_globalpackages_disable --description "Disable global site p
argparse -n "vf globalpackages disable" "q/quiet" -- $argv
pushd $VIRTUAL_ENV
if test -e $VIRTUALFISH_VENV_CONFIG_FILE # PEP 405
command sed -i '/include-system-site-packages/ s/\(true\|false\)/false/' $VIRTUALFISH_VENV_CONFIG_FILE
command sed -i -E 's/include-system-site-packages = true/include-system-site-packages = false/' $VIRTUALFISH_VENV_CONFIG_FILE
else # legacy
# use site-packages/.. to avoid ending up in python-wheels
pushd $VIRTUAL_ENV/lib/python*/site-packages/..
Expand All @@ -748,24 +748,24 @@ function __vfsupport_globalpackages_toggle --description "Toggle global site pac
pushd $VIRTUAL_ENV
set -l globalpkgs_enabled
if test -e $VIRTUALFISH_VENV_CONFIG_FILE # PEP 405
if [ "true" = (command sed -n 's/include-system-site-packages\s=\s\(true\|false\)/\1/p' $VIRTUALFISH_VENV_CONFIG_FILE) ]
set globalpkgs_enabled 0
else
if string match --quiet '*true*' (command grep "include-system-site-packages =" $VIRTUALFISH_VENV_CONFIG_FILE)
set globalpkgs_enabled 1
else
set globalpkgs_enabled 0
end
else # legacy
# use site-packages/.. to avoid ending up in python-wheels
pushd $VIRTUAL_ENV/lib/python*/site-packages/..
if test -e $VIRTUALFISH_GLOBAL_SITE_PACKAGES_FILE
set globalpkgs_enabled 0
else
set globalpkgs_enabled 1
else
set globalpkgs_enabled 0
end
popd
end
popd

if test $globalpkgs_enabled -eq 0
if test $globalpkgs_enabled -eq 1
__vfsupport_globalpackages_disable $argv
else
__vfsupport_globalpackages_enable $argv
Expand Down

0 comments on commit adec285

Please sign in to comment.