
    #j
              
         d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ erddlmZmZ  G d d	e	      Zdd
Zej"                  dd       ZddZedk(  rddlZ ej,                         Zej1                  d      sJ d        ede        ed eej4                                edd        e ej6                  ddej9                  dd      d         g      D ]  Z eed        yy)zPEP 656 support.

This module implements logic to detect if the currently running Python is
linked against musl, and what musl version is used.
    )annotationsN)TYPE_CHECKING
NamedTuple   )ELFFile)IteratorSequencec                  "    e Zd ZU ded<   ded<   y)_MuslVersionintmajorminorN)__name__
__module____qualname____annotations__     X/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/packaging/_musllinux.pyr   r      s    JJr   r   c                @   d | j                         D        D cg c]  }|s|	 }}t        |      dk  s|d   d d dk7  ry t        j                  d|d         }|sy t	        t        |j                  d            t        |j                  d                  S c c}w )	Nc              3  <   K   | ]  }|j                           y w)N)strip).0ns     r   	<genexpr>z&_parse_musl_version.<locals>.<genexpr>   s     @q@s      r      muslzVersion (\d+)\.(\d+)r   )r   r   )
splitlineslenrematchr   r   group)outputr   linesms       r   _parse_musl_versionr'      s    @F,=,=,?@F1AQFEF
5zA~q"1/
(%(3Ac!''!*oS_EE Gs
   BBc                ,   	 t        | d      5 }t        |      j                  }ddd       d|vryt        j                  |gdt        j                  d      }t        |j                        S # 1 sw Y   MxY w# t        t        t
        f$ r Y yw xY w)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
    rbNr   FT)checkstderrtext)openr   interpreterOSError	TypeError
ValueError
subprocessrunPIPEr'   r+   )
executablefldprocs       r   _get_musl_versionr9   $   s    *d# 	(q''B	( 
zV2%>>2$eJOO$ODt{{++	( 	(Y
+ s'   A< A0A< 0A95A< <BBc              #     K   t        t        j                        }|y| D ]5  }t        |j                  dd      D ]  }d|j
                   d| d|   7 y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__)r9   sysr5   ranger   r   )archssys_muslarchr   s       r   platform_tagsrC   ;   sh      !0H ?8>>2r2 	?Ex~~.awav>>	??s   AA__main__zlinux-z	not linuxzplat:zmusl:ztags: )endz[.-]r=   -r;   z
      )r$   strreturn_MuslVersion | None)r5   rH   rI   rJ   )r@   zSequence[str]rI   zIterator[str])__doc__
__future__r   	functoolsr!   r2   r>   typingr   r   _elffiler   collections.abcr   r	   r   r'   	lru_cacher9   rC   r   	sysconfigget_platformplat
startswithprintr5   subsplittr   r   r   <module>rZ      s    #  	  
 , 2: 
F , ,,?& z!9!!#D??8$1k1$	'4	'$S^^45	'sFBFF7CC1CB1GHIJ !aZ ! r   