@task
def virtualenv_verify(requirements_revision=None):
 req_rev = (requirements_revision or latest_requirements_revision())
 env_dir = ('env.%s' % req_rev)
 package_dir = ('python-package.%s' % req_rev)
 requirements_file = ('prod-requirements.txt.%s' % req_rev)
 with settings(warn_only=True):
  out = run(('~/%s/viewfinder/bin/pip install -f file://$HOME/%s --no-index -r ~/%s --no-install --no-download -q' % (env_dir, package_dir, requirements_file)))
 if (out.return_code == 0):
  fprint(('Valid virtual environment for prod-requirements (rev %s)' % req_rev))
  return True
 else:
  fprint(('Bad virtual environment for prod-requirements (rev %s)' % req_rev))
  return False

@ task def virtualenv_verify ( requirements_revision = None ) : req_rev = ( requirements_revision or latest_requirements_revision ( ) ) env_dir = ( 'env.%s' % req_rev ) package_dir = ( 'python-package.%s' % req_rev ) requirements_file = ( 'prod-requirements.txt.%s' % req_rev ) with settings ( warn_only = True ) : out = run ( ( '~/%s/viewfinder/bin/pip install -f file://$HOME/%s --no-index -r ~/%s --no-install --no-download -q' % ( env_dir , package_dir , requirements_file ) ) ) if ( out . return_code == 0 ) : fprint ( ( 'Valid virtual environment for prod-requirements (rev %s)' % req_rev ) ) return True else : fprint ( ( 'Bad virtual environment for prod-requirements (rev %s)' % req_rev ) ) return False
verify the virtual environment for a given revision .