Ë
    æØjj“
  ã            
      óÖ  — 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	m
Z
 ddlmZ  G d„ de	«      Zdd	„Zej                  dd
„«       Zdd„Zedk(  r–ddlZ ej(                  «       Zej-                  d«      sJ d«       ‚ ede«        ed eej0                  «      «        edd¬«        e ej2                  ddej5                  dd«      d   «      «      D ]  Z eed¬«       Œ yy)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.
é    )ÚannotationsN)ÚIteratorÚ
NamedTupleÚSequenceé   )ÚELFFilec                  ó"   — e Zd ZU ded<   ded<   y)Ú_MuslVersionÚintÚmajorÚminorN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© ó    úV/opt/eval-harness/bench_task/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×,=Ñ,=Ó,?Ô@ÖF�1ÂAŠQÐF€EÐFÜ
ˆ5ƒz�A‚~˜˜q™ " 1˜¨Ò/ØÜ
�‰Ð(¨%°©(Ó3€AÙØÜœc !§'¡'¨!£*›o´S¸¿¹À»³_Ô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_versionr8   !   s‰   € ðÜ�*˜dÓ#ð 	( qÜ˜“×'Ñ'ˆB÷	(ð 
€z�V 2Ñ%ØÜ�>‰>˜2˜$ e´J·O±OÈ$ÔO€DÜ˜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_Ú_)r8   Úsysr4   Úranger   r   )ÚarchsÚsys_muslÚarchr   s       r   Úplatform_tagsrB   8   sh   è ø€ ô !¤§¡Ó0€HØÐØØò ?ˆÜ˜8Ÿ>™>¨2¨rÓ2ò 	?ˆEØ˜xŸ~™~Ð.¨a°¨w°a¸°vÐ>Ó>ñ	?ñ?ùs   ‚AAÚ__main__zlinux-z	not linuxzplat:zmusl:ztags:ú )Úendz[.-]r<   ú-r:   z
      )r#   ÚstrÚreturnú_MuslVersion | None)r4   rG   rH   rI   )r?   zSequence[str]rH   zIterator[str])Ú__doc__Ú
__future__r   Ú	functoolsr    r1   r=   Útypingr   r   r   Ú_elffiler   r
   r&   Ú	lru_cacher8   rB   r   Ú	sysconfigÚget_platformÚplatÚ
startswithÚprintr4   ÚsubÚsplitÚtr   r   r   ú<module>rX      só   ðñõ #ã Û 	Û Û 
ß 1Ñ 1å ô�:ô ó
Fð ×Ñò,ó ð,ó,?ð& ˆ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   