fab-user
[Top][All Lists]
Advanced

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

[Fab-user] Generic prefix context manager?


From: Matthew Wilson
Subject: [Fab-user] Generic prefix context manager?
Date: Tue, 7 Jul 2009 17:37:47 -0400

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




reply via email to

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