a
ˆlj& ã @ sp d dl Z d dlZd dlmZmZ ee dœdd„Zee dœdd„Zee dœdd „Zeeef dœd
d„Z dS )é N)ÚOptionalÚTuple)Úreturnc C s t ƒ p
tƒ S )z9Returns glibc version string, or None if not using glibc.)Úglibc_version_string_confstrÚglibc_version_string_ctypes© r r ú=/usr/lib/python3.9/site-packages/pip/_internal/utils/glibc.pyÚglibc_version_string s r c
C sD t jdkrdS zt d¡ ¡ \} }W n tttfy> Y dS 0 |S )z@Primary implementation of glibc_version_string using os.confstr.Úwin32NÚCS_GNU_LIBC_VERSION)ÚsysÚplatformÚosÚconfstrÚsplitÚAttributeErrorÚOSErrorÚ
ValueError)Ú_Úversionr r r r s
r c C sr zddl } W n ty Y dS 0 | d¡}z
|j}W n tyJ Y dS 0 | j|_|ƒ }t|tƒsn| d¡}|S )z=Fallback implementation of glibc_version_string using ctypes.r NÚascii)
ÚctypesÚImportErrorZCDLLÚgnu_get_libc_versionr Zc_char_pZrestypeÚ
isinstanceÚstrÚdecode)r Zprocess_namespacer Zversion_strr r r r s
r c C s t ƒ } | du rdS d| fS dS )z“Try to determine the glibc version
Returns a tuple of strings (lib, version) which default to empty strings
in case the lookup fails.
N)Ú r Zglibc)r )Z
glibc_versionr r r Úlibc_verN s r )
r r Útypingr r r r r r r r r r r Ú