def _MergeBuiltinsIncludes(appinfo_path, appyaml, open_fn=open): """Merges app.yaml files from builtins and includes directives in appyaml. Args: appinfo_path: the application directory. appyaml: the yaml file to obtain builtins and includes directives from. open_fn: file opening function to pass to _ResolveIncludes, used when reading yaml files. Returns: A tuple where the first element is the modified appyaml object incorporating the referenced yaml files, and the second element is a list of the absolute paths of the included files, in no particular order. """ # If no builtin handlers are defined, initialize a BuiltinHandler object # with "default: on". if not appyaml.builtins: appyaml.builtins = [appinfo.BuiltinHandler(default='on')] # Turn on defaults if not included in config. else: if not appinfo.BuiltinHandler.IsDefined(appyaml.builtins, 'default'): appyaml.builtins.append(appinfo.BuiltinHandler(default='on')) # Returns result of merging all discovered AppInclude objects. # TODO(user): Stop using vm_settings.vm_runtime. b/9513210. runtime_for_including = appyaml.runtime if runtime_for_including == 'vm': runtime_for_including = appyaml.vm_settings.get( 'vm_runtime', 'python27') aggregate_appinclude, include_paths = (_ResolveIncludes( appinfo_path, appinfo.AppInclude(builtins=appyaml.builtins, includes=appyaml.includes), os.path.dirname(appinfo_path), runtime_for_including, open_fn=open_fn)) return (appinfo.AppInclude.MergeAppYamlAppInclude(appyaml, aggregate_appinclude), include_paths)
def __init__(self): self.includes = {} self.excludes = {} self.aggregate_appinclude = appinfo.AppInclude()