def move_wheel_files(<EOL>name,  <EOL>req,  <EOL>wheeldir,  <EOL>user=False,  <EOL>home=None,  <EOL>root=None,  <EOL>pycompile=True,  <EOL>scheme=None,  <EOL>isolated=False,  <EOL>prefix=None,  <EOL>warn_script_location=True  <EOL>):<EOL>
<EOL>if not scheme:<EOL><INDENT>scheme = distutils_scheme(<EOL>name, user=user, home=home, root=root, isolated=isolated,<EOL>prefix=prefix,<EOL>)<EOL><DEDENT>if root_is_purelib(name, wheeldir):<EOL><INDENT>lib_dir = scheme['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>lib_dir = scheme['<STR_LIT>']<EOL><DEDENT>info_dir = []  <EOL>data_dirs = []<EOL>source = wheeldir.rstrip(os.path.sep) + os.path.sep<EOL>installed = {}  <EOL>changed = set()<EOL>generated = []  <EOL>if pycompile:<EOL><INDENT>with captured_stdout() as stdout:<EOL><INDENT>with warnings.catch_warnings():<EOL><INDENT>warnings.filterwarnings('<STR_LIT:ignore>')<EOL>compileall.compile_dir(source, force=True, quiet=True)<EOL><DEDENT><DEDENT>logger.debug(stdout.getvalue())<EOL><DEDENT>def record_installed(srcfile, destfile, modified=False):<EOL><INDENT>"""<STR_LIT>"""<EOL>oldpath = normpath(srcfile, wheeldir)<EOL>newpath = normpath(destfile, lib_dir)<EOL>installed[oldpath] = newpath<EOL>if modified:<EOL><INDENT>changed.add(destfile)<EOL><DEDENT><DEDENT>def clobber(source, dest, is_base, fixer=None, filter=None):<EOL><INDENT>ensure_dir(dest)  <EOL>for dir, subdirs, files in os.walk(source):<EOL><INDENT>basedir = dir[len(source):].lstrip(os.path.sep)<EOL>destdir = os.path.join(dest, basedir)<EOL>if is_base and basedir.split(os.path.sep, <NUM_LIT:1>)[<NUM_LIT:0>].endswith('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>for s in subdirs:<EOL><INDENT>destsubdir = os.path.join(dest, basedir, s)<EOL>if is_base and basedir == '<STR_LIT>' and destsubdir.endswith('<STR_LIT>'):<EOL><INDENT>data_dirs.append(s)<EOL>continue<EOL><DEDENT>elif (is_base and<EOL>s.endswith('<STR_LIT>') and<EOL>canonicalize_name(s).startswith(<EOL>canonicalize_name(req.name))):<EOL><INDENT>assert not info_dir, ('<STR_LIT>' +<EOL>destsubdir + '<STR_LIT:U+002CU+0020>' +<EOL>'<STR_LIT:U+002CU+0020>'.join(info_dir))<EOL>info_dir.append(destsubdir)<EOL><DEDENT><DEDENT>for f in files:<EOL><INDENT>if filter and filter(f):<EOL><INDENT>continue<EOL><DEDENT>srcfile = os.path.join(dir, f)<EOL>destfile = os.path.join(dest, basedir, f)<EOL>ensure_dir(destdir)<EOL>if os.path.exists(destfile):<EOL><INDENT>os.unlink(destfile)<EOL><DEDENT>shutil.copyfile(srcfile, destfile)<EOL>st = os.stat(srcfile)<EOL>if hasattr(os, "<STR_LIT>"):<EOL><INDENT>os.utime(destfile, (st.st_atime, st.st_mtime))<EOL><DEDENT>if os.access(srcfile, os.X_OK):<EOL><INDENT>st = os.stat(srcfile)<EOL>permissions = (<EOL>st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH<EOL>)<EOL>os.chmod(destfile, permissions)<EOL><DEDENT>changed = False<EOL>if fixer:<EOL><INDENT>changed = fixer(destfile)<EOL><DEDENT>record_installed(srcfile, destfile, changed)<EOL><DEDENT><DEDENT><DEDENT>clobber(source, lib_dir, True)<EOL>assert info_dir, "<STR_LIT>" % req<EOL>ep_file = os.path.join(info_dir[<NUM_LIT:0>], '<STR_LIT>')<EOL>console, gui = get_entrypoints(ep_file)<EOL>def is_entrypoint_wrapper(name):<EOL><INDENT>if name.lower().endswith('<STR_LIT>'):<EOL><INDENT>matchname = name[:-<NUM_LIT:4>]<EOL><DEDENT>elif name.lower().endswith('<STR_LIT>'):<EOL><INDENT>matchname = name[:-<NUM_LIT:10>]<EOL><DEDENT>elif name.lower().endswith("<STR_LIT>"):<EOL><INDENT>matchname = name[:-<NUM_LIT:4>]<EOL><DEDENT>else:<EOL><INDENT>matchname = name<EOL><DEDENT>return (matchname in console or matchname in gui)<EOL><DEDENT>for datadir in data_dirs:<EOL><INDENT>fixer = None<EOL>filter = None<EOL>for subdir in os.listdir(os.path.join(wheeldir, datadir)):<EOL><INDENT>fixer = None<EOL>if subdir == '<STR_LIT>':<EOL><INDENT>fixer = fix_script<EOL>filter = is_entrypoint_wrapper<EOL><DEDENT>source = os.path.join(wheeldir, datadir, subdir)<EOL>dest = scheme[subdir]<EOL>clobber(source, dest, False, fixer=fixer, filter=filter)<EOL><DEDENT><DEDENT>maker = ScriptMaker(None, scheme['<STR_LIT>'])<EOL>maker.clobber = True<EOL>maker.variants = {'<STR_LIT>'}<EOL>maker.set_mode = True<EOL>def _get_script_text(entry):<EOL><INDENT>if entry.suffix is None:<EOL><INDENT>raise InstallationError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (entry, req)<EOL>)<EOL><DEDENT>return maker.script_template % {<EOL>"<STR_LIT>": entry.prefix,<EOL>"<STR_LIT>": entry.suffix.split("<STR_LIT:.>")[<NUM_LIT:0>],<EOL>"<STR_LIT>": entry.suffix,<EOL>}<EOL><DEDENT>maker._get_script_text = _get_script_text  <EOL>maker.script_template =
Install a wheel