Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-35.pyc
“tÆ_á ã @ sˆ d d l m Z d d l Z d d l Z d d l m Z e rT d d l m Z m Z d d „ Z d d „ Z
d d
„ Z d d „ Z d S)
é )Ú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 úˆ/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-1.el7.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/glibc.pyÚglibc_version_string s r
c
C sX t j d k r d Sy t j d ƒ j ƒ \ } } Wn t t t f k
rS d SYn X| 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 s• y d d l } Wn t k
r( d SYn X| j d ƒ } y
| j } Wn t k
r] d SYn X| j | _ | ƒ } t | t ƒ s‘ | j d ƒ } | S)z=Fallback implementation of glibc_version_string using ctypes.r NÚascii)
ÚctypesÚImportErrorÚCDLLÚgnu_get_libc_versionr Úc_char_pÚrestypeÚ
isinstanceÚstrÚdecode)r Úprocess_namespacer Úversion_strr r r r ' s
r c C s' t ƒ } | d k r d Sd | f Sd S)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Ú Úglibc)r# r# )r
)Ú
glibc_versionr r r Úlibc_verW s r&