o|
T d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlm Z m
Z
ddgZdedefd Z
dedee fd
Zdedee fdZdS ) N)Optional)
site_packages user_site)running_under_virtualenvvirtualenv_no_globalegg_link_path_from_sys_pathegg_link_path_from_locationraw_namereturnc 4 t j dd| dz S )z
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.
z[^A-Za-z0-9.]+-z .egg-link)resub)r
s /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/egg_link.py_egg_link_namer s 6"C22[@@ c t | }t j D ]E}t j || }t j | r|c S FdS )zJ
Look for a .egg-link file for project name, by walking sys.path.
N)r syspathosjoinisfile)r
egg_link_name path_itemegg_links r r r s` #8,,MX 7<< =99
7>>(## OOO 4r c g }t rJ| t t s!t r| t n;t r| t | t t | }|D ]E}t j || }t j | r|c S FdS )a
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.
N)
r appendr r r r r r r r )r
sitesr siteegglinks r r r * s $
E!! $
]####%% $) $LL### $LL###
]###"8,,M ',,t]33
7>>'"" NNN 4r )r r r typingr pip._internal.locationsr r pip._internal.utils.virtualenvr r __all__strr r r r r