
§|j®`  ã               @   sd  d  Z  d d l m Z 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 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 m Z d d	 l m Z d d
 l m Z d d l m Z d d l m Z d d l m Z d d l m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& d d l' j( Z( d d l) m* Z* d d l+ m, Z, d d „  Z- Gd d „  d e ƒ Z. Gd d „  d e ƒ Z Gd d „  d e ƒ Z/ d d „  Z0 d d „  Z1 d d „  Z2 d d  „  Z3 d! d" „  Z4 d# d$ „  Z5 d% d& „  Z6 d' d( „  Z7 d) d* d+ „ Z8 d, d- „  Z9 d. d/ „  Z: d S)0zUsetuptools.command.egg_info

Create a distribution's .egg-info directory and contentsé    )ÚFileList)ÚDistutilsInternalError)Úconvert_path)ÚlogN)Úsix)Úmap)ÚCommand)Úsdist)Úwalk_revctrl)Úedit_config)Ú	bdist_egg)Úparse_requirementsÚ	safe_nameÚparse_versionÚsafe_versionÚyield_linesÚ
EntryPointÚiter_entry_pointsÚto_filename)Úglob)Ú	packagingc             C   sd  d } |  j  t j j ƒ } t j t j ƒ } d | f } xt | ƒ D]\ } } | t | ƒ d k } | d k rŸ | rˆ | d 7} qG | d | | f 7} qG d } t | ƒ }	 x‹| |	 k  r>| | }
 |
 d k rç | | d 7} nJ|
 d	 k r | | 7} n1|
 d
 k r| d } | |	 k  r<| | d k r<| d } | |	 k  rb| | d k rb| d } x* | |	 k  rŽ| | d k rŽ| d } qeW| |	 k r±| t j |
 ƒ 7} q1| | d | … } d } | d d k rñd } | d d … } | t j | ƒ 7} | d | f 7} | } n | t j |
 ƒ 7} | d 7} q´ W| sG | | 7} qG Wt j | d ƒ S)zö
    Translate a file path glob like '*.txt' in to a regular expression.
    This differs from fnmatch.translate which allows wildcards to match
    directory separators. It also knows about '**/' which matches any number of
    directories.
    Ú z[^%s]é   z**z.*z
(?:%s+%s)*r   Ú*ú?ú[ú!ú]ú^Nz[%s]z\Z(?ms))	ÚsplitÚosÚpathÚsepÚreÚescapeÚ	enumerateÚlenÚcompile)r   ÚpatÚchunksr"   Z
valid_charÚcÚchunkÚ
last_chunkÚiZ	chunk_lenÚcharZinner_iÚinnerZ
char_class© r0   úA/tmp/pip-build-5c7ija6t/setuptools/setuptools/command/egg_info.pyÚtranslate_pattern$   sT    



	r2   c               @   së   e  Z d  Z d Z d) d* d+ d, g Z d g Z d d i Z d d „  Z e d d „  ƒ Z	 e	 j
 d d „  ƒ Z	 d d „  Z d d „  Z d d d „ Z d d „  Z d d „  Z d d „  Z d  d! „  Z d" d# „  Z d$ d% „  Z d& d' „  Z d( S)-Úegg_infoz+create a distribution's .egg-info directoryú	egg-base=ÚeúLdirectory containing .egg-info directories (default: top of the source tree)útag-dateÚdú0Add date stamp (e.g. 20050528) to version numberú
tag-build=Úbú-Specify explicit tag to add to version numberúno-dateÚDú"Don't include date stamp [default]c             C   sL   d  |  _  d  |  _ d  |  _ d  |  _ d  |  _ d |  _ d |  _ d  |  _ d  S)Nr   F)Úegg_nameÚegg_versionÚegg_baser3   Ú	tag_buildÚtag_dateÚbroken_egg_infoÚvtags)Úselfr0   r0   r1   Úinitialize_options†   s    							zegg_info.initialize_optionsc             C   s   d  S)Nr0   )rG   r0   r0   r1   Útag_svn_revision“   s    zegg_info.tag_svn_revisionc             C   s   d  S)Nr0   )rG   Úvaluer0   r0   r1   rI   —   s    c             C   sO   t  t d t ƒ } | ƒ  } |  j ƒ  | d <d | d <t | t d | ƒ ƒ d S)z³
        Materialize the value of date into the
        build tag. Install build keys in a deterministic order
        to avoid arbitrary reordering on subsequent builds.
        ÚOrderedDictrC   r   rD   r3   N)ÚgetattrÚcollectionsÚdictÚtagsr   )rG   ÚfilenameZodictr3   r0   r0   r1   Úsave_version_infoœ   s
    	
zegg_info.save_version_infoc             C   sÜ  t  |  j j ƒ  ƒ |  _ |  j ƒ  |  _ |  j ƒ  |  _ t |  j ƒ } yK t	 | t
 j j ƒ } | ri d n d } t t | |  j |  j f ƒ ƒ Wn4 t k
 rÆ t j j d |  j |  j f ƒ ‚ Yn X|  j d  k r |  j j } | pë i  j d t j ƒ |  _ |  j d ƒ t |  j ƒ d |  _ |  j t j k rSt j j |  j |  j ƒ |  _ d |  j k rl|  j ƒ  |  j |  j j _ |  j j } | d  k	 rØ| j  |  j j! ƒ  k rØ|  j | _" t |  j ƒ | _# d  |  j _ d  S)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%sr   rB   z	.egg-infoú-)$r   ÚdistributionÚget_namer@   rO   rF   Útagged_versionrA   r   Ú
isinstancer   ÚversionÚVersionÚlistr   Ú
ValueErrorÚ	distutilsÚerrorsÚDistutilsOptionErrorrB   Úpackage_dirÚgetr    ÚcurdirÚensure_dirnamer   r3   r!   ÚjoinÚcheck_broken_egg_infoÚmetadataZ_patched_distÚkeyÚlowerÚ_versionÚ_parsed_version)rG   Úparsed_versionZ
is_versionÚspecÚdirsÚpdr0   r0   r1   Úfinalize_options«   s8    !	
$zegg_info.finalize_optionsFc             C   si   | r |  j  | | | ƒ nI t j j | ƒ re | d k rX | rX t j d | | ƒ d S|  j | ƒ d S)a¹  Write `data` to `filename` or delete if empty

        If `data` is non-empty, this routine is the same as ``write_file()``.
        If `data` is empty but not ``None``, this is the same as calling
        ``delete_file(filename)`.  If `data` is ``None``, then this is a no-op
        unless `filename` exists, in which case a warning is issued about the
        orphaned file (if `force` is false), or deleted (if `force` is true).
        Nz$%s not set in setup(), but %s exists)Ú
