o
    Ñ­jW%  ã                   @  sX  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mZmZ ddlmZmZmZmZ dZdZdZh d	£Zejd<dd„ƒZd=dd„Zd=dd„Zd>dd„Ze dd„ ¡Zded< G dd„ deƒZd?d!d"„Z d?d#d$„Z!d?d%d&„Z"d@d(d)„Z#ej$dAd*d+„ƒZ%dBd.d/„Z&ed0d1ƒd2ed0d3ƒd4ed0d5ƒd6iZ'd7ed8< dCd:d;„Z(dS )Dé    )ÚannotationsN)Ú	GeneratorÚIteratorÚ
NamedTupleÚSequenceé   )ÚEIClassÚEIDataÚELFFileÚEMachinel      ~ 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   úQ/var/www/html/CropPilot/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_i6867   s   

ÿ
þ
ü$ÿr0   Ú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>F   s   € z'_have_compatible_abi.<locals>.<genexpr>)r.   r0   Úany)r    r1   r   r   r   Ú_have_compatible_abiA   s
   r:   c                   C  s   dS )Né2   r   r   r   r   r   Ú<lambda>N   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>   Q   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_confstrV   s   
ýþrP   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	ƒsD| 
d¡}|S )zG
    Fallback implementation of glibc_version_string using ctypes.
    r   NÚascii)ÚctypesÚImportErrorÚCDLLr   Úgnu_get_libc_versionrL   Úc_char_pÚrestypeÚ
isinstancer   Údecode)rR   Úprocess_namespacerU   Úversion_strr   r   r   Ú_glibc_version_string_ctypesi   s(   ÿÿ
ý

r\   c                   C  s   t ƒ ptƒ S )z9Returns glibc version string, or None if not using glibc.)rP   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éÿÿÿÿr@   rA   )ÚreÚmatchÚwarningsÚwarnÚRuntimeWarningr>   r?   Úgroup)r[   Úmr   r   r   Ú_parse_glibc_versionš   s   ý
rh   c                  C  s    t ƒ } | d u rtddƒS t| ƒS )Nr`   )r]   r>   rh   )r[   r   r   r   Ú_get_glibc_version­   s   
ri   r7   rO   c                 C  sÒ   t ƒ }||k r	dS zdd l}W n
 ty   Y dS w t|dƒr4| |d |d | ¡}|d ur2t|ƒS dS |tddƒkrEt|dƒrEt|jƒS |tdd	ƒkrVt|d
ƒrVt|jƒS |tddƒkrgt|dƒrgt|j	ƒS dS )NFr   TÚmanylinux_compatibler   r^   é   Úmanylinux1_compatibleé   Úmanylinux2010_compatibleé   Úmanylinux2014_compatible)
ri   Ú
_manylinuxrS   Úhasattrrj   r!   r>   rl   rn   rp   )r7   rO   Ú	sys_glibcrq   Úresultr   r   r   Ú_is_compatible¶   s0   ÿ

ÿ
ÿ
ru   r^   ro   Úmanylinux2014rm   Úmanylinux2010rk   Ú
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   r4   é   r   r`   zmanylinux_{}_{}_{}rN   )r:   Úsysr    r>   Úsetri   Úranger@   r=   ÚappendrA   ru   Úformatry   Úget)r1   Útoo_old_glibc2Úcurrent_glibcÚglibc_max_listÚglibc_majorÚglibc_minorr7   Ú	glibc_maxÚ	min_minorÚglibc_versionÚ
legacy_tagr   r   r   Úplatform_tagsÛ   s4   €



€ùúÿrŒ   )r   r   r   r   )r    r   r   r!   )r    r   r1   r2   r   r!   )r   rF   )r[   r   r   r>   )r   r>   )r7   r   rO   r>   r   r!   )r1   r2   r   rz   ))Ú
__future__r   ÚcollectionsÚ
contextlibÚ	functoolsrH   ra   r}   rc   Útypingr   r   r   r   Ú_elffiler   r	   r
   r   r*   r+   r,   r5   Úcontextmanagerr   r.   r0   r:   Údefaultdictr=   rE   r>   rP   r\   r]   rh   Ú	lru_cacheri   ru   ry   rŒ   r   r   r   r   Ú<module>   sB    



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