3
l]jJ @ sH d dl mZ d dlZd dlZd dlZdd Zdd Zdd Zd d
ZdS ) )absolute_importNc C sP t jd} y
| j}W n tk
r( dS X t j|_| }t|tsL|jd}|S )z9Returns glibc version string, or None if not using glibc.Nascii) ctypesZCDLLgnu_get_libc_versionAttributeErrorZc_char_pZrestype
isinstancestrdecode)Zprocess_namespacer version_str r /usr/lib/python3.6/glibc.pyglibc_version_string
s
r
c C sH t jd| }|s$tjd| t dS t|jd|koFt|jd|kS )Nz$(?P<major>[0-9]+)\.(?P<minor>[0-9]+)z=Expected glibc version with 2 components major.minor, got: %sFmajorminor)rematchwarningswarnRuntimeWarningintgroup)r
required_major
minimum_minormr r r check_glibc_version$ s
r c C s t }|d krdS t|| |S )NF)r
r )r r r
r r r have_compatible_glibc4 s r c C s t } | dkrdS d| fS dS )zTry to determine the glibc version
Returns a tuple of strings (lib, version) which default to empty strings
in case the lookup fails.
N Zglibc)r r )r
)Z
glibc_versionr r r libc_verL s r ) Z
__future__r r r r r
r r r r r r r <module> s