write_filer    r!   Úexistsr   ÚwarnÚdelete_file)rG   ÚwhatrP   ÚdataÚforcer0   r0   r1   Úwrite_or_delete_fileÚ   s    	zegg_info.write_or_delete_filec             C   s^   t  j d | | ƒ t j r+ | j d ƒ } |  j sZ t | d ƒ } | j | ƒ | j ƒ  d S)zªWrite `data` to `filename` (if not a dry run) after announcing it

        `what` is used in a log message to identify what is being written
        to the file.
        zwriting %s to %szutf-8ÚwbN)	r   Úinfor   ÚPY3ÚencodeÚdry_runÚopenÚwriteÚclose)rG   rr   rP   rs   Úfr0   r0   r1   rn   î   s    		zegg_info.write_filec             C   s*   t  j d | ƒ |  j s& t j | ƒ d S)z8Delete `filename` (if not a dry run) after announcing itzdeleting %sN)r   rw   rz   r    Úunlink)rG   rP   r0   r0   r1   rq   ü   s    	zegg_info.delete_filec             C   sE   |  j  j ƒ  } |  j r4 | j |  j ƒ r4 t | ƒ St | |  j ƒ S)N)rS   Úget_versionrF   Úendswithr   )rG   rW   r0   r0   r1   rU     s    
