On Tue, Jul 7, 2009 at 6:33 PM, Jeff Forcier<j...@bitprophet.org> wrote:
> 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.

I might take a shot at this.  Do you have a design in mind, or do you
want to see what I can come up with?

More generally, I think it would be nice if the code that builds up
strings to be used as commands was totally separate from the code that
executes those commands.  Then a dry-run mode might be easier.

>
> 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<m...@tplus1.com> 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
>> m...@tplus1.com
>> http://tplus1.com
>>
>>
>> _______________________________________________
>> Fab-user mailing list
>> Fab-user@nongnu.org
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>
>



-- 
Matthew Wilson
m...@tplus1.com
http://tplus1.com


_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to