'Write build rules for bundle Info.plist files.'

def WriteMacInfoPlist(self, partial_info_plist, bundle_depends):

    (info_plist, out, defines, extra_env) = gyp.xcode_emulation.GetMacInfoPlist(generator_default_variables['PRODUCT_DIR'], self.xcode_settings, self.GypPathToNinja)
    if (not info_plist):
        return
    out = self.ExpandSpecial(out)
    if defines:
        intermediate_plist = self.GypPathToUniqueOutput(os.path.basename(info_plist))
        defines = '    '.join([Define(d, self.flavor) for d in defines])
        info_plist = self.ninja.build(intermediate_plist, 'preprocess_infoplist', info_plist, variables=[('defines', defines)])
    env = self.GetSortedXcodeEnv(additional_settings=extra_env)
    env = self.ComputeExportEnvString(env)
    if partial_info_plist:
        intermediate_plist = self.GypPathToUniqueOutput('merged_info.plist')
        info_plist = self.ninja.build(intermediate_plist, 'merge_infoplist', [partial_info_plist, info_plist])
    keys = self.xcode_settings.GetExtraPlistItems(self.config_name)
    keys = QuoteShellArgument(json.dumps(keys), self.flavor)
    isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name)
    self.ninja.build(out, 'copy_infoplist', info_plist, variables=[('env', env), ('keys', keys), ('binary', isBinary)])
    bundle_depends.append(out)
