
}_@              0   @   s  d  Z  d d l m Z m Z d d l Z d d l Z d d l m Z y d d l m	 Z
 Wn" e k
 r| d d l m	 Z
 Yn Xy d d l m Z Wn" e k
 r d d l m Z Yn Xy d d l Z Wn_ e k
 r'y d d l m Z Wn6 e k
 r"d d l Z e j e _ e j e _ Yn XYn Xy d d l Z d d	   Z Wn. e k
 rtd d
 l m Z d d	   Z Yn Xd d d d d d d d d d g
 Z e j d. k rd Z d d l m Z n3 d d l Z e  e d  Z e re j Z n d Z e j d/ k r!d d   Z! d d d  Z" n d d   Z! d d d  Z" d  d!   Z# d" d   Z$ d# d$   Z% d0 Z& e j d1 k re& d2 7Z& e j' j( d*  pe j' d+ k oe j) d, k Z* d- d   Z+ d S)3zKStuff that differs in different Python versions and platform
distributions.    )absolute_importdivisionN)	text_type)
dictConfig)OrderedDict)	ipaddressc              C   s1   t  j d  t  j d  g }  t t t |    S)Nstdlib
platstdlib)	sysconfigget_pathsetfilterbool)paths r   2/tmp/pip-build-3_sjtvrs/pip/pip/compat/__init__.py
get_stdlib"   s    r   )r
   c              C   s=   t  j d d  t  j d d d d  g }  t t t |    S)Nstandard_libTplat_specific)r
   get_python_libr   r   r   )r   r   r   r   r   +   s    logging_dictConfigr   uses_pycacheconsole_to_str
native_strget_path_uidstdlib_pkgsWINDOWSsamefiler         T)cache_from_sourcer    c             C   s=   y |  j  t j j  SWn t k
 r8 |  j  d  SYn Xd  S)Nutf_8)decodesys
__stdout__encodingUnicodeDecodeError)sr   r   r   r   G   s    Fc             C   s/   t  |  t  r+ |  j d | r$ d n d  S|  S)Nzutf-8replacestrict)
isinstancebytesr"   )r'   r(   r   r   r   r   M   s    c             C   s   |  S)Nr   )r'   r   r   r   r   S   s    c             C   s    t  |  t  r |  j d  S|  S)Nzutf-8)r*   r   encode)r'   r(   r   r   r   r   V   s    c             C   sH   t  |  d  r |  j   S|  j |  j |  j d d d } | d Sd  S)Ntotal_seconds   i  
      i@B i@B )hasattrr-   microsecondssecondsdays)tdvalr   r   r   r-   ]   s    
#r-   c             C   s   t  t d  rM t j |  t j t j B } t j |  j } t j |  n7 t j j	 |   st t j
 |   j } n t d |    | S)a)  
    Return path's uid.

    Does not follow symlinks:
        https://github.com/pypa/pip/pull/935#discussion_r5307003

    Placed this function in compat due to differences on AIX and
    Jython, that should eventually go away.

    :raises OSError: When path is a symlink or can't be read.
    
O_NOFOLLOWz1%s is a symlink; Will not return uid for symlinks)r1   osopenO_RDONLYr7   fstatst_uidclosepathislinkstatOSError)r>   fdfile_uidr   r   r   r   e   s    c             C   sD   t  j j |   } |  j d  r@ | j d  r@ | d d  } | S)zl
    Expand ~ and ~user constructions.

    Includes a workaround for http://bugs.python.org/issue14768
    z~/z//   N)r8   r>   
expanduser
startswith)r>   expandedr   r   r   rE      s    rE   pythonwsgiref      argparsewinclintc             C   so   t  t j d  r% t j j |  |  St j j t j j |    } t j j t j j |   } | | k Sd S)z>Provide an alternative for os.path.samefile on Windows/Python2r   N)r1   r8   r>   r   normcaseabspath)file1file2path1path2r   r   r   r      s
    )r   r   )r   )rH   rI   )rJ   rK   )rL   ),__doc__
__future__r   r   r8   r#   Zpip._vendor.sixr   logging.configr   r   ImportErrorZpip.compat.dictconfigcollectionsr   Zpip._vendor.ordereddictr   pip._vendoripaddrZ	IPAddress
ip_addressZ	IPNetwork
ip_networkr
   r   	distutils__all__version_infor   importlib.utilr    impr1   r   r   r-   r   rE   r   platformrF   namer   r   r   r   r   r   <module>   sh   		
