� ��^i_+���ddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd l m!Z!dd l"m#Z#erdd lm$Z$ne%Z$eeefZ&ej'e(��Z)Gd �d e$��Z*Gd�de$��Z+Gd�d��Z,Gd�de$��Z-Gd�de-��Z.Gd�de-��Z/dS)�N) �IO� TYPE_CHECKING� Collection� Container�Iterable�Iterator�List�Optional�Union)� Requirement)�InvalidSpecifier� SpecifierSet)�NormalizedName)� LegacyVersion�Version)�DIRECT_URL_METADATA_NAME� DirectUrl�DirectUrlValidationError)� stdlib_pkgs)�egg_link_path_from_sys_path)� url_to_path)�Protocolc�b�eZdZedefd���Zedefd���Zedefd���ZdS)�BaseEntryPoint�returnc��t����N��NotImplementedError��selfs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/metadata/base.py�namezBaseEntryPoint.name+���!�#�#�#�c��t���rrr s r"�valuezBaseEntryPoint.value/r$r%c��t���rrr s r"�groupzBaseEntryPoint.group3r$r%N)�__name__� __module__� __qualname__�property�strr#r'r)�r%r"rr*s������� �$�c�$�$�$��X�$��$�s�$�$�$��X�$��$�s�$�$�$��X�$�$�$r%rc��eZdZdefd�Zdefd�Zedeefd���Zedeefd���Z edeefd���Z ede fd���Z ede fd���Zedeefd ���Zedefd ���Zedefd ���Zedefd ���Zedefd ���Zedefd���Zdedefd�Zdeefd�Zedejjfd���Zedeefd���Zedefd���Z ede!fd���Z"dde#edee$fd�Z%deefd�Z&dS)�BaseDistributionrc�6�|j�d|j�d|j�d�S)N� z (�))�raw_name�version�locationr s r"�__repr__zBaseDistribution.__repr__9s'���-�B�B�$�,�B�B�$�-�B�B�B�Br%c�$�|j�d|j��S)Nr3)r5r6r s r"�__str__zBaseDistribution.__str__<s���-�0�0�$�,�0�0�0r%c��t���)a�Where the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. rr s r"r7zBaseDistribution.location?s��"�#�#�#r%c��|j}|r)|���rt|j��Snt |j��}|r|jSdS)z�The project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. N)� direct_url�is_local_editabler�urlrr5r7)r!r=� egg_link_paths r"�editable_project_locationz*BaseDistribution.editable_project_locationMsd���_� � � %��+�+�-�-� 3�"�:�>�2�2�2� 3� 8�� �F�F�M�� %��}�$��tr%c��t���)a'Location of the .[egg|dist]-info directory. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. rr s r"�info_directoryzBaseDistribution.info_directorycs��"�#�#�#r%c��t���rrr s r"�canonical_namezBaseDistribution.canonical_namesr$r%c��t���rrr s r"r6zBaseDistribution.versionwr$r%c�(� |�t��}n#t$rYdSwxYw tj|��S#t t jtf$r2}t� dt|j |��Yd}~dSd}~wwxYw)z�Obtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. NzError parsing %s for %s: %s) � read_textr�FileNotFoundErrorr� from_json�UnicodeDecodeError�json�JSONDecodeErrorr�logger�warningrE)r!�content�es r"r=zBaseDistribution.direct_url{s��� ��n�n�%=�>�>�G�G�� � � � ��4�4� ���� ��&�w�/�/� /�� � � � $� � � � � �N�N�-�(��#��  � � � �4�4�4�4�4����� ���s#�� +�+�A�B�'B � Bc��t���rrr s r"� installerzBaseDistribution.installer�r$r%c�*�t|j��Sr)�boolrAr s r"�editablezBaseDistribution.editable�s���D�2�3�3�3r%c��t���rrr s r"�localzBaseDistribution.local�r$r%c��t���rrr s r"� in_usersitezBaseDistribution.in_usersite�r$r%c��t���rrr s r"�in_site_packagesz!BaseDistribution.in_site_packages�r$r%r#c��t���)z�Read a file in the .dist-info (or .egg-info) directory. Should raise ``FileNotFoundError`` if ``name`` does not exist in the metadata directory. r�r!r#s r"rHzBaseDistribution.read_text���� "�#�#�#r%c��t���rrr s r"�iter_entry_pointsz"BaseDistribution.iter_entry_points����!�#�#�#r%c��t���)z?Metadata of distribution parsed from e.g. METADATA or PKG-INFO.rr s r"�metadatazBaseDistribution.metadata�s��"�#�#�#r%c�6�|j�d��S)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)rd�getr s r"�metadata_versionz!BaseDistribution.metadata_version�s���}� � �!3�4�4�4r%c�B�|j�d|j��S)z*Value of "Name:" in distribution metadata.�Name)rdrfrEr s r"r5zBaseDistribution.raw_name�s�� �}� � ���)<�=�=�=r%c�&�|j�d��}|�t��S tt|����}nH#t$r;}d}t �||j|��t��cYd}~Sd}~wwxYw|S)z�Value of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)rdrfrr.r rNrOr5)r!r'�specrQ�messages r"�requires_pythonz BaseDistribution.requires_python�s���� �!�!�"3�4�4�� �=��>�>� !� "���E� � �+�+�D�D��� "� "� "�E�G� �N�N�7�D�M�1� 5� 5� 5��>�>� !� !� !� !� !� !����� "����� s�A � B�0B �B� Br/�extrasc��t���)z�Dependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. r)r!rns r"�iter_dependenciesz"BaseDistribution.iter_dependencies�r_r%c��t���)z�Extras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. rr s r"�iter_provided_extrasz%BaseDistribution.iter_provided_extras�r_r%N)r/)'r*r+r,r.r8r:r-r r7rArCrrE�DistributionVersionr6rr=rSrUrVrXrZr\rHrrra�emailrl�Messagerdrgr5rrmrr rprrr/r%r"r1r18sD������C�#�C�C�C�C�1��1�1�1�1�� $�(�3�-� $� $� $��X� $���8�C�=�����X��*� $��� � $� $� $��X� $��$��$�$�$��X�$��$�,�$�$�$��X�$���H�Y�/�����X��2�$�3�$�$�$��X�$��4�$�4�4�4��X�4��$�t�$�$�$��X�$��$�T�$�$�$��X�$��$�$�$�$�$��X�$�$�c�$�c�$�$�$�$�$�8�N�#;�$�$�$�$��$�%�-�/�$�$�$��X�$��5�(�3�-�5�5�5��X�5��>�#�>�>�>��X�>� �������X��$$�$� �3��$��+�AV�$�$�$�$�$�h�s�m�$�$�$�$�$�$r%r1c���eZdZdZedd���Zedeeeddfd���Z dededfd�Z de dfd �Z de dfd �Z d ed d d fd edeedededede ef d�ZdS)�BaseEnvironmentz6An environment containing distributions to introspect.rc��t���rr)�clss r"�defaultzBaseEnvironment.default�r$r%�pathsc��t���rr)ryr{s r"� from_pathszBaseEnvironment.from_paths�r$r%r#r1c��t���)z=Given a requirement name, return the installed distributions.rr^s r"�get_distributionz BaseEnvironment.get_distribution�r$r%c��t���)aIterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. rr s r"�_iter_distributionsz#BaseEnvironment._iter_distributions�s��"�#�#�#r%c#��K�|���D]U}tjd|jtj���}|s't �d|j|j���Q|V��VdS)z(Iterate through installed distributions.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)�flagsz%Ignoring invalid distribution %s (%s)N)r��re�matchrE� IGNORECASErNrOr7)r!�dist�project_name_valids r"�iter_distributionsz"BaseEnvironment.iter_distributionss������,�,�.�.� � �D� "$��<��#��m�"�"�"� � &� ����;��'��M���� ��J�J�J�J�# � r%TF� local_only�skip�include_editables�editables_only� user_onlyc���|���}|r d�|D��}|s d�|D��}|r d�|D��}|r d�|D��}�fd�|D��S)aReturn a list of installed distributions. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. c3�(K�|] }|j� |V��dSr)rX��.0�ds r"� z?BaseEnvironment.iter_installed_distributions..+s)����+�+��1�7�+�!�+�+�+�+�+�+r%c3�(K�|] }|j� |V��dSr�rVr�s r"r�z?BaseEnvironment.iter_installed_distributions..-s)����2�2��q�z�2�!�2�2�2�2�2�2r%c3�(K�|] }|j� |V��dSrr�r�s r"r�z?BaseEnvironment.iter_installed_distributions../s)����.�.��1�:�.�!�.�.�.�.�.�.r%c3�(K�|] }|j� |V��dSr)rZr�s r"r�z?BaseEnvironment.iter_installed_distributions..1s)����1�1��1�=�1�!�1�1�1�1�1�1r%c3�.�K�|]}|j�v� |V��dSr)rE)r�r�r�s �r"r�z?BaseEnvironment.iter_installed_distributions..2s0�����>�>�a��!1��!=�!=��!=�!=�!=�!=�>�>r%)r�)r!r�r�r�r�r��its ` r"�iter_installed_distributionsz,BaseEnvironment.iter_installed_distributionss����&� $� $� &� &�� � ,�+�+�R�+�+�+�B� � 3�2�2�R�2�2�2�B� � /�.�.�R�.�.�.�B� � 2�1�1�R�1�1�1�B�>�>�>�>�2�>�>�>�>r%N)rrw)r*r+r,�__doc__� classmethodrzr r r.r}rrr�r�rrUrr1r�r/r%r"rwrw�sH������@�@��$�$�$��[�$��$�x��S� �2�$�7H�$�$�$��[�$�$�S�$�X�6H�-I�$�$�$�$�$�X�.@�%A�$�$�$�$��H�-?�$@�����. �*�"&�$�� ?�?��?���n�?� � ?� � ?� � ?� �"� #�?�?�?�?�?�?r%rwc�0�eZdZUeed<dejfd�ZdS)�Wheelr7rc��t���rrr s r"� as_zipfilezWheel.as_zipfile8rbr%N)r*r+r,r.�__annotations__�zipfile�ZipFiler�r/r%r"r�r�5s<��������M�M�M�$�G�O�$�$�$�$�$�$r%r�c�4�eZdZdeddfd�Zdejfd�ZdS)�FilesystemWheelr7rNc��||_dSr)r7)r!r7s r"�__init__zFilesystemWheel.__init__=s �� �� � � r%c�8�tj|jd���S�NT)� allowZip64)r�r�r7r s r"r�zFilesystemWheel.as_zipfile@s����t�}��>�>�>�>r%)r*r+r,r.r�r�r�r�r/r%r"r�r�<sS������!��!��!�!�!�!�?�G�O�?�?�?�?�?�?r%r�c�D�eZdZdedeeddfd�Zdejfd�Z dS)� MemoryWheelr7�streamrNc�"�||_||_dSr)r7r�)r!r7r�s r"r�zMemoryWheel.__init__Es�� �� ��� � � r%c�8�tj|jd���Sr�)r�r�r�r s r"r�zMemoryWheel.as_zipfileIs����t�{�t�<�<�<�r�s������� � � � ����� � � � ����� � � � � � � � � � � � � � � � � � � � � � �;�:�:�:�:�:�K�K�K�K�K�K�K�K�6�6�6�6�6�6�@�@�@�@�@�@�@�@����������� 3�2�2�2�2�2�D�D�D�D�D�D�0�0�0�0�0�0�����������H��M�7�2�3�� �� �8� $� $�� $� $� $� $� $�X� $� $� $�n$�n$�n$�n$�n$�x�n$�n$�n$�bI?�I?�I?�I?�I?�I?�I?�I?�X$�$�$�$�$�H�$�$�$�?�?�?�?�?�e�?�?�?�=�=�=�=�=�%�=�=�=�=�=r%