ó
µ¼÷Xc           @   s¡   d  Z  d d l m Z y e e Z Wn e k
 r= e Z n Xe sr d d l m	 Z	 d „  Z
 d „  Z d „  Z n+ d d l m Z d „  Z
 d	 „  Z d
 „  Z d S(   sT   Tools for reading and writing PKG-INFO / METADATA without caring
about the encoding.iÿÿÿÿ(   t   Parser(   t	   Generatorc         C   s   t  ƒ  j |  ƒ S(   N(   R    t   parsestr(   t   bytestr(    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyt   read_pkg_info_bytes   s    c         C   s.   t  |  d ƒ  } t ƒ  j | ƒ } Wd  QX| S(   Nt   r(   t   openR    t   parse(   t   patht   headerst   message(    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyt   read_pkg_info   s    c         C   s5   t  |  d ƒ   } t | d d ƒj | ƒ Wd  QXd  S(   Nt   wt   maxheaderleni    (   R   R   t   flatten(   R   R
   t   metadata(    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyt   write_pkg_info   s    (   t   BytesGeneratorc         C   s.   |  j  d d d d ƒ } t ƒ  j | ƒ } | S(   Nt   encodingt   asciit   errorst   surrogateescape(   t   decodeR    R   (   R   R	   R
   (    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyR      s    c         C   s:   t  |  d d d d d ƒ } t ƒ  j | ƒ } Wd  QX| S(   NR   R   R   R   R   (   R   R    R   (   R   R	   R
   (    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyR   "   s
    c         C   s5   t  |  d ƒ   } t | d d ƒj | ƒ Wd  QXd  S(   Nt   wbR   i    (   R   R   R   (   R   R
   t   out(    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyR   )   s    N(   t   __doc__t   email.parserR    t   unicodet   Falset   _PY3t	   NameErrort   Truet   email.generatorR   R   R   R   R   (    (    (    s,   /tmp/pip-build-g7Urym/wheel/wheel/pkginfo.pyt   <module>   s   

				