\h ZdZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZde ededeedffdZde ede efd ZGd d e Zd ede efd Zej,dede efdZdede efdZedk(rddlZej6Zej;dsJdedeedeej>eddeej@ddejCdddD] Z"ee"dyy) zPEP 656 support. This module implements logic to detect if the currently running Python is linked against musl, and what musl version is used. N)IOIterator NamedTupleOptionalTupleffmtreturn.crtj||jtj|SN)structunpackreadcalcsize)rr s c/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/packaging/_musllinux.py_read_unpackedrs% ==affV__S%9: ;;c|jd t|d}|ddt dk7ry|jtj dd dd d |d\}}}t j|} t||\}}}}}}} t| dzD]} |j||| zz |t||\} } } | d k7r7|j| tj|j| jd }d |vry|cSy#tj$rYywxYw#t$rYywxYw#tj$rYywxYw#tj$rYywxYw)zDetect musl libc location by parsing the Python executable. Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html r16BNsELFHHI)IIIIHHHIIIIIIII)rrr)QQQIHHHIIQQQQQQ)r)rrmusl)seekrr errortupleroperator itemgetterKeyErrorrangeosfsdecoderstrip)ridente_fmtp_fmtp_idxp_get_e_phoff e_phentsizee_phnumip_typep_offsetp_filesz interpreters r_parse_ld_musl_from_elfr:s FF1Iq%( RayE*%%FF6??5 !1% , 21  (ue##U+4B1e4L17Aq!['7Q;   wq() ).~a/G)H &FHh Q;  xkk!&&"2399$?  $  K <<  << ||  sG D"D;9E 6E#"D87D8; EE E E #E:9E:c"eZdZUeed<eed<y) _MuslVersionmajorminorN)__name__ __module__ __qualname__int__annotations__rrr<r<Gs J Jrr<outputc@d|jDDcgc]}|s| }}t|dks |ddddk7rytjd|d}|syt t |j dt |j dScc}w) Nc3<K|]}|jywr )r+).0ns r z&_parse_musl_version..Ms@q@srrrr!zVersion (\d+)\.(\d+)r)r=r>) splitlineslenrematchr<rBgroup)rErIlinesms r_parse_musl_versionrRLs@F,=,=,?@ F1AQ FE F 5zA~q"1/ (%(3A  c!''!*oS_ EE Gs BB executablecNtj5} |jt|d}t |}dddsyt j|gt jd}t|jS#t$r YdddywxYw#1swY_xYw)a`Detect currently-running musl runtime version. This is done by checking the specified executable's dynamic linking information, and invoking the loader to parse its output for a version string. If the loader is musl, the output would be something like:: musl libc (x86_64) Version 1.2.2 Dynamic Program Loader rbNT)stderruniversal_newlines) contextlib ExitStack enter_contextopenOSErrorr: subprocessrunPIPErRrV)rSstackrldprocs r_get_musl_versionrcVs    (5 ##DT$:;A%Q ' (  >>2$z4 PD t{{ ++   (( ((s-BB B B BBBB$archc#Kttj}|yt|jddD]}d|j d|d|yw)aTGenerate musllinux tags compatible to the current platform. :param arch: Should 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 musllinux-compatible. :returns: An iterator of compatible musllinux tags. N musllinux_r1)rcsysrSr(r>r=)rdsys_muslr>s r platform_tagsrjnsY!0Hx~~r2.;8>>*!E7!D6::;sAA__main__zlinux-z not linuxzplat:zmusl:ztags: )endz[.-]r1-rrfz )#__doc__rX functoolsr%r)rMr r]rhtypingrrrrrbytesstrrBrr:r<rR lru_cachercrjr? sysconfig get_platformplat startswithprintrSsubsplittrDrrr}sz   <<F,#,(<*@,,. ; ; ;  z !9 ! ! #D ??8 $1k1 $ '4 '$S^^45 's 6266'3 30B20FG H! aZ !r