fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Generic prefix context manager?


From: Jeff Forcier
Subject: Re: [Fab-user] Generic prefix context manager?
Date: Tue, 7 Jul 2009 18:33:58 -0400

Hi Matt,

This is definitely on the TODO: make a generic prefix context manager
(and then rework 'cd' to use that) which is capable of prefixing any
arbitrary string. It'll be in for 1.0 for sure, and probably enter
master pretty soon after I finish the 0.9 beta work.

Also, re: virtualenv, I've found it very useful to add the "cd
/home/matt/projects" part to my virtualenv's post-activate script :)
it removes the need to manually 'cd' both in shell and in Fab tasks.

-Jeff

On Tue, Jul 7, 2009 at 5:37 PM, Matthew Wilson<address@hidden> wrote:
> Since I use a virtualenv on my servers, before I run "python zzz.py",
> I need to activate the virtualenv.  So I'm doing this right now:
>
>    run("source /home/matt/virtualenvs/foo/bin/activate && python zzz.py")
>
> I read through how fabric.context_managers.cd works.  It seems to set
> a key in the env dictionary.  Then in fabric.operations.run, that key
> is interpolated into the string to be sent as a command.
>
> It might be nice to have something like this:
>
> with context_managers.prefixes(['source
> /home/matt/virtualenv/foo/bin/activate', 'cd /home/matt/projects']):
>    run('python zzz.py')
>
> Thoughts?  I would have to change run to look in env.prefixes and glue
> all that junk in.
>
> Is there some much simpler way of activating a virtualenv before I run
> each one of my commands?
>
> Matt
>
>
> --
> Matthew Wilson
> address@hidden
> http://tplus1.com
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]