'Use pyinstaller to build a client package.'

def BuildWithPyInstaller(self):

    self.CleanDirectory(config.CONFIG.Get('PyInstaller.distpath', context=self.context))
    logging.info('Copying    pyinstaller    support    files')
    self.spec_file = os.path.join(self.build_dir, 'grr.spec')
    with open(self.spec_file, 'wb') as fd:
        fd.write(config.CONFIG.Get('PyInstaller.spec', context=self.context))
    with open(os.path.join(self.build_dir, 'version.txt'), 'wb') as fd:
        fd.write(config.CONFIG.Get('PyInstaller.version', context=self.context))
    with open(os.path.join(self.build_dir, 'grr.ico'), 'wb') as fd:
        fd.write(config.CONFIG.Get('PyInstaller.icon', context=self.context))
    self.output_dir = os.path.join(config.CONFIG.Get('PyInstaller.distpath', context=self.context), 'grr-client')
    args = ['--distpath', str(config.CONFIG.Get('PyInstaller.distpath', context=self.context)), '--workpath', str(config.CONFIG.Get('PyInstaller.workpath_dir', context=self.context)), str(self.spec_file)]
    logging.info('Running    pyinstaller:    %s', args)
    PyInstallerMain.run(pyi_args=[utils.SmartStr(x) for x in args])
    for path in ['tcl', 'tk', 'pytz']:
        dir_path = os.path.join(self.output_dir, path)
        try:
            shutil.rmtree(dir_path)
            os.mkdir(dir_path)
            with open(os.path.join(dir_path, path), 'wb'):
                pass
        except OSError:
            pass
    version_ini = config_lib.Resource().Filter('version.ini')
    if (not os.path.exists(version_ini)):
        raise RuntimeError(("Couldn't    find    version_ini    in    virtual    env    root:    %s" % version_ini))
    shutil.copy(version_ini, os.path.join(self.output_dir, 'version.ini'))
    with open(os.path.join(self.output_dir, 'build.yaml'), 'wb') as fd:
        self.WriteBuildYaml(fd)
