a ifr%@spUddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z ddlmZmZmZmZdZdZdZejd d d d d Zd ddddZd ddddZd dddddZeddZded<Gddde Zddd d!Zddd"d#Z ddd$d%Z!d d&d'd(d)Z"ej#d&dd*d+Z$d ddd,d-d.Z%d/d0d1d2Z&dd3d4d5d6Z'dS)7) annotationsN) GeneratorIterator NamedTupleSequence)EIClassEIDataELFFileEMachinel~iistrz%Generator[ELFFile | None, None, None])pathreturnc cs\z8t|d}t|VWdn1s,0YWntttfyVdVYn0dS)Nrb)openr OSError TypeError ValueError)r frx/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/packaging/_manylinux.py _parse_elfs  ,rbool) executablercCstt|X}|duoP|jtjkoP|jtjkoP|jtj koP|j t @t koP|j t @t kWdS1sf0YdSN)rcapacityrC32encodingr Lsbmachiner ArmflagsEF_ARM_ABIMASKEF_ARM_ABI_VER5EF_ARM_ABI_FLOAT_HARDrrrrr_is_linux_armhfs      r&cCsXt|<}|duo4|jtjko4|jtjko4|jtj kWdS1sJ0YdSr) rrrrrr rrr I386r%rrr_is_linux_i686-s    r(z Sequence[str])rarchsrcs>d|vrt|Sd|vr t|Shdtfdd|DS)Narmv7li686>riscv64s390x loongarch64aarch64x86_64ppc64leppc64c3s|]}|vVqdSrr).0arch allowed_archsrr Ez'_have_compatible_abi..)r&r(any)rr)rr5r_have_compatible_abi7s  r:cCsdS)N2rrrrrMr8r<zdict[int, int]_LAST_GLIBC_MINORc@seZdZUded<ded<dS) _GLibCVersionintmajorminorN)__name__ __module__ __qualname____annotations__rrrrr>Ps r>z str | None)rc CsHz&td}|dusJ|\}}WnttttfyBYdS0|S)zJ Primary implementation of glibc_version_string using os.confstr. CS_GNU_LIBC_VERSIONN)osconfstrrsplitAssertionErrorAttributeErrorrr)version_string_versionrrr_glibc_version_string_confstrUs  rOcCsz ddl}Wnty YdS0z|d}WntyDYdS0z |j}WntydYdS0|j|_|}t|t s| d}|S)zG Fallback implementation of glibc_version_string using ctypes. rNascii) ctypes ImportErrorCDLLrgnu_get_libc_versionrKc_char_prestype isinstancer decode)rQprocess_namespacerT version_strrrr_glibc_version_string_ctypeshs"       r[cCs tp tS)z9Returns glibc version string, or None if not using glibc.)rOr[rrrr_glibc_version_stringsr\ztuple[int, int])rZrcCsBtd|}|s&td|tdSt|dt|dfS)a3Parse 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[0-9]+)\.(?P[0-9]+)z;Expected glibc version with 2 components major.minor, got: r^r@rA)rematchwarningswarnRuntimeWarningr?group)rZmrrr_parse_glibc_versions rfcCst}|durdSt|S)Nr])r\rf)rZrrr_get_glibc_versionsrg)r4rNrcCst}||krdSz ddl}Wnty2YdS0t|drh||d|d|}|durdt|SdS|tddkrt|drt|jS|tdd krt|d rt|jS|tdd krt|d rt|j SdS) NFrTmanylinux_compatiblermanylinux1_compatible manylinux2010_compatiblemanylinux2014_compatible) rg _manylinuxrRhasattrrhrr>rkrmro)r4rN sys_glibcrpresultrrr_is_compatibles,         rt manylinux2014 manylinux2010 manylinux1))rirn)rirl)rirjz Iterator[str])r)rc csttj|sdStdd}t|ddh@r4tdd}tt}|g}t|jdddD]}t|}| t||qV|D]}|D]}|j|jkr|j }nd}t|j |dD]^}t|j|} d j | } t || r| d |V| t vrt | } t || r| d |VqqqxdS) aGenerate 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. Nrir0r+rr^zmanylinux_{}_{}rM)r:sysrr>setrgranger@r=appendrAformatrt_LEGACY_MANYLINUX_MAP) r)too_old_glibc2 current_glibcglibc_max_list glibc_major glibc_minorr4 glibc_max min_minor glibc_versiontag legacy_tagrrr platform_tagss0         r)( __future__r collections contextlib functoolsrGr_rzratypingrrrr_elffilerr r r r"r#r$contextmanagerrr&r(r: defaultdictr=rEr>rOr[r\rf lru_cachergrtrrrrrrs> ,