HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.local/lib/python3.10/site-packages/packaging/__pycache__/_musllinux.cpython-310.pyc
o

���g�
�	@sdZddlmZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZGdd�de	�Z
d$d
d�Zejd%dd��Zd&dd�Zedkr�ddlZe��Ze�d�sWJd��ede�edeej��eddd�ee�dd e�d!d�d"��D]
Zeed#d�qydSdS)'z�PEP 656 support.

This module implements logic to detect if the currently running Python is
linked against musl, and what musl version is used.
�)�annotationsN)�Iterator�
NamedTuple�Sequence�)�ELFFilec@seZdZUded<ded<dS)�_MuslVersion�int�major�minorN)�__name__�
__module__�__qualname__�__annotations__�rr�G/home/arjun/.local/lib/python3.10/site-packages/packaging/_musllinux.pyrs
r�output�str�return�_MuslVersion | NonecCsxdd�dd�|��D�D�}t|�dks|ddd�dkr dSt�d	|d
�}|s,dStt|�d
��t|�d��d�S)NcSsg|]}|r|�qSrr��.0�nrrr�
<listcomp>sz'_parse_musl_version.<locals>.<listcomp>css�|]}|��VqdS)N)�striprrrr�	<genexpr>s�z&_parse_musl_version.<locals>.<genexpr>�r��muslzVersion (\d+)\.(\d+)r)r
r)�
splitlines�len�re�matchrr	�group)r�lines�mrrr�_parse_musl_versions  r&�
executablec
Cs�zt|d��
}t|�j}Wd�n1swYWn
tttfy)YdSw|dus2d|vr4dStj|gtjdd�}t	|j
�S)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)�stderr�text)�openr�interpreter�OSError�	TypeError�
ValueError�
subprocess�run�PIPEr&r))r'�f�ld�procrrr�_get_musl_version!s���
r6�archs�
Sequence[str]�
Iterator[str]ccsT�ttj�}|durdS|D]}t|jdd�D]}d|j�d|�d|��VqqdS)a�Generate 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_�_)r6�sysr'�rangerr
)r7�sys_musl�archrrrr�
platform_tags8s�
��rA�__main__zlinux-z	not linuxzplat:zmusl:ztags:� )�endz[.-]r<�-r:z
      )rrrr)r'rrr)r7r8rr9)�__doc__�
__future__r�	functoolsr!r0r=�typingrrr�_elffilerrr&�	lru_cacher6rAr�	sysconfig�get_platform�plat�
startswith�printr'�sub�split�trrrr�<module>s0



"