Delete virtualenv before deploy.

This commit is contained in:
Jeremiah Orem 2012-11-08 14:10:30 -08:00
Родитель 7478f74a65
Коммит 7b87df07d3
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -14,18 +14,18 @@ _src_dir = lambda *p: os.path.join(settings.SRC_DIR, *p)
@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
if not venv.startswith('/data'):
raise Exception('venv must start with /data')
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))
ctx.local('rm -rf %s' % venv)
ctx.local('virtualenv --distribute --never-download %s' % venv)
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))
# 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