'Updates and deploys a new appversion and global app configs.'

def Update(self):

    if (not os.path.isdir(self.basepath)):
        self.UpdateUsingSpecificFiles()
        return
    if (JavaSupported() and appcfg_java.IsWarFileWithoutYaml(self.basepath)):
        java_app_update = appcfg_java.JavaAppUpdate(self.basepath, self.options)
        self.options.compile_jsps = (not java_app_update.app_engine_web_xml.vm)
        sdk_root = os.path.dirname(appcfg_java.__file__)
        self.stage_dir = java_app_update.CreateStagingDirectory(sdk_root)
        try:
            appyaml = self._ParseAppInfoFromYaml(self.stage_dir, basename=os.path.splitext(APP_YAML_FILENAME)[0])
            self._UpdateWithParsedAppYaml(appyaml, self.stage_dir)
        finally:
            if self.options.retain_upload_dir:
                StatusUpdate(('Temporary    staging    directory    left    in    %s' % self.stage_dir), self.error_fh)
            else:
                shutil.rmtree(self.stage_dir)
    else:
        appyaml = self._ParseAppInfoFromYaml(self.basepath, basename=os.path.splitext(APP_YAML_FILENAME)[0])
        self._UpdateWithParsedAppYaml(appyaml, self.basepath)
