'Updates and deploys a new appversion.
Args:
rpcserver: An AbstractRpcServer instance on which RPC calls can be made.
basepath: The root directory of the version to update.
appyaml: The AppInfoExternal object parsed from an app.yaml-like file.
module_yaml_path: The (string) path to the yaml file, relative to the
bundle directory.
backend: The name of the backend to update, if any.
Returns:
An appinfo.AppInfoSummary if one was returned from the Deploy, None
otherwise.
Raises:
RuntimeError: If go-app-builder fails to generate a mapping from relative
paths to absolute paths, its stderr is raised.'

def UpdateVersion(self, rpcserver, basepath, appyaml, module_yaml_path, backend=None):

    runtime = appyaml.GetEffectiveRuntime()
    if (appyaml.vm and (self.options.called_by_gcloud or (runtime != 'go'))):
        self.options.precompilation = False
    elif (runtime == 'dart'):
        self.options.precompilation = False
    elif ((runtime == 'go') and (not self.options.precompilation)):
        logging.warning('Precompilation    is    required    for    Go    apps;    ignoring    --no_precompilation')
        self.options.precompilation = True
    elif (runtime.startswith('java') and (appinfo.JAVA_PRECOMPILED not in (appyaml.derived_file_type or []))):
        self.options.precompilation = False
    if (runtime in GCLOUD_ONLY_RUNTIMES):
        raise RuntimeError(("The    runtime:    '%s'    is    only    supported    with    gcloud." % runtime))
    if self.options.precompilation:
        if (not appyaml.derived_file_type):
            appyaml.derived_file_type = []
        if (appinfo.PYTHON_PRECOMPILED not in appyaml.derived_file_type):
            appyaml.derived_file_type.append(appinfo.PYTHON_PRECOMPILED)
    paths = self.file_iterator(basepath, appyaml.skip_files, appyaml.runtime)
    openfunc = (lambda path: self.opener(os.path.join(basepath, path), 'rb'))
    if (appyaml.GetEffectiveRuntime() == 'go'):
        if (appyaml.runtime == 'vm'):
            raise RuntimeError('The    Go    runtime    with    "vm:    true"    is    only    supported    with    gcloud.')
        sdk_base = os.path.normpath(os.path.join(google.appengine.__file__, '..', '..', '..'))
        gopath = os.environ.get('GOPATH')
        if (not gopath):
            gopath = os.path.join(sdk_base, 'gopath')
        goroot = os.path.join(sdk_base, 'goroot')
        if (not os.path.exists(goroot)):
            goroot = None
        gab = os.path.join(sdk_base, GO_APP_BUILDER)
        if os.path.exists(gab):
            app_paths = list(paths)
            go_files = [f for f in app_paths if (f.endswith('.go') and (not appyaml.nobuild_files.match(f)))]
            if (not go_files):
                raise RuntimeError('no    Go    source    files    to    upload    (-nobuild_files    applied)')
            gab_argv = [gab, '-api_version', appyaml.api_version, '-app_base', self.basepath, '-arch', '6', '-gopath', gopath, '-print_extras']
            if goroot:
                gab_argv.extend(['-goroot', goroot])
            if (appyaml.runtime == 'vm'):
                gab_argv.append('-vm')
            gab_argv.extend(go_files)
            env = {'GOOS': 'linux', 'GOARCH': 'amd64'}
            logging.info('Invoking    go-app-builder:    %s', '    '.join(gab_argv))
            try:
                p = subprocess.Popen(gab_argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
                (stdout, stderr) = p.communicate()
            except Exception as e:
                raise RuntimeError('failed    running    go-app-builder', e)
            if (p.returncode != 0):
                raise RuntimeError(stderr)
            overlay = dict([l.split('|') for l in stdout.split('\n') if l])
            logging.info('GOPATH    overlay:    %s', overlay)
            def Open(path):
                if (path in overlay):
                    return self.opener(overlay[path], 'rb')
                return self.opener(os.path.join(basepath, path), 'rb')
            paths = (app_paths + overlay.keys())
            openfunc = Open
    appversion = AppVersionUpload(rpcserver, appyaml, module_yaml_path=module_yaml_path, backend=backend, error_fh=self.error_fh, usage_reporting=self.options.usage_reporting, ignore_endpoints_failures=self.options.ignore_endpoints_failures)
    return appversion.DoUpload(paths, openfunc)
