� ��^i����ddlZddlZddlZddlmZddlmZmZddlm Z m Z ddgZ de de fd �Z de dee fd �Zde dee fd �ZdS) �N)�Optional)� site_packages� user_site)�running_under_virtualenv�virtualenv_no_global�egg_link_path_from_sys_path�egg_link_path_from_location�raw_name�returnc�4�tjdd|��dzS)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)�re�sub)r s ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/egg_link.py�_egg_link_namers�� �6�"�C�� 2� 2�[� @�@�c���t|��}tjD]E}tj�||��}tj�|��r|cS�FdS)zJ Look for a .egg-link file for project name, by walking sys.path. N)r�sys�path�os�join�isfile)r � egg_link_name� path_item�egg_links rrrs`��#�8�,�,�M��X��� ��7�<�<� �=�9�9�� �7�>�>�(� #� #� ��O�O�O� � �4rc���g}t��rJ|�t��t��s!tr|�t��n;tr|�t��|�t��t |��}|D]E}t j�||��}t j� |��r|cS�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�appendrrrrrrrr)r �sitesr�site�egglinks rr r *s���$ �E��!�!�$� � � �]�#�#�#�#�%�%� $�)� $� �L�L�� #� #� #�� � $� �L�L�� #� #� #� � � �]�#�#�#�"�8�,�,�M������'�,�,�t�]�3�3�� �7�>�>�'� "� "� ��N�N�N� � �4r)rrr�typingr�pip._internal.locationsrr�pip._internal.utils.virtualenvrr�__all__�strrrr �rr�r's�� � � � � � � � � � � � �������<�<�<�<�<�<�<�<��������� "�!� �� A�S�A�S�A�A�A�A� �#� �(�3�-� � � � �!�#�!�(�3�-�!�!�!�!�!�!r