ó
OyTLc           @   sS  d  d l  m Z d  d l m 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 m Z d  d! d" d# d$ g Z d „  Z d d „ Z d „  Z d d „ Z d d „ Z d „  Z e j d e j ƒ Z d „  Z e d ƒ e e j d e j ƒ ƒ f e d ƒ e f e d ƒ e f e d ƒ e f g Z d e f d „  ƒ  YZ d S(%   iÿÿÿÿ(   t   sdist(   t   convert_path(   t   logN(   t   globs   &lt;t   <s   &gt;t   >s   &quot;t   "s   &apos;t   's   &amp;t   &c         C   s-   x& t  D] \ } } |  j | | ƒ }  q W|  S(   N(   t   entitiest   replace(   t   datat   oldt   new(    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   unescape   s    c            s   ‡ ‡  f d †  } | S(   Nc         3   su   t  | d ƒ } | j ƒ  } | j ƒ  xI ˆ j | ƒ D]8 } | j d ƒ } ˆ  r_ ˆ  | ƒ } n  t |  | ƒ Vq5 Wd  S(   Nt   rUi   (   t   opent   readt   closet   finditert   groupt   joinpath(   t   dirnamet   filenamet   fR   t   matcht   path(   t   postproct   pattern(    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   find   s    
(    (   R   R   R   (    (   R   R   s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt	   re_finder   s    	c         C   s   |  s
 | St  j j |  | ƒ S(   N(   t   osR   t   join(   t   prefixt   suffix(    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyR      s    t    c         c   s@   x9 t  j d ƒ D]( } x | j ƒ  |  ƒ D] } | Vq) Wq Wd S(   s%   Find all files under revision controls   setuptools.file_findersN(   t   pkg_resourcest   iter_entry_pointst   load(   R   t   ept   item(    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   walk_revctrl+   s    c         c   s¤   x t  D]• \ } } t |  | ƒ } t j j | ƒ r xe | |  | ƒ D]Q } t j j | ƒ rd | VqD t j j | ƒ rD x t | ƒ D] } | Vqƒ WqD qD Wq q Wd  S(   N(   t   findersR   R   R   t   isfilet   isdirt   _default_revctrl(   R   R   t   finderR(   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyR-   1   s    c   	      c   s  t  } t | d ƒ } x« t | j d ƒ D]‰ } | j ƒ  } t | ƒ d k r( | \ } } | j t | ƒ ƒ } | d k rŽ | d k rŽ t } q± | d k r± | r± | j	 ƒ  Pq± q( q( W| j	 ƒ  d Sx; | j
 ƒ  D]- } | j ƒ  } | rÐ t |  | d ƒ VqÐ qÐ Wd S(	   s$   Find any 'svn:externals' directoriest   rtR#   i   t   Ks   svn:externalst   VNi    (   t   FalseR   t   itert   readlinet   splitt   lenR   t   intt   TrueR   t
   splitlinesR   (	   R   R   t   foundR   t   linet   partst   kindt   lengthR   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   externals_finder<   s$    	

s%   name="([^"]+)"(?![^>]+deleted="true")c      	   c   s  t  | d ƒ } | j ƒ  } | j ƒ  | j d ƒ sR | j d ƒ sR | j d ƒ rÀ xÄ t t j | j d ƒ d ƒ D]G } | sr t | ƒ d k r§ | d d	 k r§ qr n  t	 |  | d
 ƒ Vqr WnY | j d ƒ r	xG t
 j | ƒ D]# } t	 |  t | j d ƒ ƒ ƒ Vqß Wn t j d |  ƒ d  S(   NR   t   10t   9t   8s   

