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: Steve Steiner (listsin)
Subject: Re: [Fab-user] Generic prefix context manager?
Date: Wed, 8 Jul 2009 00:17:59 -0400

First of all let me tell you I love the idea. In fact I think fabric
should be totally aware of venvs and it should be even simpler
something like

with virtualenv('/path/to/venv/'):
   cmd('pip install package')

I haven't had time to code it. That said in the case of the venv there
is one little trick almost no one knows about. if you use the full
path to the venv's python executable you don't need to activate it. so
I do the following (seudo-code).

env.python = "/home/matt/virtualenvs/foo/bin/python"
run("%(python)s zzz.py" % env)

I'm pretty sure you can bypass that, even, by having the specific virtualenv interperter you want to run your script in with the shebang set to the right interpreter:

#! /pathto/virtualenvs/python

and it will run entirely in the virtualenv.

Yes, it's hard-coded, but for this use-case, where you're making the server on which it's to run, anyway...

Right?

S





reply via email to

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