zegg_info.tagged_versionc             C   s¼   |  j  |  j ƒ |  j j } xX t d ƒ D]J } | j d | ƒ | j ƒ  } | |  | j t j	 j
 |  j | j ƒ ƒ q) Wt j	 j
 |  j d ƒ } t j	 j | ƒ r® |  j | ƒ |  j ƒ  d  S)Nzegg_info.writersÚ	installerznative_libs.txt)Úmkpathr3   rS   Zfetch_build_eggr   ÚrequireÚresolveÚnamer    r!   rb   ro   rq   Úfind_sources)rG   r‚   ÚepÚwriterÚnlr0   r0   r1   Úrun
  s    ,zegg_info.runc             C   s<   d } |  j  r | |  j  7} |  j r8 | t j d ƒ 7} | S)Nr   z-%Y%m%d)rC   rD   ÚtimeÚstrftime)rG   rW   r0   r0   r1   rO     s    		zegg_info.tagsc             C   sJ   t  j j |  j d ƒ } t |  j ƒ } | | _ | j ƒ  | j |  _ d S)z"Generate SOURCES.txt manifest filezSOURCES.txtN)	r    r!   rb   r3   Úmanifest_makerrS   Úmanifestr‹   Úfilelist)rG   Zmanifest_filenameÚmmr0   r0   r1   r‡   !  s
    	
zegg_info.find_sourcesc             C   sˆ   |  j  d } |  j t j k r7 t j j |  j | ƒ } t j j | ƒ r„ t j d d d d d | |  j	 ƒ |  j	 |  _
 | |  _	 d  S)Nz	.egg-inforR   éN   z¦
Note: Your current .egg-info directory has a '-' in its name;
this will not work correctly with "setup.py develop".

