o
    g6%                     @   s  U 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mZmZmZ ddlmZmZmZmZ dZdZdZejded	e	ee ddf fd
dZded	efddZded	efddZdedee d	efddZe dd Zee e f e!d< G dd deZ"d	ee fddZ#d	ee fddZ$d	ee fddZ%ded	ee e f fd d!Z&e' d	ee e f fd"d#Z(d$ed%e"d	efd&d'Z)d(d)d*d+Z*dee d	e
e fd,d-Z+dS ).    N)Dict	GeneratorIterator
NamedTupleOptionalSequenceTuple   )EIClassEIDataELFFileEMachinel      ~ i   i   pathreturnc              
   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   a/var/www/html/portale_awareness/portale-venv/lib/python3.10/site-packages/packaging/_manylinux.py
_parse_elf   s   &r   
executablec                 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_i686+   s   



$r(   archsc                    s>   d|v rt | S d|v rt| S h d t fdd|D S )Narmv7li686>   ppc64s390xx86_64aarch64ppc64leloongarch64c                 3   s    | ]}| v V  qd S r   r   ).0archallowed_archsr   r   	<genexpr>;   s    z'_have_compatible_abi.<locals>.<genexpr>)r&   r(   any)r   r)   r   r4   r   _have_compatible_abi5   s   r8   c                   C   s   dS )N2   r   r   r   r   r   <lambda>C   s    r:   _LAST_GLIBC_MINORc                   @   s   e Zd ZU eed< eed< dS )_GLibCVersionmajorminorN)__name__
__module____qualname__int__annotations__r   r   r   r   r<   F   s   
 r<   c                  C   sJ   zt td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.
    confstrCS_GNU_LIBC_VERSIONN)getattrosrsplitAssertionErrorAttributeErrorr   r   )version_string_versionr   r   r   _glibc_version_string_confstrK   s   rN   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_versionrJ   c_char_prestype
isinstancestrdecode)rP   process_namespacerS   version_strr   r   r   _glibc_version_string_ctypes^   s(   


r[   c                   C   s   t  pt S )z9Returns glibc version string, or None if not using glibc.)rN   r[   r   r   r   r   _glibc_version_string   s   r\   rZ   c                 C   sB   t d| }|std|  t dS t|dt|df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: r^   r=   r>   )rematchwarningswarnRuntimeWarningrB   group)rZ   mr   r   r   _parse_glibc_version   s   rf   c                  C   s   t  } | d u r	dS t| S )Nr]   )r\   rf   )rZ   r   r   r   _get_glibc_version   s   rg   r3   rM   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	         manylinux1_compatible   manylinux2010_compatible   manylinux2014_compatible)
rg   
_manylinuxrQ   hasattrrh   boolr<   rk   rm   ro   )r3   rM   	sys_glibcrp   resultr   r   r   _is_compatible   s.   






ru   manylinux2014manylinux2010
manylinux1))ri   rn   )ri   rl   )ri   rj   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 ]J}|D ]E}|j|jkrM|j
}nd}t|j
|dD ]/}t|j|}	d	j|	 }
t||	rp|
 d
| V  |	tv rt|	 }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.
    Nri      r.   r+      r	   r^   zmanylinux_{}_{}rL   )r8   sysr   r<   setrg   ranger=   r;   appendr>   formatru   _LEGACY_MANYLINUX_MAP)r)   too_old_glibc2current_glibcglibc_max_listglibc_majorglibc_minorr3   	glibc_max	min_minorglibc_versiontag
legacy_tagr   r   r   platform_tags   s:   





r   ),collections
contextlib	functoolsrG   r_   r{   ra   typingr   r   r   r   r   r   r   _elffiler
   r   r   r   r"   r#   r$   contextmanagerrW   r   rr   r&   r(   r8   defaultdictr;   rB   rC   r<   rN   r[   r\   rf   	lru_cacherg   ru   r   r   r   r   r   r   <module>   s>   
 $"
,
