def fix_local_scheme(home_dir, symlink=True):
try:<EOL><INDENT>import sysconfig<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if sysconfig._get_default_scheme() == '<STR_LIT>':<EOL><INDENT>local_path = os.path.join(home_dir, '<STR_LIT>')<EOL>if not os.path.exists(local_path):<EOL><INDENT>os.mkdir(local_path)<EOL>for subdir_name in os.listdir(home_dir):<EOL><INDENT>if subdir_name == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>copyfile(os.path.abspath(os.path.join(home_dir, subdir_name)),os.path.join(local_path, subdir_name), symlink)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Platforms that use the "posix_local" install scheme (like Ubuntu with
Python 2.7) need to be given an additional "local" location, sigh.