
    Dgt
              
       X   d Z ddlZddlZddlZddlZddlmZmZmZm	Z	 ddl
mZ  G d de          Zded	ee         fd
Z ej                    ded	ee         fd            Zde	e         d	ee         fdZedk    rddlZ ej                    Ze                    d          s
J d             ede            ed eej                              edd            e ej        dde                    dd          d                             D ]Z eed           dS dS )zPEP 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                   $    e Zd ZU eed<   eed<   dS )_MuslVersionmajorminorN)__name__
__module____qualname__int__annotations__     I/var/www/sysmax/venv/lib/python3.11/site-packages/packaging/_musllinux.pyr
   r
      s"         JJJJJJJJr   r
   outputreturnc                    d d |                                  D             D             }t          |          dk     s|d         d d         dk    rd S t          j        d|d                   }|sd S t	          t          |                    d                    t          |                    d                    	          S )
Nc                     g | ]}||S r   r   .0ns     r   
<listcomp>z'_parse_musl_version.<locals>.<listcomp>   s    FFF1AFQFFFr   c              3   >   K   | ]}|                                 V  d S )N)stripr   s     r   	<genexpr>z&_parse_musl_version.<locals>.<genexpr>   s*      @@q@@@@@@r      r      muslzVersion (\d+)\.(\d+)r   )r   r   )
splitlineslenrematchr
   r   group)r   linesms      r   _parse_musl_versionr*      s    FF@@F,=,=,?,?@@@FFFE
5zzA~~q"1"//t
(%(33A tc!''!**ooS__EEEEr   
executablec                 6   	 t          | d          5 }t          |          j        }ddd           n# 1 swxY w Y   n# t          t          t
          f$ r Y dS w xY w|d|vrdS t          j        |gt          j        d          }t          |j
                  S )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"   T)stderrtext)openr   interpreterOSError	TypeError
ValueError
subprocessrunPIPEr*   r.   )r+   fldprocs       r   _get_musl_versionr;      s    *d## 	(q'B	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(Y
+   tt	zV2%%t>2$zTBBBDt{+++s'   ? 3? 7? 7? AAarchsc              #      K   t          t          j                  }|dS | D ]-}t          |j        dd          D ]}d|j         d| d| V  .dS )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__)r;   sysr+   ranger   r   )r<   sys_muslarchr   s       r   platform_tagsrE   6   s       !00H ? ?8>2r22 	? 	?E>x~>>>>>>>>>>	?? ?r   __main__zlinux-z	not linuxzplat:zmusl:ztags: )endz[.-]r@   -r>   z
      )__doc__	functoolsr%   r5   rA   typingr   r   r   r   _elffiler   r
   strr*   	lru_cacher;   rE   r   	sysconfigget_platformplat
startswithprintr+   subsplittr   r   r   <module>rX      s'        				     



 ; ; ; ; ; ; ; ; ; ; ; ;          :   
F F(> F F F F ,# ,(<*@ , , , ,,?# ?8C= ? ? ? ?& z!9!##D??8$$11k111	E'4	E'$$S^44555	E's]626'3

30B0B20FGGHH ! !aZ      ! !r   