ó
ÏrOc           @   sC  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  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   logNs   &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<   /var/www/python/setuptools-0.6c9/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<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt   find   s    
(    (   R   R   R   (    (   R   R   s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt	   re_finder   s    	c         C   s   |  s
 | St  j j |  | ƒ S(   N(   t   osR   t   join(   t   prefixt   suffix(    (    s<   /var/www/python/setuptools-0.6c9/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<   /var/www/python/setuptools-0.6c9/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<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyR,   0   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   rbR"   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<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt   externals_finder;   s$    	

s%   name="([^"]+)"(?![^>]+deleted="true")c         c   s  t  | d ƒ } | j ƒ  } | j ƒ  | j d ƒ sC | j d ƒ r± xÄ t t j | j d ƒ d ƒ D]G } | sc t | ƒ d k r˜ | d d k r˜ qc n  t	 |  | d	 ƒ Vqc WnY | j d
 ƒ rú xG t
 j | ƒ D]# } t	 |  t | j d ƒ ƒ ƒ VqÐ Wn t j d |  ƒ d  S(   NR   t   9t   8s   

i   i   i   t   deletei    s   <?xmls&   unrecognized .svn/entries format in %s(   R   R   R   t
   startswitht   mapt   strR8   R4   R5   R   t   entries_patternR   R   R   R   t   warn(   R   R   R   R
   t   recordR   (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt   entries_finderU   s    
&)$s   CVS/Entriess   ^\w?/([^/]+)/s   .svn/entriess   .svn/dir-propss   .svn/dir-prop-baseR    c           B   sT   e  Z d  Z d d d d d f d g Z i  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   RK   t   check_readmet   check_metadatat   make_distributiont   getattrt   distributiont   archive_files(   t   selft   ei_cmdRL   t   fileR
   (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt   runŒ   s    "


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   (   RW   (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyR]   ›   s
    !c         C   sK   d } x> | D] } t  j j | ƒ r d  Sq W|  j d d j | ƒ ƒ d  S(   Nt   READMEs
   README.txts,   standard file not found: should have one of s   , (   Rc   s
   README.txt(   R   R   t   existsRF   R   (   RW   t   altsR   (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyRQ   ¥   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   linkRK   (   R\   t   make_release_treeR   R   R   t   hasattrRd   t   unlinkt	   copy_fileRN   t   save_version_info(   RW   t   base_dirt   filest   dest(    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyRg   °   s    !N(   s   formats=Ns6   formats for source distribution (comma-separated list)(   s	   dist-dir=RJ   sF   directory to put the source distribution archive(s) in [default: dist](
   t   __name__t
   __module__t   __doc__t   Nonet   user_optionst   negative_optRZ   R]   RQ   Rg   (    (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyR    |   s     			
	(   s   &lt;R   (   s   &gt;R   (   s   &quot;R   (   s   &apos;R   (   s   &amp;R   (   t   distutils.command.sdistR    R\   t   distutils.utilR   t	   distutilsR   R   t   reR^   R#   R   R   Rr   R   R   R(   R,   R>   t   compilet   IRE   RH   t   MR)   (    (    (    s<   /var/www/python/setuptools-0.6c9/setuptools/command/sdist.pyt   <module>   s&   0						