ó
©9Vc           @   sR   d  Z  d d l Z d d l Z d d l Z e j d ƒ Z d „  Z d d „ Z d S(   s   
Archive tools for wheel.
iÿÿÿÿNt   wheelc         C   sW   t  j j t  j ƒ } t  j j |  ƒ }  z t  j | ƒ t |  ƒ SWd t  j | ƒ Xd S(   sW   Archive all files under `base_dir` in a whl file and name it like
    `base_name`.
    N(   t   ost   patht   abspatht   curdirt   chdirt   make_wheelfile_inner(   t	   base_namet   base_dirt   olddir(    (    s,   /tmp/pip-build-5Z5nTX/wheel/wheel/archive.pyt   archive_wheelfile   s    t   .c            sO  |  d } t  j d | | ƒ t j t | d ƒ d d t j ƒ‰  i d d 6d d	 6d
 d 6} g  } ‡  f d †  } x¢ t j | ƒ D]‘ \ } } } x | D]w }	 t j j	 t j j
 | |	 ƒ ƒ }
 t j j |
 ƒ r— | j d ƒ r| j | j |	 d ƒ |
 f ƒ q| |
 ƒ q— q— Wq W| j ƒ  x | D] \ } }
 | |
 ƒ q'Wˆ  j ƒ  | S(   sh   Create a whl file from all the files under 'base_dir'.

    Places .dist-info at the end of the archive.s   .whls#   creating '%s' and adding '%s' to its   wb+t   wt   compressioni   t   WHEELi   t   METADATAi   t   RECORDc            s%   ˆ  j  |  |  ƒ t j d |  ƒ d  S(   Ns   adding '%s'(   t   writet   logt   info(   R   (   t   zip(    s,   /tmp/pip-build-5Z5nTX/wheel/wheel/archive.pyt	   writefile)   s    s
   .dist-infoi    (   R   R   t   zipfilet   ZipFilet   opent   ZIP_DEFLATEDR   t   walkR   t   normpatht   joint   isfilet   endswitht   appendt   gett   sortt   close(   R   R   t   zip_filenamet   scoret   deferredR   t   dirpatht   dirnamest	   filenamest   nameR   (    (   R   s,   /tmp/pip-build-5Z5nTX/wheel/wheel/archive.pyR      s&    
!"

(	   t   __doc__t   loggingt   os.pathR   R   t	   getLoggerR   R
   R   (    (    (    s,   /tmp/pip-build-5Z5nTX/wheel/wheel/archive.pyt   <module>   s   	