Skip to content

Commit

Permalink
fabfile: remove any previous build folder on deploy
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Aage Lavik <[email protected]>
  • Loading branch information
jalavik committed Dec 4, 2014
1 parent 07b8623 commit dac9448
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def install():
invenio_package = local("python setup.py --fullname", capture=True).strip()
put("dist/{0}.tar.gz".format(invenio_package), "/tmp/invenio.tgz")

remove_build()
with settings(sudo_user="invenio"):
sudo("mkdir -p {0}/src".format(venv))
with cd("{0}/src".format(venv)):
Expand Down Expand Up @@ -236,6 +237,19 @@ def install():
return success


@task
def remove_build():
"""Remove the leftover build directory."""
package = local("python setup.py --fullname", capture=True).strip()
venv = "{0}/{1}".format(env.directory, package)
with settings(sudo_user="invenio"):
with prefix('source {0}/bin/activate'.format(venv)):
build_dir = os.path.join(venv, "build")
src_dir = os.path.join(venv, "src")
sudo("rm -rf {0}".format(src_dir))
sudo("rm -rf {0}".format(build_dir))


@task
def restart_celery():
"""Restart celery workers."""
Expand Down

0 comments on commit dac9448

Please sign in to comment.