O d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z mZmZm Z mZ de e dedeedf fdZde e de e fd Z G d de Zdede e fd Z ej dede e fd Zdedee fdZedk rddlZ ej Ze d s J d ede ed eej edd e ej dde! dd d D ]Z" ee"d dS dS ) 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.c v t j || t j | S N)structunpackreadcalcsize)r r s /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/packaging/_musllinux.py_read_unpackedr s* =affV_S%9%9::;;; c b | d t | d }n# t j $ r Y dS w xY w|dd t d k rdS | t j d d dd d |d \ }}}t j | }n# t $ r Y dS w xY w t | | \ }}}}}}} n# t j $ r Y dS w xY wt | dz D ]} | ||| z z |t | | \ }}} n# t j $ r Y dS w xY w|dk rZ| | t j | | d }d |vr dS |c S dS )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 r 16BN s ELFHHI )IIIIHHHIIIIIIII)r r r )QQQIHHHIIQQQQQQ)r )r r musl)seekr r errortupler operator itemgetterKeyErrorrangeosfsdecoder strip)r idente_fmtp_fmtp_idxp_get_e_phoffe_phentsizee_phnumip_typep_offsetp_fileszinterpreters r _parse_ld_musl_from_elfr: s$ FF1IIIq%((<