SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > pip > _internal > utils


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_internal/utils

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 0 bytes April 17 2025 13:10:58.
_jaraco_text.py File 3350 bytes April 17 2025 13:10:58.
_log.py File 1015 bytes April 17 2025 13:10:58.
appdirs.py File 1665 bytes April 17 2025 13:10:58.
compat.py File 2399 bytes April 17 2025 13:10:58.
compatibility_tags.py File 6272 bytes April 17 2025 13:10:58.
datetime.py File 242 bytes April 17 2025 13:10:58.
deprecation.py File 3707 bytes April 17 2025 13:10:58.
direct_url_helpers.py File 3196 bytes April 17 2025 13:10:58.
egg_link.py File 2463 bytes April 17 2025 13:10:58.
entrypoints.py File 3064 bytes April 17 2025 13:10:58.
filesystem.py File 4950 bytes April 17 2025 13:10:58.
filetypes.py File 716 bytes April 17 2025 13:10:58.
glibc.py File 3734 bytes April 17 2025 13:10:58.
hashes.py File 4972 bytes April 17 2025 13:10:58.
logging.py File 11845 bytes April 17 2025 13:10:58.
misc.py File 23450 bytes April 17 2025 13:10:58.
packaging.py File 2142 bytes April 17 2025 13:10:58.
retry.py File 1392 bytes April 17 2025 13:10:58.
setuptools_build.py File 4435 bytes April 17 2025 13:10:58.
subprocess.py File 8988 bytes April 17 2025 13:10:58.
temp_dir.py File 9310 bytes April 17 2025 13:10:58.
unpacking.py File 11967 bytes April 17 2025 13:10:58.
urls.py File 1599 bytes April 17 2025 13:10:58.
virtualenv.py File 3456 bytes April 17 2025 13:10:58.
wheel.py File 4494 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_internal/utils/egg_link.py

import os
import re
import sys
from typing import List, Optional

from pip._internal.locations import site_packages, user_site
from pip._internal.utils.virtualenv import (
    running_under_virtualenv,
    virtualenv_no_global,
)

__all__ = [
    "egg_link_path_from_sys_path",
    "egg_link_path_from_location",
]


def _egg_link_names(raw_name: str) -> List[str]:
    """
    Convert a Name metadata value to a .egg-link name, by applying
    the same substitution as pkg_resources's safe_name function.
    Note: we cannot use canonicalize_name because it has a different logic.

    We also look for the raw name (without normalization) as setuptools 69 changed
    the way it names .egg-link files (https://github.com/pypa/setuptools/issues/4167).
    """
    return [
        re.sub("[^A-Za-z0-9.]+", "-", raw_name) + ".egg-link",
        f"{raw_name}.egg-link",
    ]


def egg_link_path_from_sys_path(raw_name: str) -> Optional[str]:
    """
    Look for a .egg-link file for project name, by walking sys.path.
    """
    egg_link_names = _egg_link_names(raw_name)
    for path_item in sys.path:
        for egg_link_name in egg_link_names:
            egg_link = os.path.join(path_item, egg_link_name)
            if os.path.isfile(egg_link):
                return egg_link
    return None


def egg_link_path_from_location(raw_name: str) -> Optional[str]:
    """
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE
       (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2
    locations.

    This method will just return the first one found.
    """
    sites: List[str] = []
    if running_under_virtualenv():
        sites.append(site_packages)
        if not virtualenv_no_global() and user_site:
            sites.append(user_site)
    else:
        if user_site:
            sites.append(user_site)
        sites.append(site_packages)

    egg_link_names = _egg_link_names(raw_name)
    for site in sites:
        for egg_link_name in egg_link_names:
            egglink = os.path.join(site, egg_link_name)
            if os.path.isfile(egglink):
                return egglink
    return None

SILENT KILLER Tool