o
    g¹«j'  ã                   @  s†  U d dl mZ d dlZd dlZd dl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mZmZmZ e
rGd dlZd dlmZmZmZ dZdZd	Zh d
£ZejdAdd„ƒZdBdd„ZdBdd„ZdCdd„Ze dd„ ¡Z de!d< G dd „ d eƒZ"dDd"d#„Z#dDd$d%„Z$dDd&d'„Z%dEd)d*„Z&ej'dFd+d,„ƒZ(ej'dd-�dGd/d0„ƒZ)dHd3d4„Z*e"d5d6ƒd7e"d5d8ƒd9e"d5d:ƒd;iZ+d<e!d=< dId?d@„Z,dS )Jé    )ÚannotationsN)ÚTYPE_CHECKINGÚ
NamedTupleé   )ÚEIClassÚEIDataÚELFFileÚEMachine)Ú	GeneratorÚIteratorÚSequencel      ~ i   i   >   Úppc64Ús390xÚx86_64Úaarch64Úppc64leÚriscv64Úloongarch64ÚpathÚstrÚreturnú%Generator[ELFFile | None, None, None]c              
   c  sb   � zt | dƒ�}t|ƒV  W d   ƒ W d S 1 sw   Y  W d S  tttfy0   d V  Y d S w )NÚrb)Úopenr   ÚOSErrorÚ	TypeErrorÚ
ValueError)r   Úf© r   úT/var/www/html/laksyashrimp/venv/lib/python3.10/site-packages/packaging/_manylinux.pyÚ
_parse_elf!   s   €&ÿÿr    Ú
executableÚboolc                 C  sv   t | ƒ�-}|d uo(|jtjko(|jtjko(|jtj	ko(|j
t@ tko(|j
t@ tk	 W  d   ƒ S 1 s4w   Y  d S ©N)r    Úcapacityr   ÚC32Úencodingr   ÚLsbÚmachiner	   ÚArmÚflagsÚEF_ARM_ABIMASKÚEF_ARM_ABI_VER5ÚEF_ARM_ABI_FLOAT_HARD©r!   r   r   r   r   Ú_is_linux_armhf*   s   

ÿ
þ
ýüú$ÿr/   c                 C  sZ   t | ƒ�}|d uo|jtjko|jtjko|jtj	k	 W  d   ƒ S 1 s&w   Y  d S r#   )
r    r$   r   r%   r&   r   r'   r(   r	   ÚI386r.   r   r   r   Ú_is_linux_i6869   s   

ÿ
þ
ü$ÿr1   ÚarchsúSequence[str]c                 C  s2   d|v rt | ƒS d|v rt| ƒS tdd„ |D ƒƒS )NÚarmv7lÚi686c                 s  s   � | ]}|t v V  qd S r#   )Ú_ALLOWED_ARCHS)Ú.0Úarchr   r   r   Ú	<genexpr>H   s   € z'_have_compatible_abi.<locals>.<genexpr>)r/   r1   Úany)r!   r2   r   r   r   Ú_have_compatible_abiC   s
   r;   c                   C  s   dS )Né2   r   r   r   r   r   Ú<lambda>P   s    r=   zdict[int, int]Ú_LAST_GLIBC_MINORc                   @  s   e Zd ZU ded< ded< dS )Ú_GLibCVersionÚintÚmajorÚminorN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r   r   r   r   r?   S   s   
 r?   ú
str | Nonec                  C  sF   zt  d¡} | dusJ ‚|  ¡ \}}W |S  ttttfy"   Y dS w )zJ
    Primary implementation of glibc_version_string using os.confstr.
    ÚCS_GNU_LIBC_VERSIONN)ÚosÚconfstrÚrsplitÚAssertionErrorÚAttributeErrorr   r   )Úversion_stringÚ_Úversionr   r   r   Ú_glibc_version_string_confstrX   s   
ýþrQ   c                  C  sŒ   zddl } W n
 ty   Y dS w z|  d¡}W n
 ty"   Y dS w z|j}W n
 ty2   Y dS w | j|_|ƒ }t|t	ƒrD| 
d¡}|S )zG
    Fallback implementation of glibc_version_string using ctypes.
    r   NÚascii)ÚctypesÚImportErrorÚCDLLr   Úgnu_get_libc_versionrM   Úc_char_pÚrestypeÚ
