R" ft dZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z GddeZ de d ee fd Zejd e d ee fd Zd e e d ee fdZedk(rddlZej(Zej-dsJdedeedeej0eddeej2ddej5dddD] Zeedyy)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)Iterator NamedTupleOptionalSequence)ELFFilec"eZdZUeed<eed<y) _MuslVersionmajorminorN)__name__ __module__ __qualname__int__annotations__6/usr/lib/python3/dist-packages/packaging/_musllinux.pyr r s J Jrr outputreturnc@d|jDDcgc]}|s| }}t|dks |ddddk7rytjd|d}|syt t |j dt |j dScc}w) Nc3<K|]}|jyw)N)strip).0ns r z&_parse_musl_version..s@q@srmuslzVersion (\d+)\.(\d+)r)r r ) splitlineslenrematchr rgroup)rrlinesms r_parse_musl_versionr's@F,=,=,?@ F1AQ FE F 5zA~q"1/ (%(3A  c!''!*oS_ EE Gs BB executablec* t|d5}t|j}dddd|vryt j|gt jd}t|jS#1swYLxYw#ttt f$rYywxYw)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 rbNrT)stderrtext) openr interpreterOSError TypeError ValueError subprocessrunPIPEr'r+)r(fldprocs r_get_musl_versionr8s *d # (q''B ( zV2% >>2$zT BD t{{ ++ ( ( Y +s' A;A/A;/A84A;;BBarchsc#Kttj}|y|D]5}t|jddD]}d|j d|d|7yw)aGenerate musllinux 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 musllinux-compatible. :returns: An iterator of compatible musllinux tags. N musllinux__)r8sysr(ranger r )r9sys_muslarchr s r platform_tagsrB6sh!0H?8>>2r2 ?Ex~~.awav> > ??sAA__main__zlinux-z not linuxzplat:zmusl:ztags: )endz[.-]r=-r;z )__doc__ functoolsr"r2r>typingrrrr_elffilerr strr' lru_cacher8rBr sysconfig get_platformplat startswithprintr(subsplittrrrrUs3   ;;: FF(>F,#,(<*@,,,?#?8C=?& z !9 ! ! #D ??8 $1k1 $ '4 '$S^^45 's 6266'3 30B20FG H! aZ !r