U ja¾ ã@sDddlZddlZddlmZmZdd„Zdd„Zdd„Zd d „ZdS) éN)ÚOptionalÚTuplecCs tƒp tƒS)z9Returns glibc version string, or None if not using glibc.)Úglibc_version_string_confstrÚglibc_version_string_ctypes©rrúq/private/var/folders/k6/_7fsz4ts3b78x3b3xwrxjh_c8s8xv7/T/pip-unpacked-wheel-bug3gbve/pip/_internal/utils/glibc.pyÚglibc_version_string src CsFtjdkrdSzt d¡ ¡\}}Wntttfk r@YdSX|S)z@Primary implementation of glibc_version_string using os.confstr.Úwin32NÚCS_GNU_LIBC_VERSION)ÚsysÚplatformÚosÚconfstrÚsplitÚAttributeErrorÚOSErrorÚ ValueError)Ú_Úversionrrrrs rcCsvz ddl}Wntk r"YdSX| d¡}z |j}Wntk rNYdSX|j|_|ƒ}t|tƒsr|  d¡}|S)z=Fallback implementation of glibc_version_string using ctypes.rNÚascii) ÚctypesÚ ImportErrorÚCDLLÚgnu_get_libc_versionrÚc_char_pÚrestypeÚ isinstanceÚstrÚdecode)rÚprocess_namespacerÚ version_strrrrr!s     rcCstƒ}|dkrdSd|fSdS)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!Úglibc)r)Ú glibc_versionrrrÚlibc_verQsr$) r r Útypingrrrrrr$rrrrÚs 0