Please rename %s to %s to correct this problem.
)r@   rB   r    r`   r!   rb   ro   r   rp   r3   rE   )rG   Zbeir0   r0   r1   rc   )  s    zegg_info.check_broken_egg_infoN)r4   r5   r6   )r7   r8   r9   )r:   r;   r<   )r=   r>   r?   )Ú__name__Ú
__module__Ú__qualname__ÚdescriptionÚuser_optionsÚboolean_optionsÚnegative_optrH   ÚpropertyrI   ÚsetterrQ   rm   ru   rn   rq   rU   r‹   rO   r‡   rc   r0   r0   r0   r1   r3   v   s(   		/r3   c               @   s¸   e  Z d  Z d d „  Z d d „  Z d d „  Z d d „  Z d	 d
 „  Z d d „  Z d d „  Z	 d d „  Z
 d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d S)r   c             C   sÛ  |  j  | ƒ \ } } } } | d k rt |  j d d j | ƒ ƒ x“| D]% } |  j | ƒ sH t j d | ƒ qH Wnc| d k rÍ |  j d d j | ƒ ƒ x:| D]% } |  j | ƒ s¡ t j d | ƒ q¡ Wn
| d k r&|  j d	 d j | ƒ ƒ xá| D]% } |  j | ƒ sú t j d
 | ƒ qú Wn±| d k r|  j d d j | ƒ ƒ xˆ| D]% } |  j | ƒ sSt j d | ƒ qSWnX| d k rä|  j d | d j | ƒ f ƒ x)| D]+ } |  j	 | | ƒ s²t j d | | ƒ q²Wnó | d k rI|  j d | d j | ƒ f ƒ xÄ | D]+ } |  j
 | | ƒ st j d | | ƒ qWnŽ | d k rˆ|  j d | ƒ |  j | ƒ s×t j d | ƒ nO | d k rÇ|  j d | ƒ |  j | ƒ s×t j d | ƒ n t d | ƒ ‚ d  S)NÚincludezinclude ú z%warning: no files found matching '%s'Úexcludezexclude z9warning: no previously-included files found matching '%s'zglobal-includezglobal-include z>warning: no files found matching '%s' anywhere in distributionzglobal-excludezglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionzrecursive-includezrecursive-include %s %sz:warning: no files found matching '%s' under directory '%s'zrecursive-excludezrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'Úgraftzgraft z+warning: no directories found matching '%s'Úprunezprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')Z_parse_template_lineÚdebug_printrb   rœ   r   rp   rž   Úglobal_includeÚglobal_excludeÚrecursive_includeÚrecursive_excluderŸ   r    r   )rG   ÚlineÚactionÚpatternsÚdirZdir_patternÚpatternr0   r0   r1   Úprocess_template_line<  sd    								
	
zFileList.process_template_linec             C   so   d } xb t  t |  j ƒ d d d ƒ D]A } | |  j | ƒ r& |  j d |  j | ƒ |  j | =d } q& W| S)z†
        Remove all files from the file list that match the predicate.
        Return True if any matching files were removed
        Fr   z
 removing Téÿÿÿÿr¬   )Úranger&   Úfilesr¡   )rG   Ú	predicateÚfoundr-   r0   r0   r1   Ú_remove_files…  s    &

zFileList._remove_filesc             C   s0   d d „  t  | ƒ Dƒ } |  j | ƒ t | ƒ S)z#Include files that match 'pattern'.c             S   s(   g  |  ] } t  j j | ƒ s | ‘ q Sr0   )r    r!   Úisdir)Ú.0r~   r0   r0   r1   ú
<listcomp>”  s   	 z$FileList.include.<locals>.<listcomp>)r   ÚextendÚbool)rG   rª   r°   r0   r0   r1   rœ   ’  s    zFileList.includec             C   s   t  | ƒ } |  j | j ƒ S)z#Exclude files that match 'pattern'.)r2   r±   Úmatch)rG   rª   r·   r0   r0   r1   rž   ˜  s    zFileList.excludec             C   sN   t  j j | d | ƒ } d d „  t | d d ƒDƒ } |  j | ƒ t | ƒ S)zN
        Include all files anywhere in 'dir/' that match the pattern.
        z**c             S   s(   g  |  ] } t  j j | ƒ s | ‘ q Sr0   )r    r!   r²   )r³   r~   r0   r0   r1   r´   ¢  s   	 z.FileList.recursive_include.<locals>.<listcomp>Ú	recursiveT)r    r!   rb   r   rµ   r¶   )rG   r©   rª   Zfull_patternr°   r0   r0   r1   r¤   �  s    zFileList.recursive_includec             C   s.   t  t j j | d | ƒ ƒ } |  j | j ƒ S)zM
        Exclude any file anywhere in 'dir/' that match the pattern.
        z**)r2   r    r!   rb   r±   r·   )rG   r©   rª   r·   r0   r0   r1   r¥   §  s    zFileList.recursive_excludec             C   s)   t  j j | ƒ } |  j | ƒ t | ƒ S)zInclude all files from 'dir/'.)r[   r�   Úfindallrµ   r¶   )rG   r©   r°   r0   r0   r1   rŸ   ®  s    zFileList.graftc             C   s+   t  t j j | d ƒ ƒ } |  j | j ƒ S)zFilter out files from 'dir/'.z**)r2   r    r!   rb   r±   r·   )rG   r©   r·   r0   r0   r1   r    ´  s    zFileList.prunec                sg   |  j  d k r |  j ƒ  t t j j d | ƒ ƒ ‰  ‡  f d d †  |  j  Dƒ } |  j | ƒ t | ƒ S)z“
        Include all files anywhere in the current directory that match the
        pattern. This is very inefficient on large file trees.
        Nz**c                s%   g  |  ] } ˆ  j  | ƒ r | ‘ q Sr0   )r·   )r³   r~   )r·   r0   r1   r´   Á  s   	 z+FileList.global_include.<locals>.<listcomp>)Úallfilesr¹   r2   r    r!   rb   rµ   r¶   )rG   rª   r°   r0   )r·   r1   r¢   ¹  s    
zFileList.global_includec             C   s+   t  t j j d | ƒ ƒ } |  j | j ƒ S)zD
        Exclude all files anywhere that match the pattern.
        z**)r2   r    r!   rb   r±   r·   )rG   rª   r·   r0   r0   r1   r£   Å  s    zFileList.global_excludec             C   sN   | j  d ƒ r | d  d … } t | ƒ } |  j | ƒ rJ |  j j | ƒ d  S)Núr   r¬   )r�   r   Ú
_safe_pathr®   Úappend)rG   Úitemr!   r0   r0   r1   r½   Ì  s
    zFileList.appendc             C   s    |  j  j t |  j | ƒ ƒ d  S)N)r®   rµ   Úfilterr¼   )rG   Úpathsr0   r0   r1   rµ   Ô  s    zFileList.extendc             C   s"   t  t |  j |  j ƒ ƒ |  _ d S)zÜ
        Replace self.files with only safe paths

        Because some owners of FileList manipulate the underlying
        ``files`` attribute directly, this method must be called to
        repair those paths.
        N)rY   r¿   r¼   r®   )rG   r0   r0   r1   Ú_repair×  s    zFileList._repairc             C   sÉ   d } t  j | ƒ } | d  k r6 t j d | ƒ d St  j | d ƒ } | d  k rk t j | | d ƒ d Sy, t j j | ƒ s’ t j j | ƒ r– d SWn+ t k
 rÄ t j | | t	 j
 ƒ  ƒ Yn Xd  S)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFzutf-8T)Úunicode_utilsÚfilesys_decoder   rp   Z
try_encoder    r!   ro   ÚUnicodeEncodeErrorÚsysÚgetfilesystemencoding)rG   r!   Zenc_warnZu_pathZ	utf8_pathr0   r0   r1   r¼   á  s    $zFileList._safe_pathN)r“   r”   r•   r«   r±   rœ   rž   r¤   r¥   rŸ   r    r¢   r£   r½   rµ   rÁ   r¼   r0   r0   r0   r1   r   9  s   I

r   c               @   sˆ   e  Z d  Z d Z d d „  Z d d „  Z d d „  Z d d	 „  Z d
 d „  Z d d „  Z	 e
 d d „  ƒ Z d d „  Z d d „  Z d S)rŽ   zMANIFEST.inc             C   s(   d |  _  d |  _ d |  _ d |  _ d  S)Nr   )Zuse_defaultsr    Zmanifest_onlyZforce_manifest)rG   r0   r0   r1   rH   ü  s    			z!manifest_maker.initialize_optionsc             C   s   d  S)Nr0   )rG   r0   r0   r1   rm     s    zmanifest_maker.finalize_optionsc             C   s†   t  ƒ  |  _ t j j |  j ƒ s+ |  j ƒ  |  j ƒ  t j j |  j ƒ rT |  j	 ƒ  |  j
 ƒ  |  j j ƒ  |  j j ƒ  |  j ƒ  d  S)N)r   r�   r    r!   ro   r�   Úwrite_manifestÚadd_defaultsÚtemplateZread_templateÚprune_file_listÚsortZremove_duplicates)rG   r0   r0   r1   r‹     s    



zmanifest_maker.runc             C   s"   t  j | ƒ } | j t j d ƒ S)Nú/)rÂ   rÃ   Úreplacer    r"   )rG   r!   r0   r0   r1   Ú_manifest_normalize  s    z"manifest_maker._manifest_normalizec                sY   ˆ  j  j ƒ  ‡  f d d †  ˆ  j  j Dƒ } d ˆ  j } ˆ  j t ˆ  j | f | ƒ d S)zo
        Write the file list in 'self.filelist' to the manifest file
        named by 'self.manifest'.
        c                s   g  |  ] } ˆ  j  | ƒ ‘ q Sr0   )rÎ   )r³   r~   )rG   r0   r1   r´     s   	 z1manifest_maker.write_manifest.<locals>.<listcomp>zwriting manifest file '%s'N)r�   rÁ   r®   r�   Úexecutern   )rG   r®   Úmsgr0   )rG   r1   rÇ     s    zmanifest_maker.write_manifestc             C   s#   |  j  | ƒ s t j |  | ƒ d  S)N)Ú_should_suppress_warningr	   rp   )rG   rÐ   r0   r0   r1   rp   !  s    zmanifest_maker.warnc             C   s   t  j d |  ƒ S)z;
        suppress missing-file warnings from sdist
        zstandard file .*not found)r#   r·   )rÐ   r0   r0   r1   rÑ   %  s    z'manifest_maker._should_suppress_warningc             C   s    t  j |  ƒ |  j j |  j ƒ |  j j |  j ƒ t t ƒ  ƒ } | r[ |  j j | ƒ n t	 j
 j |  j ƒ rz |  j ƒ  |  j d ƒ } |  j j | j ƒ d  S)Nr3   )r	   rÈ   r�   r½   rÉ   r�   rY   r
   rµ   r    r!   ro   Zread_manifestÚget_finalized_commandrŸ   r3   )rG   ZrcfilesZei_cmdr0   r0   r1   rÈ   ,  s    
zmanifest_maker.add_defaultsc             C   sy   |  j  d ƒ } |  j j ƒ  } |  j j | j ƒ |  j j | ƒ t j t j	 ƒ } |  j j
 d | d | d d ƒd  S)NÚbuildz(^|z)(RCS|CVS|\.svn)Zis_regexr   )rÒ   rS   Úget_fullnamer�   r    Ú
build_baser#   r$   r    r"   Zexclude_pattern)rG   rÓ   Úbase_dirr"   r0   r0   r1   rÊ   8  s    zmanifest_maker.prune_file_listN)r“   r”   r•   rÉ   rH   rm   r‹   rÎ   rÇ   rp   ÚstaticmethodrÑ   rÈ   rÊ   r0   r0   r0   r1   rŽ   ù  s   rŽ   c          	   C   sH   d j  | ƒ } | j d ƒ } t |  d ƒ � } | j | ƒ Wd QRXd S)z{Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    Ú
zutf-8rv   N)rb   ry   r{   r|   )rP   Úcontentsr~   r0   r0   r1   rn   B  s    rn   c             C   s¨   t  j d | ƒ |  j s¤ |  j j } |  j | j | _ } |  j | j | _ } z | j	 |  j
 ƒ Wd  | | | _ | _ Xt |  j d d  ƒ } t j |  j
 | ƒ d  S)Nz
writing %sZzip_safe)r   rw   rz   rS   rd   rA   rW   r@   r†   Úwrite_pkg_infor3   rL   r   Zwrite_safety_flag)ÚcmdÚbasenamerP   rd   ZoldverZoldnameÚsafer0   r0   r1   rÚ   O  s    	rÚ   c             C   s#   t  j j | ƒ r t j d ƒ d  S)NzsWARNING: 'depends.txt' is not used by setuptools 0.6!
Use the install_requires/extras_require setup() args instead.)r    r!   ro   r   rp   )rÛ   rÜ   rP   r0   r0   r1   Úwarn_depends_obsoletea  s    rÞ   c             C   sD   t  | p f  ƒ } d d „  } t | t | ƒ ƒ } |  j | ƒ d  S)Nc             S   s   |  d S)NrØ   r0   )r¦   r0   r0   r1   Ú<lambda>k  s    z%_write_requirements.<locals>.<lambda>)r   r   ÚsortedÚ
writelines)ÚstreamÚreqsÚlinesZ	append_crr0   r0   r1   Ú_write_requirementsi  s    rå   c             C   s’   |  j  } t j ƒ  } t | | j ƒ | j p1 i  } x> t | ƒ D]0 } | j d j t	 ƒ  �  ƒ t | | | ƒ qA W|  j
 d | | j ƒ  ƒ d  S)Nz
[{extra}]
Úrequirements)rS   r   ÚStringIOrå   Zinstall_requiresÚextras_requirerà   r|   ÚformatÚvarsru   Úgetvalue)rÛ   rÜ   rP   Údistrs   rè   Úextrar0   r0   r1   Úwrite_requirementsp  s    	rî   c             C   s9   t  ƒ  } t | |  j j ƒ |  j d | | j ƒ  ƒ d  S)Nzsetup-requirements)rç   rå   rS   Zsetup_requiresru   rë   )rÛ   rÜ   rP   rs   r0   r0   r1   Úwrite_setup_requirements{  s    	rï   c             C   sO   t  j d d „  |  j j ƒ  Dƒ ƒ } |  j d | d j t | ƒ ƒ d ƒ d  S)Nc             S   s&   g  |  ] } | j  d  d ƒ d ‘ q S)Ú.r   r   )r   )r³   Úkr0   r0   r1   r´   „  s   	z(write_toplevel_names.<locals>.<listcomp>ztop-level namesrØ   )rN   ÚfromkeysrS   Ziter_distribution_namesrn   rb   rà   )rÛ   rÜ   rP   Úpkgsr0   r0   r1   Úwrite_toplevel_names�  s    	rô   c             C   s   t  |  | | d ƒ d  S)NT)Ú	write_arg)rÛ   rÜ   rP   r0   r0   r1   Úoverwrite_arg‹  s    rö   Fc             C   sd   t  j j | ƒ d } t |  j | d  ƒ } | d  k	 rJ d j | ƒ d } |  j | | | | ƒ d  S)Nr   rØ   )r    r!   ÚsplitextrL   rS   rb   ru   )rÛ   rÜ   rP   rt   ZargnamerJ   r0   r0   r1   rõ   �  s
    rõ   c             C   sð   |  j  j } t | t j ƒ s* | d  k r3 | } n£ | d  k	 rÖ g  } x t | j ƒ  ƒ D]k \ } } t | t j ƒ s¬ t j | | ƒ } d j	 t t
 t | j ƒ  ƒ ƒ ƒ } | j d | | f ƒ qX Wd j	 | ƒ } |  j d | | d ƒ d  S)NrØ   z	[%s]
%s

r   zentry pointsT)rS   Úentry_pointsrV   r   Ústring_typesrà   Úitemsr   Úparse_grouprb   r   ÚstrÚvaluesr½   ru   )rÛ   rÜ   rP   rˆ   rs   ÚsectionrÙ   r0   r0   r1   Úwrite_entries—  s    	$rÿ   c              C   s{   t  j d t ƒ t j j d ƒ rw t j d ƒ �C }  x9 |  D]1 } t j	 d | ƒ } | r; t
 | j d ƒ ƒ Sq; WWd QRXd S)zd
    Get a -r### off of PKG-INFO Version in case this is an sdist of
    a subversion revision.
    z$get_pkg_info_revision is deprecated.zPKG-INFOzVersion:.*-r(\d+)\s*$r   Nr   )Úwarningsrp   ÚDeprecationWarningr    r!   ro   Úior{   r#   r·   ÚintÚgroup)r~   r¦   r·   r0   r0   r1   Úget_pkg_info_revision¨  s    r  );Ú__doc__Údistutils.filelistr   Z	_FileListZdistutils.errorsr   Údistutils.utilr   r[   r   r    r#   rÅ   r  r   rŒ   rM   Zsetuptools.externr   Zsetuptools.extern.six.movesr   Ú
setuptoolsr   Zsetuptools.command.sdistr	   r
   Zsetuptools.command.setoptr   Zsetuptools.commandr   Úpkg_resourcesr   r   r   r   r   r   r   r   Zsetuptools.unicode_utilsrÂ   Zsetuptools.globr   Úpkg_resources.externr   r2   r3   rŽ   rn   rÚ   rÞ   rå   rî   rï   rô   rö   rõ   rÿ   r  r0   r0   r0   r1   Ú<module>   sN   :RÃÀI
