(home_dir, sys_path=None)
Makes .pth and .egg-link files use relative paths
Makes .pth and .egg-link files use relative paths
Makes . pth and . egg - link files use relative paths
def fixup_pth_and_egg_link(home_dir, sys_path=None):
    """Makes .pth and .egg-link files use relative paths"""
    home_dir = os.path.normcase(os.path.abspath(home_dir))
    if sys_path is None:
        sys_path = sys.path
    for path in sys_path:
        if not path:
            path = '.'
        if not os.path.isdir(path):
            continue
        path = os.path.normcase(os.path.abspath(path))
        if not path.startswith(home_dir):
            logger.debug('Skipping system (non-environment) directory %s' % path)
            continue
        for filename in os.listdir(path):
            filename = os.path.join(path, filename)
            if filename.endswith('.pth'):
                if not os.access(filename, os.W_OK):
                    logger.warn('Cannot write .pth file %s, skipping' % filename)
                else:
                    fixup_pth_file(filename)
            if filename.endswith('.egg-link'):
                if not os.access(filename, os.W_OK):
                    logger.warn('Cannot write .egg-link file %s, skipping' % filename)
                else:
                    fixup_egg_link(filename)
def fixup_pth_and_egg_link ( home_dir , sys_path = None ) : home_dir = os . path . normcase ( os . path . abspath ( home_dir ) ) if sys_path is None : sys_path = sys . path for path in sys_path : if not path : path = '.' if not os . path . isdir ( path ) : continue path = os . path . normcase ( os . path . abspath ( path ) ) if not path . startswith ( home_dir ) : logger . debug ( 'Skipping system (non-environment) directory %s' % path ) continue for filename in os . listdir ( path ) : filename = os . path . join ( path , filename ) if filename . endswith ( '.pth' ) : if not os . access ( filename , os . W_OK ) : logger . warn ( 'Cannot write .pth file %s, skipping' % filename ) else : fixup_pth_file ( filename ) if filename . endswith ( '.egg-link' ) : if not os . access ( filename , os . W_OK ) : logger . warn ( 'Cannot write .egg-link file %s, skipping' % filename ) else : fixup_egg_link ( filename )