
}«‘_{  ã               @   st   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d d „  Z d d „  Z d d „  Z d	 d
 „  Z	 d S)é    )Úabsolute_importNc              C   sl   t  j d ƒ }  y |  j } Wn t k
 r4 d SYn Xt  j | _ | ƒ  } t | t ƒ sh | j d ƒ } | S)z9Returns glibc version string, or None if not using glibc.NÚascii)	ÚctypesÚCDLLÚgnu_get_libc_versionÚAttributeErrorÚc_char_pÚrestypeÚ
isinstanceÚstrÚdecode)Úprocess_namespacer   Úversion_str© r   ú./tmp/pip-build-3_sjtvrs/pip/pip/utils/glibc.pyÚglibc_version_string	   s    		r   c             C   sd   t  j d |  ƒ } | s0 t j d |  t ƒ d St | j d ƒ ƒ | k oc t | j d ƒ ƒ | k S)Nz$(?P<major>[0-9]+)\.(?P<minor>[0-9]+)z=Expected glibc version with 2 components major.minor, got: %sFÚmajorÚminor)ÚreÚmatchÚwarningsÚwarnÚRuntimeWarningÚintÚgroup)r   Úrequired_majorÚminimum_minorÚmr   r   r   Úcheck_glibc_version#   s    	r   c             C   s)   t  ƒ  } | d  k r d St | |  | ƒ S)NF)r   r   )r   r   r   r   r   r   Úhave_compatible_glibc3   s    	r   c              C   s-   t  ƒ  }  |  d  k r t j ƒ  Sd |  f Sd  S)NÚglibc)r   ÚplatformÚlibc_ver)Úglibc_versionr   r   r   r"   K   s    	
r"   )
Ú
__future__r   r   r   r!   r   r   r   r   r"   r   r   r   r   Ú<module>   s   