
^Wc           @  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d d l m Z m Z d d l m Z m Z m Z m Z m Z d d l m Z d d l m  Z  m! Z! d d	 l" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ d d
 l, m- Z- m. Z. e j/ e0  Z1 e2 a3 e4 e d  rd Z5 n9 e j6 j7 d  rd Z5 n e j6 d k rd Z5 n d Z5 e j8 d  Z9 e9 rd e j: d  Z9 n  d e9 Z; e5 e9 Z< e j" j=   j> d d  j> d d  Z? e j8 d  Z@ e@ oze@ j7 d  re@ j> d d  Z@ n d   ZA eA   Z@ [A e jB d e jC e jD B ZE e jB d e jC e jD B ZF e jB d  ZG e jB d  ZH d  ZI d! ZJ e jK d" k r$d#   ZL n	 d$   ZL d% eM f d&     YZN eN   ZO d' eM f d(     YZP d)   ZQ eQ   ZR [Q e2 d*  ZS d S(+   i(   t   unicode_literalsN(   t   message_from_filei   (   t   __version__t   DistlibException(   t	   sysconfigt   ZipFilet   fsdecodet	   text_typet   filter(   t   InstalledDistribution(   t   Metadatat   METADATA_FILENAME(	   t   FileOperatort   convert_patht	   CSVReadert	   CSVWritert   Cachet   cached_propertyt   get_cache_baset   read_exportst   tempdir(   t   NormalizedVersiont   UnsupportedVersionErroru   pypy_version_infou   ppu   javau   jyu   cliu   ipu   cpu   py_version_nodotu   %s%si   u   pyu   -u   _u   .u   SOABIu   cpython-c          C  s|   d t  g }  t j d  r+ |  j d  n  t j d  rJ |  j d  n  t j d  d k ro |  j d  n  d	 j |   S(
   Nu   cpu   Py_DEBUGu   du   WITH_PYMALLOCu   mu   Py_UNICODE_SIZEi   u   uu    (   t
   VER_SUFFIXR   t   get_config_vart   appendt   join(   t   parts(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   _derive_abi;   s    uz   
(?P<nm>[^-]+)
-(?P<vn>\d+[^-]*)
(-(?P<bn>\d+[^-]*))?
-(?P<py>\w+\d+(\.\w+\d+)*)
-(?P<bi>\w+)
-(?P<ar>\w+(\.\w+)*)
\.whl$
u7   
(?P<nm>[^-]+)
-(?P<vn>\d+[^-]*)
(-(?P<bn>\d+[^-]*))?$
s   \s*#![^\r\n]*s   ^(\s*#!("[^"]+"|\S+))\s+(.*)$s   #!pythons	   #!pythonwu   /c         C  s   |  S(   N(    (   t   o(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   <lambda>]   s    c         C  s   |  j  t j d  S(   Nu   /(   t   replacet   ost   sep(   R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR   _   s    t   Mounterc           B  s8   e  Z d    Z d   Z d   Z d d  Z d   Z RS(   c         C  s   i  |  _  i  |  _ d  S(   N(   t   impure_wheelst   libs(   t   self(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   __init__c   s    	c         C  s!   | |  j  | <|  j j |  d  S(   N(   R#   R$   t   update(   R%   t   pathnamet
   extensions(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   addg   s    c         C  sI   |  j  j |  } x0 | D]( \ } } | |  j k r |  j | =q q Wd  S(   N(   R#   t   popR$   (   R%   R(   R)   t   kt   v(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   removek   s    c         C  s"   | |  j  k r |  } n d  } | S(   N(   R$   t   None(   R%   t   fullnamet   patht   result(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   find_moduleq   s    	c         C  s   | t  j k r t  j | } nx | |  j k rA t d |   n  t j | |  j |  } |  | _ | j d d  } t |  d k r | d | _	 n  | S(   Nu   unable to find extension for %su   .i   i    (
   t   syst   modulesR$   t   ImportErrort   impt   load_dynamict
   __loader__t   rsplitt   lent   __package__(   R%   R0   R2   R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   load_modulex   s    	N(   t   __name__t
   __module__R&   R*   R.   R/   R3   R=   (    (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR"   b   s
   			t   Wheelc           B  s  e  Z d  Z d Z d Z d e e d  Z e d    Z	 e d    Z
 e d    Z e d    Z d   Z e d	    Z d
   Z d d  Z d   Z d   Z d   Z d d d  Z d   Z d   Z d   Z d   Z d   Z e d  Z d   Z d   Z d d  Z RS(   u@   
    Class to build and install from Wheel files (PEP 427).
    i   u   sha256c         C  s  | |  _  | |  _ d |  _ t g |  _ d g |  _ d g |  _ t j   |  _	 | d k r{ d |  _ d |  _ |  j |  _ nEt j |  } | r | j d  } | d |  _ | d j d d	  |  _ | d
 |  _ |  j |  _ n t j j |  \ } } t j |  } | s!t d |   n  | r?t j j |  |  _	 n  | |  _ | j d  } | d |  _ | d |  _ | d
 |  _ | d j d  |  _ | d j d  |  _ | d j d  |  _ d S(   uB   
        Initialise an instance using a (valid) filename.
        u    u   noneu   anyu   dummyu   0.1u   nmu   vnu   _u   -u   bnu   Invalid name or filename: %ru   pyu   .u   biu   arN(   t   signt   should_verifyt   buildvert   PYVERt   pyvert   abit   archR    t   getcwdt   dirnameR/   t   namet   versiont   filenamet	   _filenamet   NAME_VERSION_REt   matcht	   groupdictR   R1   t   splitt   FILENAME_RER   t   abspath(   R%   RL   RA   t   verifyt   mt   infoRI   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR&      sB    						c         C  s   |  j  r d |  j  } n d } d j |  j  } d j |  j  } d j |  j  } |  j j d d  } d |  j | | | | | f S(   uJ   
        Build and return a filename from the various components.
        u   -u    u   .u   _u   %s-%s%s-%s-%s-%s.whl(   RC   R   RE   RF   RG   RK   R   RJ   (   R%   RC   RE   RF   RG   RK   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyRL      s    	c         C  s+   t  j j |  j |  j  } t  j j |  S(   N(   R    R1   R   RI   RL   t   isfile(   R%   R1   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   exists   s    c         c  sN   xG |  j  D]< } x3 |  j D]( } x |  j D] } | | | f Vq* Wq Wq
 Wd  S(   N(   RE   RF   RG   (   R%   RE   RF   RG   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   tags   s    c         C  s8  t  j j |  j |  j  } d |  j |  j f } d | } t j d  } t	 | d   } |  j
 |  } | d j d d  } t g  | D] } t |  ^ q  }	 |	 d k  r d }
 n t }
 yI t j | |
  } | j |  " } | |  } t d	 |  } Wd  QXWn! t k
 r-t d
 |
   n XWd  QX| S(   Nu   %s-%su   %s.dist-infou   utf-8u   ru   Wheel-Versionu   .i   u   METADATAt   fileobju$   Invalid wheel, because %s is missing(   i   i   (   R    R1   R   RI   RL   RJ   RK   t   codecst	   getreaderR   t   get_wheel_metadataRQ   t   tuplet   intR   t	   posixpatht   openR
   t   KeyErrort
   ValueError(   R%   R(   t   name_vert   info_dirt   wrappert   zft   wheel_metadatat   wvt   it   file_versiont   fnt   metadata_filenamet   bft   wfR2   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   metadata   s(    
%	c         C  su   d |  j  |  j f } d | } t j | d  } | j |  ( } t j d  |  } t |  } Wd  QXt |  S(   Nu   %s-%su   %s.dist-infou   WHEELu   utf-8(	   RJ   RK   R`   R   Ra   R[   R\   R   t   dict(   R%   Rg   Rd   Re   Rm   Rn   Ro   t   message(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR]      s    
c         C  sF   t  j j |  j |  j  } t | d   } |  j |  } Wd  QX| S(   Nu   r(   R    R1   R   RI   RL   R   R]   (   R%   R(   Rg   R2   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyRV      s    c         C  s  t  j |  } | r | j   } | |  | | } } d | j   k rQ t } n t } t j |  } | r d | j   d } n d } | | } | | } ns | j d  } | j d  }	 | d k  s | |	 k r d }
 n& | | | d !d	 k r d	 }
 n d }
 t |
 | } | S(
   Nt   pythonwt    it    s   s   
i    i   s   
(	   t
   SHEBANG_RERO   t   endt   lowert   SHEBANG_PYTHONWt   SHEBANG_PYTHONt   SHEBANG_DETAIL_REt   groupst   find(   R%   t   dataRU   Rw   t   shebangt   data_after_shebangt   shebang_pythont   argst   crt   lft   term(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   process_shebang   s,    	
		c         C  s   | d  k r |  j } n  y t t |  } Wn! t k
 rN t d |   n X| |  j   } t j |  j	 d  j
 d  } | | f S(   Nu   Unsupported hash algorithm: %rt   =u   ascii(   R/   t	   hash_kindt   getattrt   hashlibt   AttributeErrorR   t   digestt   base64t   urlsafe_b64encodet   rstript   decode(   R%   R~   R   t   hasherR2   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   get_hash  s    !c         C  s~   t  |  } t t j j | |   } | j | d d f  | j   t |  % } x | D] } | j |  q] WWd  QXd  S(   Nu    (	   t   listt   to_posixR    R1   t   relpathR   t   sortR   t   writerow(   R%   t   recordst   record_patht   baset   pt   writert   row(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   write_record'  s    
c         C  s   g  } | \ } } t  t |  j  } xs | D]k \ } }	 t |	 d   }
 |
 j   } Wd  QXd |  j |  } t j j |	  } | j	 | | | f  q+ Wt j j
 | d  }	 |  j | |	 |  t t j j
 | d   } | j	 | |	 f  d  S(   Nu   rbu   %s=%su   RECORD(   R   R   R   Ra   t   readR   R    R1   t   getsizeR   R   R   R   (   R%   RV   t   libdirt   archive_pathsR   t   distinfoRe   R   t   apR   t   fR~   R   t   size(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   write_records0  s    c      	   C  s\   t  | d t j  A } x7 | D]/ \ } } t j d | |  | j | |  q WWd  QXd  S(   Nu   wu   Wrote %s to %s in wheel(   R   t   zipfilet   ZIP_DEFLATEDt   loggert   debugt   write(   R%   R(   R   Rg   R   R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt	   build_zip@  s    c   !   
     s  | d k r i  } n  t t   f d   d$   d } | d k rg d } t g } t g } t g } n! d } t g } d g } d g } | j d	 |  |  _ | j d
 |  |  _	 | j d |  |  _
   | }	 d |  j |  j f }
 d |
 } d |
 } g  } xKd% D]C} |   k r qn    | } t j j |  rxt j |  D] \ } } } x | D] } t t j j | |   } t j j | |  } t t j j | | |   } | j | | f  | d k rb| j d  rbt | d   } | j   } Wd QX|  j |  } t | d   } | j |  Wd QXqbqbWqLWqqW|	 } d } xt j |  D] \ } } } | | k rxU t |  D]G \ } } t |  } | j d  rt j j | |  } | | =PqqW| st d   n  xl | D]d } t |  j d&  rqn  t j j | |  } t t j j | |   } | j | | f  qWqkWt j |  } xf | D]^ } | d' k r|t t j j | |   } t t j j | |   } | j | | f  q|q|Wd | p|  j d t d  | g } x4 |  j  D]) \ } } } | j d! | | | f  qWt j j | d  } t | d"   } | j d# j |   Wd QXt t j j | d   } | j | | f  |  j! | | f |	 |  t j j |  j" |  j#  }  |  j$ |  |  |  S((   u   
        Build a wheel from files in specified paths, and use any specified tags
        when determining the name of the wheel.
        c           s
   |    k S(   N(    (   R   (   t   paths(    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR   N  s    u   purelibu   platlibi    u   falseu   trueu   noneu   anyu   pyveru   abiu   archu   %s-%su   %s.datau   %s.dist-infou   datau   headersu   scriptsu   .exeu   rbNu   wbu
   .dist-infou(   .dist-info directory expected, not foundu   .pycu   .pyou   RECORDu	   INSTALLERu   SHAREDu   WHEELu   Wheel-Version: %d.%du   Generator: distlib %su   Root-Is-Purelib: %su   Tag: %s-%s-%su   wu   
(   u   purelibu   platlib(   u   datau   headersu   scripts(   u   .pycu   .pyo(   u   RECORDu	   INSTALLERu   SHAREDu   WHEEL(%   R/   R   R   t   IMPVERt   ABIt   ARCHRD   t   getRE   RF   RG   RJ   RK   R    R1   t   isdirt   walkR   R   R   R   R   t   endswithRa   R   R   R   t	   enumeratet   AssertionErrort   listdirt   wheel_versionR   RY   R   RI   RL   R   (!   R%   R   RY   R   t   libkeyt   is_puret   default_pyvert   default_abit   default_archR   Rd   t   data_dirRe   R   t   keyR1   t   roott   dirst   filesRl   R   t   rpR   R   R~   R   Rj   t   dnRh   RE   RF   RG   R(   (    (   R   sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   buildF  s    	"					



%c   C      K  s	  | j  } | j d  } | j d t  } t j j |  j |  j  } d |  j |  j	 f } d | }	 d | }
 t
 j |
 t  } t
 j |
 d  } t
 j |
 d  } t j d  } t | d	  } | j |   } | |  } t |  } Wd
 QX| d j d d  } t g  | D] } t |  ^ q } | |  j k rY| rY| |  j |  n  | d d k rv| d } n
 | d } i  } | j |  D } t d |  , } x" | D] } | d } | | | <qWWd
 QXWd
 QXt
 j |	 d  } t
 j |
 d  } t
 j |	 d d  } t d |  } t | _ t j }  g  }! t j   }" |" | _ d
 | _ z*yx| j    D]}# |# j }$ t! |$ t"  r|$ }% n |$ j# d  }% |% j$ d  rqmn  | |% } | d rt% |# j&  | d k rt' d |%   n  | d r|| d j d d  \ }& }' | j |$   } | j(   }( Wd
 QX|  j) |( |&  \ }) }* |* |' k r|t' d |$   q|n  | r|% j* | | f  rt+ j, d |%  qmn  |% j* |  o|% j$ d  }+ |% j* |  r|% j d d  \ }) }, }- t j j | |, t- |-   }. n3 |% | | f k r0qmn  t j j | t- |%   }. |+ sW| j |$   } | j. | |.  Wd
 QX|! j/ |.  | r| d rt |. d  J } | j(   }( |  j) |( |&  \ }) }/ |/ |* k rt' d  |.   n  Wd
 QXn  |  r|. j$ d!  ry  | j0 |.  }0 |! j/ |0  WqTt1 k
 rPt+ j2 d" d# t qTXqqmt j j3 t- |$   }1 t j j |" |1  }2 | j |$   } | j. | |2  Wd
 QXt j j |.  \ }3 }1 |3 | _ | j4 |1  }4 | j5 |4  |! j6 |4  qmW| rt+ j, d$  d
 }5 n:d
 }6 |  j7 d } | d% k r0t
 j |
 d&  }7 y | j |7   } t8 |  }8 Wd
 QXi  }6 x d8 D] }9 d) |9 }: |: |8 k r{i  |6 d* |9 <}; x[ |8 |: j9   D]F }< d+ |< j: |< j; f }= |< j< r|= d, |< j< 7}= n  |= |; |< j <qWq{q{WWqt1 k
 r,t+ j2 d-  qXny yX | j |  C } | |  } t= j> |  j d.  }6 |6 r|6 j d/  }6 n  Wd
 QXWn t1 k
 rt+ j2 d0  n X|6 r|6 j d1 i   }> |6 j d2 i   }? |> s|? r| j d d  }@ t j j? |@  st@ d3   n  |@ | _ xF |> jA   D]8 \ }: }< d4 |: |< f }A | j4 |A  }4 | j5 |4  q(W|? ri t d( 6}B xL |? jA   D]; \ }: }< d4 |: |< f }A | j4 |A |B  }4 | j5 |4  qWqqn  t j j | |
  } tB |  }5 tC |  } | d =| d =| | d5 <|5 jD | |  } | r9	|! j/ |  n  |5 jE |! | d6 |  |5 SWn+ t1 k
 r	t+ jF d7  | jG     n XWd
 tH jI |"  XWd
 QXd
 S(9   u  
        Install a wheel to the specified paths. If kwarg ``warner`` is
        specified, it should be a callable, which will be called with two
        tuples indicating the wheel version of this software and the wheel
        version in the file, if there is a discrepancy in the versions.
        This can be used to issue any warnings to raise any exceptions.
        If kwarg ``lib_only`` is True, only the purelib/platlib files are
        installed, and the headers, scripts, data and dist-info metadata are
        not written.

        The return value is a :class:`InstalledDistribution` instance unless
        ``options.lib_only`` is True, in which case the return value is ``None``.
        u   warneru   lib_onlyu   %s-%su   %s.datau   %s.dist-infou   WHEELu   RECORDu   utf-8u   rNu   Wheel-Versionu   .i   u   Root-Is-Purelibu   trueu   purelibu   platlibt   streami    u    u   scriptst   dry_runu   /RECORD.jwsi   u   size mismatch for %su   =u   digest mismatch for %su   lib_only: skipping %su   .exeu   /u   rbu   digest mismatch on write for %su   .pyu   Byte-compilation failedt   exc_infou   lib_only: returning Noneu   1.0u   entry_points.txtu   consoleu   guiu
   %s_scriptsu   wrap_%su   %s:%su    %suA   Unable to read legacy script metadata, so cannot generate scriptsu
   extensionsu   python.commandsu8   Unable to read JSON metadata, so cannot generate scriptsu   wrap_consoleu   wrap_guiu   Valid script path not specifiedu   %s = %su   libu   prefixu   installation failed.(   u   consoleu   gui(J   R   R   t   FalseR    R1   R   RI   RL   RJ   RK   R`   R   R[   R\   R   Ra   R   RQ   R^   R_   R   R   R   t   Truet   recordR4   t   dont_write_bytecodet   tempfilet   mkdtempt
   source_dirR/   t
   target_dirt   infolistt
   isinstanceR   R   R   t   strt	   file_sizeR   R   R   t
   startswithR   R   R   t   copy_streamR   t   byte_compilet	   Exceptiont   warningt   basenamet   maket   set_executable_modet   extendRV   R   t   valuest   prefixt   suffixt   flagst   jsont   loadR   Rc   t   itemsR	   Rq   t   write_shared_locationst   write_installed_filest	   exceptiont   rollbackt   shutilt   rmtree(C   R%   R   t   makert   kwargsR   t   warnert   lib_onlyR(   Rd   R   Re   t   metadata_namet   wheel_metadata_namet   record_nameRf   Rg   t   bwfRo   Rr   Ri   Rj   Rk   R   R   Rn   t   readerR   R   t   data_pfxt   info_pfxt
   script_pfxt   fileopt   bct   outfilest   workdirt   zinfot   arcnamet	   u_arcnamet   kindt   valueR~   t   _R   t	   is_scriptt   whereR   t   outfilet	   newdigestt   pycRl   t   worknameR   t	   filenamest   distt   commandst   ept   epdataR   R,   t   dR-   t   st   console_scriptst   gui_scriptst
   script_dirt   scriptt   options(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   install  sD   	

%

	
		 		
#
"		
		

c         C  sG   t  d  k rC t j j t   t d  t j d   } t	 |  a  n  t  S(   Nu   dylib-cachei   (
   t   cacheR/   R    R1   R   R   R   R4   RK   R   (   R%   R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   _get_dylib_cache  s
    c         C  s  t  j j |  j |  j  } d |  j |  j f } d | } t j | d  } t j	 d  } g  } t
 | d  w} y\| j |  G} | |  }	 t j |	  }
 |  j   } | j |  } t  j j | j |  } t  j j |  s t  j |  n  x |
 j   D] \ } } t  j j | t |   } t  j j |  sHt } nQ t  j |  j } t j j |  } | j |  } t j | j   } | | k } | r| j | |  n  | j | | f  qWWd  QXWn t k
 rn XWd  QX| S(   Nu   %s-%su   %s.dist-infou
   EXTENSIONSu   utf-8u   r(    R    R1   R   RI   RL   RJ   RK   R`   R[   R\   R   Ra   R   R   R  t   prefix_to_dirR   R   t   makedirsR   R   RX   R   t   statt   st_mtimet   datetimet   fromtimestampt   getinfot	   date_timet   extractR   Rb   (   R%   R(   Rd   Re   R   Rf   R2   Rg   Rn   Ro   R)   R  R   t
   cache_baseRJ   R   t   destR  t	   file_timeRV   t
   wheel_time(    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   _get_extensions  s>    
	!
c         C  s
   t  |   S(   uM   
        Determine if a wheel is compatible with the running system.
        (   t   is_compatible(   R%   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR%    s    c         C  s   t  S(   uP   
        Determine if a wheel is asserted as mountable by its metadata.
        (   R   (   R%   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   is_mountable  s    c         C  s
  t  j j t  j j |  j |  j   } |  j   sL d | } t |   n  |  j   sq d | } t |   n  | t	 j k r t
 j d |  ns | r t	 j j |  n t	 j j d |  |  j   } | rt t	 j k r t	 j j t  n  t j | |  n  d  S(   Nu)   Wheel %s not compatible with this Python.u$   Wheel %s is marked as not mountable.u   %s already in pathi    (   R    R1   RS   R   RI   RL   R%  R   R&  R4   R   R   R   t   insertR$  t   _hookt	   meta_pathR*   (   R%   R   R(   t   msgR)   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   mount  s"    '

c         C  s   t  j j t  j j |  j |  j   } | t j k rI t j d |  n] t j j	 |  | t
 j k rx t
 j	 |  n  t
 j s t
 t j k r t j j	 t
  q n  d  S(   Nu   %s not in path(   R    R1   RS   R   RI   RL   R4   R   R   R.   R(  R#   R)  (   R%   R(   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   unmount  s    '	c         C  s  t  j j |  j |  j  } d |  j |  j f } d | } d | } t j | t  } t j | d  } t j | d  } t	 j
 d  } t | d  }	 |	 j |   }
 | |
  } t |  } Wd  QX| d j d	 d
  } t g  | D] } t |  ^ q  } i  } |	 j |  D } t d |  , } x" | D] } | d } | | | <q8WWd  QXWd  QXx<|	 j   D].} | j } t | t  r| } n | j d  } d | k rt d |   n  | j d  rqon  | | } | d rt | j  | d k rt d |   n  | d
 ro| d
 j d d
  \ } } |	 j |   } | j   } Wd  QX|  j | |  \ } } | | k rt d |   qqoqoWWd  QXd  S(   Nu   %s-%su   %s.datau   %s.dist-infou   WHEELu   RECORDu   utf-8u   ru   Wheel-Versionu   .i   R   i    u   ..u   invalid entry in wheel: %ru   /RECORD.jwsi   u   size mismatch for %su   =u   digest mismatch for %s(   R    R1   R   RI   RL   RJ   RK   R`   R   R[   R\   R   Ra   R   RQ   R^   R_   R   R   R   R   R   R   R   R   R   R   R   (   R%   R(   Rd   R   Re   R   R   R   Rf   Rg   R   Ro   Rr   Ri   Rj   Rk   R   Rn   R   R   R   R   R   R   R   R   R~   R  R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyRT     sT    

%
		
#
c         K  s  d   } d   } t  j j |  j |  j  } d |  j |  j f } d | } t j | d  }	 t   (}
 t	 | d   } i  } x | j
   D] } | j } t | t  r | } n | j d  } | |	 k r q n  d | k r t d	 |   n  | j | |
  t  j j |
 t |   } | | | <q WWd
 QX| | |  \ } } | | |  } | r| | |  \ } } | r| | k r| | |  n  | d
 k rt j d d d d d |
  \ } } t  j |  n= t  j j |  st d |   n  t  j j | |  j  } t | j    } t  j j |
 |  } | | f } |  j | |
 |  |  j | |  | d
 k rt j | |  qn  Wd
 QX| S(   u  
        Update the contents of a wheel in a generic way. The modifier should
        be a callable which expects a dictionary argument: its keys are
        archive-entry paths, and its values are absolute filesystem paths
        where the contents the corresponding archive entries can be found. The
        modifier is free to change the contents of the files pointed to, add
        new entries and remove entries, before returning. This method will
        extract the entire contents of the wheel to a temporary location, call
        the modifier, and then use the passed (and possibly updated)
        dictionary to write a new wheel. If ``dest_dir`` is specified, the new
        wheel is written there -- otherwise, the original wheel is overwritten.

        The modifier should return True if it updated the wheel, else False.
        This method returns the same value the modifier returns.
        c         S  sh   d  } } d | t f } | |  k r3 d | } n  | |  k r^ |  | } t d |  j } n  | | f S(   Nu   %s/%su   %s/PKG-INFOR1   (   R/   R   R
   RK   (   t   path_mapRe   RK   R1   R   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   get_version1  s    

c   	      S  s'  d  } y t |   } |  j d  } | d k  r= d |  } ng g  |  | d j d  D] } t |  ^ qU } | d c d 7<d |  |  d j d   | D  f } Wn! t k
 r t j d	 |   n X| r#t	 d
 |  } | | _
 | j t  } | j d
 | d |  t j d |  |  n  d  S(   Nu   -i    u   %s+1i   u   .iu   %s+%sc         s  s   |  ] } t  |  Vq d  S(   N(   R   (   t   .0Rj   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pys	   <genexpr>F  s    u0   Cannot update non-compliant (PEP-440) version %rR1   t   legacyu   Version updated from %r to %r(   R/   R   R}   RQ   R_   R   R   R   R   R
   RK   R   R   R   (	   RK   R1   t   updatedR-   Rj   R  R   t   mdR0  (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   update_version;  s(    0
!		u   %s-%su   %s.dist-infou   RECORDu   ru   utf-8u   ..u   invalid entry in wheel: %rNR   u   .whlR   u   wheel-update-t   diru   Not a directory: %r(   R    R1   R   RI   RL   RJ   RK   R`   R   R   R   R   R   R   R   R  R   R/   R   t   mkstempt   closeR   R   R   R   R   R   t   copyfile(   R%   t   modifiert   dest_dirR   R.  R3  R(   Rd   Re   R   R   Rg   R-  R   R   R   R1   t   original_versionR  t   modifiedt   current_versiont   fdt   newpathR   R   RV   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR'      sX    	
	
		(   i   i   N(   R>   R?   t   __doc__R   R   R/   R   R&   t   propertyRL   RX   RY   R   Rp   R]   RV   R   R   R   R   R   R   R  R  R$  R%  R&  R+  R,  RT   R'   (    (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR@      s2   )							h				"				6c          C  s  t  g }  t  d } xG t t j d d d d  D]( } |  j d j | t |  g   q1 Wg  } xL t j   D]> \ } } } | j	 d  rp | j | j
 d d  d  qp qp W| j   t d k r | j d t  n  | j d  g  } t g } t j d	 k r=t j d
 t  } | r=| j   \ }	 } } }
 t |  } |
 g } |
 d k rg| j d  n  |
 d k r| j d  n  |
 d k r| j d  n  |
 d k r| j d  n  |
 d k r| j d  n  x` | d k r6x@ | D]8 } d |	 | | | f } | t k r| j |  qqW| d 8} qWq=n  xH | D]@ } x7 | D]/ }
 | j d j t |  d f  | |
 f  qQWqDWxw t |   D]i \ } } | j d j t | f  d d f  | d k r| j d j t | d f  d d f  qqWxw t |   D]i \ } } | j d j d | f  d d f  | d k r| j d j d | d f  d d f  qqWt |  S(   uG   
    Return (pyver, abi, arch) tuples compatible with this Python.
    i    i   iu    u   .abiu   .i   u   noneu   darwinu   (\w+)_(\d+)_(\d+)_(\w+)$u   i386u   ppcu   fatu   x86_64u   fat3u   ppc64u   fat64u   intelu	   universalu   %s_%s_%s_%su   anyu   py(   u   i386u   ppc(   u   i386u   ppcu   x86_64(   u   ppc64u   x86_64(   u   i386u   x86_64(   u   i386u   x86_64u   intelu   ppcu   ppc64(   R   t   rangeR4   t   version_infoR   R   R   R7   t   get_suffixesR   RQ   R   R   R'  R   t   platformt   reRO   R|   R_   t
   IMP_PREFIXR   t   set(   t   versionst   majort   minort   abisR   R  R2   t   archesRU   RJ   RG   t   matchesRO   R  RF   Rj   RK   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   compatible_tags  s`    	
$&$
		1%0%0c         C  s   t  |  t  s t |   }  n  t } | d  k r9 t } n  xN | D]F \ } } } | |  j k r@ | |  j k r@ | |  j k r@ t } Pq@ q@ W| S(   N(	   R   R@   R   R/   t   COMPATIBLE_TAGSRE   RF   RG   R   (   t   wheelRY   R2   t   verRF   RG   (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyR%    s    	-(T   t
   __future__R    R   R[   R  t   distutils.utilt	   distutilst   emailR   R   R7   R   t   loggingR    R`   RE  R   R4   R   R   Ru   R   R   t   compatR   R   R   R   R   t   databaseR	   Rp   R
   R   t   utilR   R   R   R   R   R   R   R   R   RK   R   R   t	   getLoggerR>   R   R/   R  t   hasattrRF  RD  R   R   R   RB  RD   R   t   get_platformR   R   R   R   t   compilet
   IGNORECASEt   VERBOSERR   RN   Rv   R{   Rz   Ry   R!   R   t   objectR"   R(  R@   RN  RO  R%  (    (    (    sj   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/distlib/wheel.pyt   <module>   s   (@			

'				#	    	>	