'Updates a backend.'

def BackendsUpdate(self):

    self.backend = None
    if (len(self.args) == 1):
        self.backend = self.args[0]
    elif (len(self.args) > 1):
        self.parser.error('Expected    an    optional    <backend>    argument.')
    if (JavaSupported() and appcfg_java.IsWarFileWithoutYaml(self.basepath)):
        java_app_update = appcfg_java.JavaAppUpdate(self.basepath, self.options)
        self.options.compile_jsps = True
        sdk_root = os.path.dirname(appcfg_java.__file__)
        basepath = java_app_update.CreateStagingDirectory(sdk_root)
    else:
        basepath = self.basepath
    yaml_file_basename = 'app'
    appyaml = self._ParseAppInfoFromYaml(basepath, basename=yaml_file_basename)
    BackendsStatusUpdate(appyaml.runtime, self.error_fh)
    self.BackendsPhpCheck(appyaml)
    rpcserver = self._GetRpcServer()
    backends_to_update = self.BackendsYamlCheck(basepath, appyaml, self.backend)
    for backend in backends_to_update:
        self.UpdateVersion(rpcserver, basepath, appyaml, yaml_file_basename, backend=backend)
