Current File : //usr/lib/python3/dist-packages/wheel/vendored/packaging/__pycache__/_musllinux.cpython-312.pyc
�

C�et
�
��dZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZGd�de�Zde
d	eefd
�Zej�de
d	eefd��Zd
e	e
d	ee
fd�Zedk(r�ddlZej(�Zej-d�sJd��ede�edeej0��edd��eej2ddej5dd�d��D]Zeed���yy)z�PEP 656 support.

This module implements logic to detect if the currently running Python is
linked against musl, and what musl version is used.
�N)�Iterator�
NamedTuple�Optional�Sequence�)�ELFFilec�"�eZdZUeed<eed<y)�_MuslVersion�major�minorN)�__name__�
__module__�__qualname__�int�__annotations__���E/usr/lib/python3/dist-packages/wheel/vendored/packaging/_musllinux.pyr
r
s���J��Jrr
�output�returnc�@�d�|j�D�D�cgc]}|s�|��	}}t|�dks|ddddk7rytjd|d�}|syt	t|j
d��t|j
d����Scc}w)	Nc3�<K�|]}|j����y�w)N)�strip)�.0�ns  r�	<genexpr>z&_parse_musl_version.<locals>.<genexpr>s����@�q�����@�s��r��muslzVersion (\d+)\.(\d+)r)rr)�
splitlines�len�re�matchr
r�group)rr�lines�ms    r�_parse_musl_versionr's���@�F�,=�,=�,?�@�F�1�A�Q�F�E�F�
�5�z�A�~��q��"�1���/��
���(�%��(�3�A����c�!�'�'�!�*�o�S������_�E�E��

Gs
�B�B�
executablec�*�	t|d�5}t|�j}ddd��d|vryt
j|gtjd��}t|j�S#1swY�LxYw#ttt
f$rYywxYw)a`Detect currently-running musl runtime version.

    This is done by checking the specified executable's dynamic linking
    information, and invoking the loader to parse its output for a version
    string. If the loader is musl, the output would be something like::

        musl libc (x86_64)
        Version 1.2.2
        Dynamic Program Loader
    �rbNrT)�stderr�text)�openr�interpreter�OSError�	TypeError�
ValueError�
subprocess�run�PIPEr'r+)r(�f�ld�procs    r�_get_musl_versionr8s����
�*�d�
#�	(�q����'�'�B�	(�
�z�V�2�%���>�>�2�$�z���T�B�D��t�{�{�+�+�	(�	(���Y�
�+����s'�A;�A/�A;�/A8�4A;�;B�B�archsc#�K�ttj�}|�y|D]5}t|jdd�D]}d|j
�d|�d|������7y�w)a�Generate musllinux tags compatible to the current platform.

    :param archs: Sequence of compatible architectures.
        The first one shall be the closest to the actual architecture and be the part of
        platform tag after the ``linux_`` prefix, e.g. ``x86_64``.
        The ``linux_`` prefix is assumed as a prerequisite for the current platform to
        be musllinux-compatible.

    :returns: An iterator of compatible musllinux tags.
    N����
musllinux_�_)r8�sysr(�rangerr)r9�sys_musl�archrs    r�
platform_tagsrB6sh����!����0�H�����?���8�>�>�2�r�2�	?�E��x�~�~�.�a��w�a��v�>�>�	?�?�s�AA�__main__zlinux-z	not linuxzplat:zmusl:ztags:� )�endz[.-]r=�-r;z
      )�__doc__�	functoolsr"r2r>�typingrrrr�_elffilerr
�strr'�	lru_cacher8rBr
�	sysconfig�get_platform�plat�
startswith�printr(�sub�split�trrr�<module>rUs3����	��
�;�;���:��
F��F���(>�F������,�#�,�(�<�*@�,��,�,?��#��?�8�C�=�?�&�z���!�9�!�!�#�D��?�?�8�$�1�k�1�$�	�'�4��	�'�$�S�^�^�4�5�	�'�s��
�6�2�6�6�'�3��
�
�3��0B�2�0F�G�
H�!��
�a�Z� �!�r