3
U'íc ã @ sx d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
mZmZm
Z
mZ e
e eeedf dddZe
e e
e dd d
ZG dd deZee
e d
ddZej ee
e dddZeee dddZedkrtddlZej Zejdstdede edeej eddd x4eej!ddej"d d!d# D ]Z#ee#d"d q^W 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)ÚIOÚIteratorÚ
NamedTupleÚOptionalÚTuple.)ÚfÚfmtÚreturnc C s t j|| jt j|S )N)ÚstructÚunpackÚreadÚcalcsize)r r © r ú9/tmp/pip-build-gk9425m9/packaging/packaging/_musllinux.pyÚ_read_unpacked s r )r r c $ C sd | j d yt| d}W n tjk
r. dS X |dd
tdkrHdS | j tjdd yddd|d \}}}W n tk
r dS X tj| }yt| |\}}}}}}} W n tjk
rÈ dS X xt | d D ]}
| j |||
y|t| |\}}}
W n tjk
r dS X |dkr,qØ| j | t
j| j|
j
d}d|krZdS |S W dS )záDetect 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 Z16BNé s ELFZHHIé ÚIIIIHHHÚIIIIIIIIÚQQQIHHHÚIIQQQQQQé é )r r é ú Úmusl©r r r )r r r ©r r r )r r r )Úseekr r