@task
def code_install():
  assert env.host_string, "no hosts specified"
  assert not is_old_code(), 'Active code is using the old style (directory instead of symlink). ' \
                            'Manual intervention required'
  # code_prep is only run the first time. Subsequent runs return the same value as the first time.
  rev = code_prep()
  if code_verify(rev):
    return

  fprint('Installing code (rev %s)' % rev)

  filename = 'viewfinder.%s.tar.gz' % rev
  dirname = 'viewfinder.%s' % rev

  put(filename, '~/%s' % filename)

  run('mkdir -p ~/%s' % dirname)
  # TODO: purge old pycs
  with cd('~/%s' % dirname):
    run('tar xzvf ../%s' % filename)
  # HACK: the local viewfinder/pythonpath directory has testing garbage in it,
  # so until we fix the push to use the hg manifest recreate it on the other
  # side instead of syncing it.
  run('mkdir -p ~/%s/pythonpath' % dirname)
  with cd('~/%s/pythonpath' % dirname):
    run('ln -f -s ~/%s viewfinder' % dirname)

  # Delete the tarball. We never reuse it anyway.
  run('rm -f ~/%s' % filename)

  # code_cleanup is run on the last invocation (based on the size of env.hosts).
  code_cleanup()
Install latest code from local directory.
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/code_install