def _copy_searchtools(self, renderer=None):
log.info(bold('<STR_LIT>'), nonl=True)<EOL>if sphinx.version_info < (<NUM_LIT:1>, <NUM_LIT:8>):<EOL><INDENT>search_js_file = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>search_js_file = '<STR_LIT>'<EOL><DEDENT>path_src = os.path.join(<EOL>package_dir, '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', search_js_file<EOL>)<EOL>if os.path.exists(path_src):<EOL><INDENT>path_dest = os.path.join(self.outdir, '<STR_LIT>', '<STR_LIT>')<EOL>if renderer is None:<EOL><INDENT>if sphinx.version_info < (<NUM_LIT:1>, <NUM_LIT:5>):<EOL><INDENT>renderer = self.templates<EOL><DEDENT>else:<EOL><INDENT>from sphinx.util.template import SphinxRenderer<EOL>renderer = SphinxRenderer()<EOL><DEDENT><DEDENT>with codecs.open(path_src, '<STR_LIT:r>', encoding='<STR_LIT:utf-8>') as h_src:<EOL><INDENT>with codecs.open(path_dest, '<STR_LIT:w>', encoding='<STR_LIT:utf-8>') as h_dest:<EOL><INDENT>data = h_src.read()<EOL>data = self.REPLACEMENT_PATTERN.sub(self.REPLACEMENT_TEXT, data)<EOL>h_dest.write(renderer.render_string(<EOL>data,<EOL>self.get_static_readthedocs_context()<EOL>))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>log.warning('<STR_LIT>'.format(search_js_file))<EOL><DEDENT>log.info('<STR_LIT>')<EOL>
Copy and patch searchtools

        This uses the included Sphinx version's searchtools, but patches it to
        remove automatic initialization. This is a fork of
        ``sphinx.util.fileutil.copy_asset``