Generates the installer for this builder.
        
        :param      outpath | <str>

def generateInstaller(self, outpath='.', signed=False):
        """
        Generates the installer for this builder.
        
        :param      outpath | <str>
        """
        log.info('Generating Installer....')

        # generate the options for the installer
        opts = {
            'name': self.name(),
            'exname': self.executableName(),
            'version': self.version(),
            'company': self.company(),
            'language': self.language(),
            'license': self.license(),
            'platform': sys.platform,
            'product': self.productName(),
            'outpath': self.outputPath(),
            'instpath': self.installPath(),
            'instname': self.installName(),
            'buildpath': self.buildPath(),
            'srcpath': self.sourcePath(),
            'nsis_exe': os.environ['NSIS_EXE'],
            'signed': '',
            'signcmd': ''
        }

        basetempl = ''
        if self.runtime() and os.path.exists(self.distributionPath()):
            opts['compilepath'] = os.path.join(self.distributionPath(), self.executableName())
            basetempl = templ.NSISAPP

        elif os.path.isfile(self.sourcePath()):
            opts['compilepath'] = self.sourcePath()
            opts['install'] = templ.NSISMODULE.format(**opts)
            basetempl = templ.NSISLIB

        else:
            opts['compilepath'] = self.sourcePath()
            opts['install'] = templ.NSISPACKAGE.format(**opts)
            basetempl = templ.NSISLIB

        # sign the uninstaller
        if signed and self.signcmd():
            cmd = self.signcmd().format(filename='', cert=self.certificate())
            cmd = os.path.expandvars(cmd)
            cmd = cmd.replace('""', '')

            opts['signed'] = '!define SIGNED'
            opts['signcmd'] = cmd

        opts.update(self._installerOptions)

        # expand the plugin paths
        pre_section_plugins = []
        post_section_plugins = []
        install_plugins = []
        uninstall_plugins = []

        for filename in self.installerOption('pre_section_plugins', []):
            with open(filename, 'r') as f:
                pre_section_plugins.append(f.read().format(**opts))

        for filename in self.installerOption('post_section_plugins', []):
            with open(filename, 'r') as f:
                post_section_plugins.append(f.read().format(**opts))

        for filename in self.installerOption('install_section_plugins', []):
            with open(filename, 'r') as f:
                install_plugins.append(f.read().format(**opts))

        for filename in self.installerOption('uninstall_section_plugins', []):
            with open(filename, 'r') as f:
                uninstall_plugins.append(f.read().formst(**opts))

        opts['install_plugins'] = '\n'.join(install_plugins)
        opts['uninstall_plugins'] = '\n'.join(uninstall_plugins)
        opts['pre_section_plugins'] = '\n'.join(pre_section_plugins)
        opts['post_section_plugins'] = '\n'.join(post_section_plugins)
        opts['choose_directory'] = templ.NSISCHOOSEDIRECTORY if opts['choose_dir'] else ''

        req_license = self._installerOptions.pop('require_license_approval', False)
        if req_license:
            opts['require_license_approval'] = templ.NSISLICENSERADIO
        else:
            opts['require_license_approval'] = ''

        outfile = os.path.join(os.path.abspath(outpath), 'autogen.nsi')
        opts['__file__'] = outfile

        # update the additional directories
        addtl = []
        for directory, source in self._installDirectories.items():
            directory = os.path.expandvars(directory.format(**opts))
            directory = os.path.normpath(directory)

            if source:
                source = os.path.expandvars(source.format(**opts))
                source = os.path.abspath(source)

                addtl.append('    SetOutPath "{0}"'.format(directory))
                addtl.append('    File /nonfatal /r "{0}"'.format(source))
            else:
                addtl.append('    CreateDirectory "{0}"'.format(directory))

        opts['addtl_commands'] = '\n'.join(addtl)
        data = basetempl.format(**opts)

        # create the output file
        f = open(outfile, 'w')
        f.write(data)
        f.close()

        installerfile = os.path.join(self.outputPath(), self.installName())
        installerfile += '-{0}.exe'.format(sys.platform)

        # run the installer
        cmd = os.path.expandvars(self.installerOption('cmd'))
        success = cmdexec(cmd.format(script=outfile))

        # sign the installer
        if signed:
            self.sign(installerfile)

        log.info('Executing installer...')
        cmdexec(installerfile)