On May 2, 2009, at 11:53 AM, Jeff Forcier wrote:
On Sat, May 2, 2009 at 11:27 AM, s s <[email protected]>
wrote:
Yes. Context managers are 2.5+ but that's fine with me. You only
need 2.5
on the deployer i.e. your development machine so I don't think this
should
be too much of a problem.
Fabric is officially 2.5+ only [1], so yea. Context managers are
totally a good thing and I want to use more of them :)
[1] http://docs.fabfile.org/compatibility.html#python-version
Cool.
Only thing with that is you lose the ability to grab error/status
info from
each command. One of my other use-cases involves finding out
whether a
command exists on the target machine (wget, for example) and
installing it
if it doesn't.
This is another reason to prefer the context manager approach, as it
combines the best of both worlds: your commands still get run with the
appropriate shell environment, but you also still have discrete
run/sudo invocations, complete with their own return codes/failure
handling/etc.
One edge case this doesn't cover is when one of your shell commands
modifies the shell environment itself, but I'm not sure if that
happens often enough to merit doing a lot of switching things around
or adding lots of complexity, though.
Uh, the first thing switching to a virtual environment does is
mutilate the environment so that the virtenv becomes the "context" for
subsequent commands or do you mean something else?
S
_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user