def Update(self):
    """Updates and deploys a new appversion."""
    if len(self.args) != 1:
      self.parser.error('Expected a single <directory> argument.')

    basepath = self.args[0]
    appyaml = self._ParseAppYaml(basepath)
    rpc_server = self._GetRpcServer()

    updatecheck = self.update_check_class(rpc_server, appyaml)
    updatecheck.CheckForUpdates()

    appversion = AppVersionUpload(rpc_server, appyaml)
    appversion.DoUpload(FileIterator(basepath), self.options.max_size,
                        lambda path: open(os.path.join(basepath, path), 'rb'))

    index_defs = self._ParseIndexYaml(basepath)
    if index_defs:
      index_upload = IndexDefinitionUpload(rpc_server, appyaml, index_defs)
      try:
        index_upload.DoUpload()
      except urllib2.HTTPError, e:
        StatusUpdate('Error %d: --- begin server output ---\n'
                     '%s\n--- end server output ---' %
                     (e.code, e.read().rstrip('\n')))
        print >> self.error_fh, (
            'Your app was updated, but there was an error updating your '
            'indexes. Please retry later with appcfg.py update_indexes.')

    cron_entries = self._ParseCronYaml(basepath)
    if cron_entries:
      cron_upload = CronEntryUpload(rpc_server, appyaml, cron_entries)
      cron_upload.DoUpload()

    queue_entries = self._ParseQueueYaml(basepath)
    if queue_entries:
      queue_upload = QueueEntryUpload(rpc_server, appyaml, queue_entries)
      queue_upload.DoUpload()
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/tools/appcfg.py/AppCfgApp.Update/original