U ÀÒ.e- ã @ sx d dl mZ d dlZd dlZd dlZd dlmZ erDd dlmZm Z dd„ Z dd„ Zd d „ Zdd„ Z d d„ Zdd„ ZdS )é )Úabsolute_importN)ÚMYPY_CHECK_RUNNING)ÚOptionalÚTuplec 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.8/site-packages/pip/_internal/utils/glibc.pyÚglibc_version_string s r c C s8 zt d¡ ¡ \} }W n tttfk r2 Y dS X |S )z@Primary implementation of glibc_version_string using os.confstr.ÚCS_GNU_LIBC_VERSIONN)ÚosÚconfstrÚsplitÚAttributeErrorÚOSErrorÚ ValueError)Ú_Úversionr r r r s r c C sv zddl } W n tk r" Y dS X | d¡}z |j}W n tk rN Y dS X | j|_|ƒ }t|tƒsr| 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 Úversion_strr r r r &