Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Commit

Permalink
Invoke virtualenv/pip (bug 804932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short committed Oct 25, 2012
1 parent 079b300 commit 230db13
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion bin/update/deploy.py
Expand Up @@ -11,9 +11,28 @@

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from commander.deploy import task, hostgroups
from commander.deploy import task, hostgroups, BadReturnCode
import commander_settings as settings

@task
def create_virtualenv(ctx):
venv = settings.VIRTUAL_ENV
try:
try:
ctx.local("virtualenv --distribute --never-download %s" % venv)
except BadReturnCode:
pass # if this is really broken, then the pip install should fail

ctx.local("%s/bin/pip install --exists-action=w --no-deps --no-index "
"--download-cache=/tmp/pip-cache -f %s "
"-r %s/requirements/prod.txt" %
(venv, settings.PYREPO, settings.SRC_DIR))
finally:
# make sure this always runs
ctx.local("rm -f %s/lib/python2.6/no-global-site-packages.txt" % venv)
ctx.local("%s/bin/python /usr/bin/virtualenv --relocatable %s"
% (venv, venv))


@task
def update_code(ctx, tag):
Expand Down Expand Up @@ -112,5 +131,6 @@ def deploy(ctx):
def update_site(ctx, tag):
"""Update the app to prep for deployment."""
pre_update(tag)
create_virtualenv()
update()
post_update()

0 comments on commit 230db13

Please sign in to comment.