i   i   i   t   deletei    s   <?xmls&   unrecognized .svn/entries format in %s(   R   R   R   t
   startswitht   mapt   strR9   R5   R6   R   t   entries_patternR   R   R   R   t   warn(   R   R   R   R   t   recordR   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   entries_finderV   s    
-&)$s   CVS/Entriess   ^\w?/([^/]+)/s   .svn/entriess   .svn/dir-propss   .svn/dir-prop-baseR    c           B   s]   e  Z d  Z d d d d d f d g Z i  Z d
 „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   s=   Smart sdist that finds anything supported by revision controls   formats=s6   formats for source distribution (comma-separated list)s	   keep-tempt   ks1   keep the distribution tree around after creating s   archive file(s)s	   dist-dir=t   dsF   directory to put the source distribution archive(s) in [default: dist]c         C   sÀ   |  j  d ƒ |  j d ƒ } | j |  _ |  j j t j j | j d ƒ ƒ |  j ƒ  |  j	 ƒ  |  j
 ƒ  t |  j d g  ƒ } x< |  j D]1 } d d | f } | | k r‡ | j | ƒ q‡ q‡ Wd  S(   Nt   egg_infos   SOURCES.txtt
   dist_filesR    R#   (   t   run_commandt   get_finalized_commandt   filelistt   appendR   R   R    RM   t   check_readmet   check_metadatat   make_distributiont   getattrt   distributiont   archive_files(   t   selft   ei_cmdRN   t   fileR   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   runŽ   s    "


c         C   s  d |  j  j g } xÂ | D]º } t | t ƒ r | } d } x: | D]2 } t j j | ƒ rA d } |  j j | ƒ PqA qA W| sÓ |  j	 d d j
 | ƒ ƒ qÓ q t j j | ƒ rÂ |  j j | ƒ q |  j	 d | ƒ q Wd d	 g } xB | D]: } t t j j t | ƒ ƒ } | rê |  j j | ƒ qê qê W|  j  j ƒ  r_|  j d
 ƒ } |  j j | j ƒ  ƒ n  |  j  j ƒ  r–|  j d ƒ }	 |  j j |	 j ƒ  ƒ n  |  j  j ƒ  rÍ|  j d ƒ }
 |  j j |
 j ƒ  ƒ n  |  j  j ƒ  r|  j d ƒ } |  j j | j ƒ  ƒ n  d  S(   Nt   READMEs
   README.txti    i   s,   standard file not found: should have one of s   , s   standard file '%s' not founds   test/test*.pys	   setup.cfgt   build_pyt	   build_extt
   build_clibt   build_scripts(   R]   s
   README.txt(   RW   t   script_namet
   isinstancet   tupleR   R   t   existsRQ   RR   RH   R    t   filterR+   R   t   extendt   has_pure_modulesRP   t   get_source_filest   has_ext_modulest   has_c_librariest   has_scripts(   RY   t	   standardst   fnt   altst   got_itt   optionalR   t   filesR^   R_   R`   Ra   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   add_defaults   sD    	c         C   sC   y t  j |  ƒ Wn+ t j ƒ  d j j j d j ƒ  ‚  n Xd  S(   Ni   t   template(   t   _sdistt   read_templatet   syst   exc_infot   tb_nextt   tb_framet   f_localsR   (   RY   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyRv   Ê   s
    !c         C   sK   d } x> | D] } t  j j | ƒ r d  Sq W|  j d d j | ƒ ƒ d  S(   NR]   s
   README.txts,   standard file not found: should have one of s   , (   s   READMEs
   README.txt(   R   R   Re   RH   R    (   RY   Ro   R   (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyRS   Ô   s    c         C   sƒ   t  j |  | | ƒ t j j | d ƒ } t t d ƒ ri t j j | ƒ ri t j | ƒ |  j d | ƒ n  |  j	 d ƒ j
 | ƒ d  S(   Ns	   setup.cfgt   linkRM   (   Ru   t   make_release_treeR   R   R    t   hasattrRe   t   unlinkt	   copy_fileRP   t   save_version_info(   RY   t   base_dirRr   t   dest(    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyR}   ß   s    !N(   s   formats=Ns6   formats for source distribution (comma-separated list)(   s	   dist-dir=RL   sF   directory to put the source distribution archive(s) in [default: dist](   t   __name__t
   __module__t   __doc__t   Nonet   user_optionst   negative_optR\   Rs   Rv   RS   R}   (    (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyR    ~   s     			-	
	(   s   &lt;R   (   s   &gt;R   (   s   &quot;R   (   s   &apos;R   (   s   &amp;R   (   t   distutils.command.sdistR    Ru   t   distutils.utilR   t	   distutilsR   R   t   reRw   R$   R   R	   R   R‡   R   R   R)   R-   R?   t   compilet   IRG   RJ   t   MR*   (    (    (    s<   /usr/lib/python2.7/dist-packages/setuptools/command/sdist.pyt   <module>   s(   0						