a
    ç´«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
rŽd dlZd dlmZmZmZ dZdZd	Zh d
£Zejdddœdd„ƒZdddœdd„Zdddœdd„Zddddœdd„Ze dd„ ¡Z de!d< G dd„ deƒZ"d d!œd"d#„Z#d d!œd$d%„Z$d d!œd&d'„Z%ddd(œd)d*„Z&ej'dd!œd+d,„ƒZ(ej'dd-�d.d!œd/d0„ƒZ)dddd1œd2d3„Z*e"d4d5ƒd6e"d4d7ƒd8e"d4d9ƒd:iZ+d;e!d<< dd=d>œd?d@„Z,dS )Aé    )ÚannotationsN)ÚTYPE_CHECKINGÚ
NamedTupleé   )ÚEIClassÚEIDataÚELFFileÚEMachine)Ú	GeneratorÚIteratorÚSequencel      ~ i   i   >   Ús390xZloongarch64Zriscv64Úppc64leÚppc64Úx86_64Úaarch64Ústrz%Generator[ELFFile | None, None, None])ÚpathÚreturnc              
   c  s\   z8t | dƒ�}t|ƒV  W d   ƒ n1 s,0    Y  W n tttfyV   d V  Y n0 d S )NÚrb)Úopenr   ÚOSErrorÚ	TypeErrorÚ
ValueError)r   Úf© r   úS/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/packaging/_manylinux.pyÚ
_parse_elf!   s
    ,r   Úbool)Ú
executabler   c                 C  st   t | ƒ�X}|d uoP|jtjkoP|jtjkoP|jtj	koP|j
t@ tkoP|j
t@ tkW  d   ƒ S 1 sf0    Y  d S ©N)r   Úcapacityr   ÚC32Úencodingr   ÚLsbÚmachiner	   Z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  sX   t | ƒ�<}|d uo4|jtjko4|jtjko4|jtj	kW  d   ƒ S 1 sJ0    Y  d S r    )
r   r!   r   r"   r#   r   r$   r%   r	   ZI386r*   r   r   r   Ú_is_linux_i6869   s    

ÿ
þ
ür,   zSequence[str])r   Úarchsr   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   ó    z'_have_compatible_abi.<locals>.<genexpr>)r+   r,   Úany)r   r-   r   r   r   Ú_have_compatible_abiC   s
    r6   c                   C  s   dS )Né2   r   r   r   r   r   Ú<lambda>P   r4   r8   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:   z
str | None)r   c                  C  sH   z&t  d¡} | dusJ ‚|  ¡ \}}W n ttttfyB   Y dS 0 |S )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    
rK   c                  C  sŒ   zddl } W n ty    Y dS 0 z|  d¡}W n tyD   Y dS 0 z
|j}W n tyd   Y dS 0 | j|_|ƒ }t|t	ƒrˆ| 
d¡}|S )zG
    Fallback implementation of glibc_version_string using ctypes.
    r   NÚascii)ÚctypesÚImportErrorÚCDLLr   Úgnu_get_libc_versionrG   Úc_char_pÚrestypeÚ
isinstanceÚbytesÚdecode)rM   Úprocess_namespacerP   Úversion_strr   r   r   Ú_glibc_version_string_ctypesk   s"    


rX   c                   C  s   t ƒ p
tƒ S )z9Returns glibc version string, or None if not using glibc.)rK   rX   r   r   r   r   Ú_glibc_version_string—   s    rY   )rW   r   c                 C  sN   t  d| ¡}|s0t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éÿÿÿÿr<   r=   )ÚreÚmatchÚwarningsÚwarnÚRuntimeWarningr:   r;   Úgroup)rW   Úmr   r   r   Ú_parse_glibc_versionœ   s    ý
rd   c                  C  s    t ƒ } | d u rtddƒS t| ƒS )Nr\   )rY   r:   rd   )rW   r   r   r   Ú_get_glibc_version¯   s    
re   )Úmaxsizeztypes.ModuleType | Nonec                   C  s$   z
t dƒW S  ty   Y dS 0 dS )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__rN   r   r   r   r   Ú_get_manylinux_module¸   s    
ri   )r2   rJ   r   c                 C  sÂ   t ƒ }||k rdS tƒ }|d u r$dS t|dƒrX| |d |d | ¡}|d urTt|ƒS dS |tddƒkrzt|dƒrzt|jƒS |tdd	ƒkrœt|d
ƒrœt|jƒS |tddƒkr¾t|dƒr¾t|jƒS dS )NFTÚmanylinux_compatibler   r   rZ   é   Úmanylinux1_compatibleé   Úmanylinux2010_compatibleé   Úmanylinux2014_compatible)	re   ri   Úhasattrrj   r   r:   rl   rn   rp   )r2   rJ   Ú	sys_glibcZmanylinux_modÚresultr   r   r   Ú_is_compatibleÅ   s0    
ÿ
ÿ
ÿ
rt   rZ   ro   Úmanylinux2014rm   Úmanylinux2010rk   Ú
manylinux1zdict[_GLibCVersion, str]Ú_LEGACY_MANYLINUX_MAPzIterator[str])r-   r   c                 c  s  t tj| ƒsdS tddƒ}t| ƒddh@ r4tddƒ}ttƒ Ž }|g}t|jd ddƒD ]}t| }| 	t||ƒ¡ qV| D ]„}|D ]z}|j|jkr˜|j
}nd}t|j
|dƒD ]N}t|j|ƒ}	t||	ƒrªd	jg |	¢|‘R Ž V  t |	¡ }
rª|
› d
|› �V  qªq€qxd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.
    NrZ   é   r   r/   é   r   r\   zmanylinux_{}_{}_{}rI   )r6   Úsysr   r:   Úsetre   Úranger<   r9   Úappendr=   rt   Úformatrx   Úget)r-   Útoo_old_glibc2Úcurrent_glibcÚglibc_max_listÚglibc_majorÚglibc_minorr2   Ú	glibc_maxÚ	min_minorÚglibc_versionÚ
legacy_tagr   r   r   Úplatform_tagsë   s*    



rŠ   )-Ú
__future__r   ÚcollectionsÚ
contextlibÚ	functoolsrC   r]   r{   r_   Útypingr   r   Z_elffiler   r   r   r	   ÚtypesÚcollections.abcr
   r   r   r'   r(   r)   r0   Úcontextmanagerr   r+   r,   r6   Údefaultdictr9   rA   r:   rK   rX   rY   rd   Ú	lru_cachere   ri   rt   rx   rŠ   r   r   r   r   Ú<module>   sJ   
,



ú
