(sitedir, known_paths=None)
return known_paths
Add 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir
Add 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir
Add sitedir argument to sys . path if missing and handle . pth files in sitedir
def addsitedir(sitedir, known_paths=None):
    """Add 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir'"""
    _trace(f"Adding directory: {sitedir!r}")
    if known_paths is None:
        known_paths = _init_pathinfo()
        reset = True
    else:
        reset = False
    sitedir, sitedircase = makepath(sitedir)
    if not sitedircase in known_paths:
        sys.path.append(sitedir)        # Add path component
        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(sitedir, name, known_paths)
    if reset:
        known_paths = None
    return known_paths
def addsitedir ( sitedir , known_paths = None ) : _trace ( f"Adding directory: {sitedir!r}" ) if known_paths is None : known_paths = _init_pathinfo ( ) reset = True else : reset = False sitedir , sitedircase = makepath ( sitedir ) if not sitedircase in known_paths : sys . path . append ( sitedir ) # Add path component 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 ( sitedir , name , known_paths ) if reset : known_paths = None return known_paths