isinstanceÚbytesÚdecode)rS   Úprocess_namespacerV   Úversion_strr   r   r   Ú_glibc_version_string_ctypesk   s(   ÿÿ
ý

r^   c                   C  s   t ƒ ptƒ S )z9Returns glibc version string, or None if not using glibc.)rQ   r^   r   r   r   r   Ú_glibc_version_string—   s   r_   r]   c                 C  sN   t  d| ¡}|stjd| › �tdd� tddƒS tt| d¡ƒt| d¡ƒƒS )a3  Parse glibc version.

    We use a regexp instead of str.split because we want to discard any
    random junk that might come after the minor version -- this might happen
    in patched/forked versions of glibc (e.g. Linaro's version of glibc
    uses version strings like "2.20-2014.11"). See gh-3588.
    z$(?P<major>[0-9]+)\.(?P<minor>[0-9]+)z;Expected glibc version with 2 components major.minor, got: é   )Ú
stackleveléÿÿÿÿrA   rB   )ÚreÚmatchÚwarningsÚwarnÚRuntimeWarningr?   r@   Úgroup)r]   Úmr   r   r   Ú_parse_glibc_versionœ   s   ý
rj   c                  C  s    t ƒ } | d u rtddƒS t| ƒS )Nrb   )r_   r?   rj   )r]   r   r   r   Ú_get_glibc_version¯   s   
rk   )Úmaxsizeútypes.ModuleType | Nonec                   C  s    zt dƒW S  ty   Y dS w )zÉReturn the ``_manylinux`` C extension module, or None if unavailable.

    The result is cached for the lifetime of the process, since the presence
    of the module does not change while running.
    Ú
_manylinuxN)Ú
__import__rT   r   r   r   r   Ú_get_manylinux_module¸   s
   
ÿrp   r8   rP   c                 C  sÂ   t ƒ }||k r	dS tƒ }|d u rdS t|dƒr,| |d |d | ¡}|d ur*t|ƒS dS |tddƒkr=t|dƒr=t|jƒS |tdd	ƒkrNt|d
ƒrNt|jƒS |tddƒkr_t|dƒr_t|jƒS dS )NFTÚmanylinux_compatibler   r   r`   é   Úmanylinux1_compatibleé   Úmanylinux2010_compatibleé   Úmanylinux2014_compatible)	rk   rp   Úhasattrrq   r"   r?   rs   ru   rw   )r8   rP   Ú	sys_glibcÚmanylinux_modÚresultr   r   r   Ú_is_compatibleÅ   s0   
ÿ
ÿ
ÿ
r|   r`   rv   Úmanylinux2014rt   Úmanylinux2010rr   Ú
manylinux1zdict[_GLibCVersion, str]Ú_LEGACY_MANYLINUX_MAPúIterator[str]c                 c  s  � t tj| ƒs	dS tddƒ}t| ƒddh@ rtddƒ}ttƒ Ž }|g}t|jd ddƒD ]}t| }| 	t||ƒ¡ q,| D ]B}|D ]=}|j|jkrM|j
}nd}t|j
|dƒD ]'}t|j|ƒ}	t||	ƒr}d	jg |	¢|‘R Ž V  t |	¡ }
r}|
› d
|› �V  qVqAq=dS )aÆ  Generate manylinux 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 manylinux-compatible.

    :returns: An iterator of compatible manylinux tags.
    Nr`   é   r   r5   é   r   rb   zmanylinux_{}_{}_{}rO   )r;   Úsysr!   r?   Úsetrk   ÚrangerA   r>   ÚappendrB   r|   Úformatr€   Úget)r2   Útoo_old_glibc2Úcurrent_glibcÚglibc_max_listÚglibc_majorÚglibc_minorr8   Ú	glibc_maxÚ	min_minorÚglibc_versionÚ
legacy_tagr   r   r   Úplatform_tagsë   s4   €



€ùúÿr“   )r   r   r   r   )r!   r   r   r"   )r!   r   r2   r3   r   r"   )r   rG   )r]   r   r   r?   )r   r?   )r   rm   )r8   r   rP   r?   r   r"   )r2   r3   r   r�   )-Ú
__future__r   ÚcollectionsÚ
contextlibÚ	functoolsrI   rc   r„   re   Útypingr   r   Ú_elffiler   r   r   r	   ÚtypesÚcollections.abcr
   r   r   r+   r,   r-   r6   Úcontextmanagerr    r/   r1   r;   Údefaultdictr>   rF   r?   rQ   r^   r_   rj   Ú	lru_cacherk   rp   r|   r€   r“   r   r   r   r   Ú<module>   sL    






,





ú
