Here's my crude workon and deactivate
fish scripts, to use them just save them
in ~/.config/fish/functions as
workon.fish and deactivate.fish. You'll
need to set $WORKON_HOME (which I think
you also have to do with the bash scripts).
Let me know if the mailing list screws
up the formatting and I'll email them to
you.
function workon
switch (count $argv)
case 0
cd $WORKON_HOME
ls -d1 */ | xargs basename
cd -
case 1
if count $CURRENT_VIRTUALENV
echo virtualenv already
invoked $CURRENT_VIRTUALENV
echo deactivate before
invoking new virtualenv
return
end
cd $WORKON_HOME
set envs (ls -d1 */ | xargs
basename)
cd -
set found 0
for i in $envs
if test $argv[1] = $i
set -g OLD_PATH $PATH
set PATH
$WORKON_HOME/$i/bin $PATH
set -g
CURRENT_VIRTUALENV \($i\)
set found 1
end
end
if test $found = 0
echo ERROR: environment not
found \($argv[1]\)
end
end
end
function deactivate
if count $CURRENT_VIRTUALENV
set PATH $OLD_PATH
set -e CURRENT_VIRTUALENV
else
echo ERROR: virtualenv not
invoked, exiting
end
end
On 22/04/2011 21:58, Michael Seiwald wrote:
> Hello,
>
> I want to use envdotpy [1] since virtualenvwrapper is written for bash
> and cannot be used in fish.
>
> I'm trying to adapt the script for fish but I'm stuck at this part:
>
> # activate the virtualenv
> script_path = os.path.join(env_path, 'scripts', 'activate.bat')
> os.system('cmd.exe /K "%s"' % script_path)
>
> How can I source the activate.fish (which is part of the virtualenv
> package) from python?
>
> I tried:
>
> # activate the virtualenv
> script_path = os.path.join(env_path, 'bin', 'activate.fish')
> os.system('fish -c "%s"' % script_path)
>
> but it fails. It works fine when I do . /path/to/bin/activate.fish
> directly in fish.
>
> Any suggestions?
>
> Best regards
>
> Michael
>
> [1] https://bitbucket.org/jdriscoll/envdotpy/overview
>
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Fish-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fish-users
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users