def addsitedir(sys_path, sitedir, known_paths=None):
 if (known_paths is None):
  known_paths = _init_pathinfo(sys_path)
  reset = 1
 else:
  reset = 0
 (sitedir, sitedircase) = makepath(sitedir)
 if (not (sitedircase in known_paths)):
  sys_path.append(sitedir)
  known_paths.add(sitedircase)
 try:
  names = os.listdir(sitedir)
 except OSError:
  return
 names = [name for name in names if name.endswith('.pth')]
 for name in sorted(names):
  addpackage(sys_path, sitedir, name, known_paths)
 if reset:
  known_paths = None
 return known_paths

def addsitedir ( sys_path , sitedir , known_paths = None ) : if ( known_paths is None ) : known_paths = _init_pathinfo ( sys_path ) reset = 1 else : reset = 0 ( sitedir , sitedircase ) = makepath ( sitedir ) if ( not ( sitedircase in known_paths ) ) : sys_path . append ( sitedir ) known_paths . add ( sitedircase ) try : names = os . listdir ( sitedir ) except OSError : return names = [ name for name in names if name . endswith ( '.pth' ) ] for name in sorted ( names ) : addpackage ( sys_path , sitedir , name , known_paths ) if reset : known_paths = None return known_paths
add sitedir argument to sys_path if missing and handle .