
    #j'                       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j4                  d&d       Zd'dZd'dZd(dZ ej>                  d       Z de!d<    G d de      Z"d)dZ#d)dZ$d)dZ%d*dZ&ejN                  d+d       Z( ejN                  d      d,d       Z)d-dZ* e"dd      d e"dd      d  e"dd!      d"iZ+d#e!d$<   d.d%Z,y)/    )annotationsN)TYPE_CHECKING
NamedTuple   )EIClassEIDataELFFileEMachine)	GeneratorIteratorSequencel      ~ i   i   >   ppc64s390xx86_64aarch64ppc64leriscv64loongarch64c              #     K   	 t        | d      5 }t        |       d d d        y # 1 sw Y   y xY w# t        t        t        f$ r d  Y y w xY ww)Nrb)openr	   OSError	TypeError
ValueError)pathfs     X/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/packaging/_manylinux.py
_parse_elfr   !   sO     $ 	!*	 	 	Y
+ 
s>   A3 '3 A03 A3 AAAAc                x   t        |       5 }|d uxr |j                  t        j                  k(  xrt |j                  t
        j                  k(  xrU |j                  t        j                  k(  xr6 |j                  t        z  t        k(  xr |j                  t        z  t        k(  	 cd d d        S # 1 sw Y   y xY wN)r   capacityr   C32encodingr   Lsbmachiner
   ArmflagsEF_ARM_ABIMASKEF_ARM_ABI_VER5EF_ARM_ABI_FLOAT_HARD
executabler   s     r   _is_linux_armhfr-   *   s     
J	 
1TM I

gkk)I

fjj(I 		X\\)I .(O;	I
 //3HH	

 
 
s   BB00B9c                   t        |       5 }|d uxr[ |j                  t        j                  k(  xr< |j                  t
        j                  k(  xr |j                  t        j                  k(  	 cd d d        S # 1 sw Y   y xY wr    )
r   r!   r   r"   r#   r   r$   r%   r
   I386r+   s     r   _is_linux_i686r0   9   sn    	J	 
1TM +

gkk)+

fjj(+ 		X]]*		

 
 
s   A"A88Bc                b    d|v rt        |       S d|v rt        |       S t        d |D              S )Narmv7li686c              3  ,   K   | ]  }|t         v   y wr    )_ALLOWED_ARCHS).0archs     r   	<genexpr>z'_have_compatible_abi.<locals>.<genexpr>H   s     8$t~%8s   )r-   r0   any)r,   archss     r   _have_compatible_abir;   C   s8    5z**j))8%888    c                      y)N2    r?   r<   r   <lambda>r@   P   s    r<   zdict[int, int]_LAST_GLIBC_MINORc                  "    e Zd ZU ded<   ded<   y)_GLibCVersionintmajorminorN)__name__
__module____qualname____annotations__r?   r<   r   rC   rC   S   s    JJr<   rC   c                     	 t        j                  d      } | J | j                         \  }}|S # t        t        t
        t        f$ r Y yw xY w)zJ
    Primary implementation of glibc_version_string using os.confstr.
    CS_GNU_LIBC_VERSIONN)osconfstrrsplitAssertionErrorAttributeErrorr   r   )version_string_versions      r   _glibc_version_string_confstrrU   X   sX    %'ZZ0E%F)))#**,
7 N NGZ@ s   ,0 AAc                    	 ddl } 	 | j                  d      }	 |j                  }| j                  |_         |       }t        |t              r|j                  d      }|S # t        $ r Y yw xY w# t        $ r Y yw xY w# t
        $ r Y yw xY w)zG
    Fallback implementation of glibc_version_string using ctypes.
    r   Nascii)ctypesImportErrorCDLLr   gnu_get_libc_versionrQ   c_char_prestype
