def main():
  """Extract the deployment template from command line arguments,
  import it, gather the list files to package, and run the packer.
  """
  try:
    # Import the deploy template, as we must access its servers
    # list to search for python files to bundle for deployment.
    deploy_template = sys.argv[1]
    assert os.path.isfile(deploy_template), \
        "deployment template {0} is not a file".format(deploy_template)
    exec(open(deploy_template, 'rb'))

    deploy_name = os.path.splitext(os.path.basename(deploy_template))[0]
    package_out = os.path.join(os.path.dirname(deploy_template),
                               deploy_name + "_pkg.py")

    # Get the full list of deployed files
    files = _GetFilesRecursively("./")

    # Package the contents into a deployment executable.
    _Package(deploy_name, package_out, files)

    print "{0} deployment packaged into {1}".format(
      deploy_template, package_out)
    return 0

  except (IndexError, __HOLE__), err:
    print("Error: {0}, Usage: {1} <deploy-template>".format(
        str(err), os.path.basename(sys.argv[0])))
    return -1
dataset/ETHPy150Open viewfinderco/viewfinder/backend/prod/package.py/main