def build_manifest(self, target, template):
        # Optionally return a manifest to be included in the target executable.
        # Note for Python 2.6 and later, its *necessary* to include a manifest
        # which correctly references the CRT.  For earlier versions, a manifest
        # is optional, and only necessary to customize things like
        # Vista's User Access Control 'requestedExecutionLevel' setting, etc.
        default_manifest = """
            <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
                <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                  <security>
                    <requestedPrivileges>
                      <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
                    </requestedPrivileges>
                  </security>
                </trustInfo>
            </assembly>
        """
        from py2exe_util import load_resource
        if os.path.splitext(template)[1]==".exe":
            rid = 1
        else:
            rid = 2
        try:
            # Manfiests have resource type of 24, and ID of either 1 or 2.
            mfest = load_resource(ensure_unicode(template), RT_MANIFEST, rid)
            # we consider the manifest 'changed' as we know we clobber all
            # resources including the existing manifest - so this manifest must
            # get written even if we make no other changes.
            changed = True
        except __HOLE__:
            mfest = default_manifest
            # in this case the template had no existing manifest, so its
            # not considered 'changed' unless we make further changes later.
            changed = False
        # update the manifest according to our options.
        # for now a regex will do.
        if target.uac_info:
            changed = True
            if isinstance(target.uac_info, tuple):
                exec_level, ui = target.uac_info
            else:
                exec_level = target.uac_info
                ui = False
            new_lines = []
            for line in mfest.splitlines():
                repl = r'\1%s\3%s\5' % (exec_level, ui)
                new_lines.append(re.sub(pat_manifest_uac, repl, line))
            mfest = "".join(new_lines)
        if not changed:
            return None, None
        return mfest, rid
dataset/ETHPy150Open fogleman/FeedNotifier/patch/build_exe.py/py2exe.build_manifest