isinstancebytesdecode)rX   process_namespacer[   version_strs       r   _glibc_version_string_ctypesrc   k   s    ""KK-0EE $*?? 35K+u%!((1G  $  
   s3   A  A/ A>  	A,+A,/	A;:A;>	B
	B
c                 .    t               xs
 t               S )z9Returns glibc version string, or None if not using glibc.)rU   rc   r?   r<   r   _glibc_version_stringre      s    (*L.J.LLr<   c                    t        j                  d|       }|s+t        j                  d|  t        d       t        dd      S t        t        |j                  d            t        |j                  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:    )
stacklevelrE   rF   )rematchwarningswarnRuntimeWarningrC   rD   group)rb   ms     r   _parse_glibc_versionrq      sl     	8+FAI+W	

 R$$QWWW-.AGGG4D0EFFr<   c                 H    t               } | t        dd      S t        |       S )Nri   )re   rC   rq   )rb   s    r   _get_glibc_versionrs      s(    ')KR$$,,r<   )maxsizec                 8    	 t        d      S # t        $ r Y yw xY w)zReturn 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__rY   r?   r<   r   _get_manylinux_modulerx      s$    ,'' s   
 	c                   t               }||k  ryt               }|yt        |d      r'|j                  |d   |d   |       }|t	        |      S y|t        dd      k(  r!t        |d      rt	        |j                        S |t        dd	      k(  r!t        |d
      rt	        |j                        S |t        dd      k(  r!t        |d      rt	        |j                        S y)NFTmanylinux_compatibler   r   rg      manylinux1_compatible   manylinux2010_compatible   manylinux2014_compatible)	rs   rx   hasattrrz   boolrC   r|   r~   r   )r7   rT   	sys_glibcmanylinux_modresults        r   _is_compatibler      s    "$I7)+M}4533GAJ
DQ<-1%%'.+ M7788-2&&71, M::;;-2&&71, M::;;r<   rg   r   manylinux2014r}   manylinux2010r{   
manylinux1zdict[_GLibCVersion, str]_LEGACY_MANYLINUX_MAPc              #    K   t        t        j                  |       syt        dd      }t	        |       ddhz  rt        dd      }t        t                }|g}t        |j                  dz
  dd      D ]&  }t        |   }|j                  t        ||             ( | D ]  }|D ]  }|j                  |j                  k(  r|j                  }nd}t        |j                  |d      D ]\  }t        |j                  |      }	t        ||	      s& d	j                  g |	|  t        j                  |	      x}
sT|
 d
|  ^   yw)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.
    Nrg      r   r3      r   ri   zmanylinux_{}_{}_{}rS   )r;   sysr,   rC   setrs   rangerE   rA   appendrF   r   formatr   get)r:   too_old_glibc2current_glibcglibc_max_listglibc_majorglibc_minorr7   	glibc_max	min_minorglibc_version
legacy_tags              r   platform_tagsr      s\      6"1b)N
5zXv&&&q!,!#5#78M#_N ]0014a< G'4mKEFG  5' 	5I."6"66*00	 	$Y__iD 5 -ioo{ K!$65.55K}KdKK &;%>%>}%MMzM!+AdV445	55s   DE	-E	9E	)r   strreturnz%Generator[ELFFile | None, None, None])r,   r   r   r   )r,   r   r:   Sequence[str]r   r   )r   z
str | None)rb   r   r   rC   )r   rC   )r   ztypes.ModuleType | None)r7   r   rT   rC   r   r   )r:   r   r   zIterator[str])-
__future__r   collections
contextlib	functoolsrM   rj   r   rl   typingr   r   _elffiler   r   r	   r
   typescollections.abcr   r   r   r(   r)   r*   r5   contextmanagerr   r-   r0   r;   defaultdictrA   rJ   rC   rU   rc   re   rq   	lru_cachers   rx   r   r   r   r?   r<   r   <module>r      s*   "    	 	 
  , 8 8=="   

9 %<K$;$;J$G > GJ 
&)XM
G& - - Q	  	< !R/!R/!Q3 / +5r<   