def _get_sys_path_with_egglinks(sys_path):
 result = []
 for p in sys_path:
  for egg_link in sorted(glob.glob(os.path.join(p, '*.egg-link'))):
   with open(egg_link) as fd:
    for line in fd:
     line = line.strip()
     if line:
      result.append(os.path.join(p, line))
      break
  result.append(p)
 return result

def _get_sys_path_with_egglinks ( sys_path ) : result = [ ] for p in sys_path : for egg_link in sorted ( glob . glob ( os . path . join ( p , '*.egg-link' ) ) ) : with open ( egg_link ) as fd : for line in fd : line = line . strip ( ) if line : result . append ( os . path . join ( p , line ) ) break result . append ( p ) return result
find all paths including those referenced by egg-links .