B
    0*™\¹É  ã               @   sÈ   d dl Z d dlZd dlZd dlmZ yd dlZW n ek
rH   dZY nX d dlT d dlm	Z	m
Z
 d dlmZmZmZ d dlmZ d dlmZ e d¡Zd	d
„ ZG dd„ dƒZG dd„ dƒZdd„ ZdS )é    N)Úmessage_from_file)Ú*)ÚFancyGetoptÚtranslate_longopt)Úcheck_environÚ	strtoboolÚrfc822_escape)Úlog)ÚDEBUGz^[a-zA-Z]([a-zA-Z0-9_]*)$c             C   sL   t | tƒrn<t | tƒsHt| ƒj}d|› d|› d}t tj|¡ t| ƒ} | S )Nz
Warning: 'z' should be a list, got type 'ú')Ú
isinstanceÚstrÚlistÚtypeÚ__name__r	   ZWARN)ÚvalueZ	fieldnameÚtypenameÚmsg© r   ú9C:\ALexclude\prg\programme\Python37\Lib\distutils\dist.pyÚ_ensure_list   s    


r   c               @   sl  e Zd ZdddddgZdZddd	d
dddddddddddddddddgZdd„ eD ƒZddiZd`d!d"„Zd#d$„ Z	dad&d'„Z
d(d)„ Zdbd*d+„Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d4g fd5d6„Zd7d8„ Zd9d:„ Zd;d<„ Zd=d>„ Zd?d@„ ZdAdB„ ZdcdCdD„ZdddEdF„ZdedHdI„ZejfdJdK„ZdLdM„ ZdNdO„ ZdPdQ„ Z dRdS„ Z!dTdU„ Z"dVdW„ Z#dXdY„ Z$dZd[„ Z%d\d]„ Z&d^d_„ Z'd S )fÚDistribution)ÚverboseÚvzrun verbosely (default)é   )ÚquietÚqz!run quietly (turns verbosity off))zdry-runÚnzdon't actually do anything)ÚhelpÚhzshow detailed help message)zno-user-cfgNz-ignore pydistutils.cfg in your home directoryz£Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package
)zhelp-commandsNzlist all available commands)ÚnameNzprint package name)ÚversionÚVzprint package version)ÚfullnameNzprint <package name>-<version>)ÚauthorNzprint the author's name)zauthor-emailNz print the author's email address)Ú
maintainerNzprint the maintainer's name)zmaintainer-emailNz$print the maintainer's email address)ÚcontactNz7print the maintainer's name if known, else the author's)zcontact-emailNz@print the maintainer's email address if known, else the author's)ÚurlNzprint the URL for this package)ÚlicenseNz print the license of the package)ÚlicenceNzalias for --license)ÚdescriptionNzprint the package description)zlong-descriptionNz"print the long package description)Ú	platformsNzprint the list of platforms)ÚclassifiersNzprint the list of classifiers)ÚkeywordsNzprint the list of keywords)ÚprovidesNz+print the list of packages/modules provided)ÚrequiresNz+print the list of packages/modules required)Ú	obsoletesNz0print the list of packages/modules made obsoletec             C   s   g | ]}t |d  ƒ‘qS )r   )r   )Ú.0Úxr   r   r   ú
<listcomp>   s    zDistribution.<listcomp>r   r   Nc             C   sl  d| _ d| _d| _x| jD ]}t| |dƒ qW tƒ | _x,| jjD ] }d| }t| |t| j|ƒƒ q@W i | _	d | _
d | _d | _i | _g | _d | _i | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d| _i | _i | _|r| d¡}|d k	rH|d= xD| ¡ D ]8\}}|   |¡}x"| ¡ D ]\}	}
d|
f||	< q(W qW d|krŽ|d |d< |d= d	}t!d k	r~t! "|¡ nt#j$ %|d
 ¡ xŒ| ¡ D ]€\}}
t&| jd| ƒrÈt| jd| ƒ|
ƒ nNt&| j|ƒræt| j||
ƒ n0t&| |ƒr t| ||
ƒ ndt'|ƒ }t! "|¡ q˜W d| _(| jd k	r`x0| jD ]&}| )d¡sHP |dkr6d| _(P q6W |  *¡  d S )Nr   r   Úget_Ú Úoptionszsetup scriptr)   r(   z:'licence' distribution option is deprecated; use 'license'Ú
Zset_zUnknown distribution option: %sTú-z--no-user-cfgF)+r   Údry_runr   Údisplay_option_namesÚsetattrÚDistributionMetadataÚmetadataÚ_METHOD_BASENAMESÚgetattrÚcmdclassÚcommand_packagesÚscript_nameÚscript_argsÚcommand_optionsZ
dist_filesÚpackagesZpackage_dataZpackage_dirÚ
py_modulesÚ	librariesÚheadersÚext_modulesZext_packageZinclude_dirsZ
extra_pathÚscriptsÚ
data_filesZpasswordÚcommand_objÚhave_runÚgetÚitemsÚget_option_dictÚwarningsÚwarnÚsysÚstderrÚwriteÚhasattrÚreprÚwant_user_cfgÚ
startswithÚfinalize_options)ÚselfZattrsÚattrÚbasenameZmethod_namer6   ÚcommandZcmd_optionsÚopt_dictÚoptÚvalr   ÚkeyÚargr   r   r   Ú__init__ˆ   s~    





zDistribution.__init__c             C   s&   | j  |¡}|d kr"i  }| j |< |S )N)rD   rN   )r[   r^   Údictr   r   r   rP   &  s    zDistribution.get_option_dictr5   c       	      C   sÐ   ddl m} |d kr"t| j ¡ ƒ}|d k	r@|  || ¡ |d }|sV|  |d ¡ d S xt|D ]l}| j |¡}|d krˆ|  |d|  ¡ q\|  |d|  ¡ ||ƒ}x$| d¡D ]}|  |d | ¡ q®W q\W d S )Nr   )Úpformatz  zno commands known yetzno option dict for '%s' commandzoption dict for '%s' command:r7   )Zpprintrf   ÚsortedrD   ÚkeysÚannouncerN   Úsplit)	r[   ÚheaderÚcommandsÚindentrf   Zcmd_namer_   ÚoutÚliner   r   r   Údump_option_dicts1  s&    
zDistribution.dump_option_dictsc             C   s¾   g }t ƒ  tj tjd j¡}tj |d¡}tj |¡rB| 	|¡ tj
dkrRd}nd}| jrˆtj tj d¡|¡}tj |¡rˆ| 	|¡ d}tj |¡r¢| 	|¡ trº|  dd	 |¡ ¡ |S )
NÚ	distutilszdistutils.cfgÚposixz.pydistutils.cfgzpydistutils.cfgú~z	setup.cfgzusing config files: %sz, )r   ÚosÚpathÚdirnamerS   ÚmodulesÚ__file__ÚjoinÚisfileÚappendr    rX   Ú
expanduserr
   ri   )r[   ÚfilesZsys_dirZsys_fileZuser_filenameZ	user_fileZ
local_filer   r   r   Úfind_config_filesM  s&    



zDistribution.find_config_filesc             C   s´  ddl m} tjtjkr8ddddddd	d
dddddg}ng }t|ƒ}|d krT|  ¡ }trb|  d¡ |ƒ }x˜|D ]}tr„|  d| ¡ | 	|¡ xf| 
¡ D ]Z}| |¡}|  |¡}x@|D ]8}	|	dkr¶|	|kr¶| ||	¡}
|	 dd¡}	||
f||	< q¶W q˜W | ¡  qnW d| jkr°x | jd  ¡ D ]Ž\}	\}}
| j |	¡}yF|rRt| |t|
ƒ ƒ n(|	dkrnt| |	t|
ƒƒ nt| |	|
ƒ W n, tk
r¨ } zt|ƒ‚W d d }~X Y nX qW d S )Nr   )ÚConfigParserzinstall-basezinstall-platbasezinstall-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptszinstall-dataÚprefixzexec-prefixÚhomeÚuserÚrootz"Distribution.parse_config_files():z  reading %sr   r8   Ú_Úglobal)r   r9   )Zconfigparserr   rS   r€   Úbase_prefixÚ	frozensetr~   r
   ri   ÚreadZsectionsr6   rP   rN   Úreplacerd   rD   rO   Únegative_optr;   r   Ú
ValueErrorÚDistutilsOptionError)r[   Ú	filenamesr   Zignore_optionsÚparserÚfilenameÚsectionr6   r_   r`   ra   ÚsrcÚaliasr   r   r   r   Úparse_config_files}  sJ    






zDistribution.parse_config_filesc             C   sÂ   |   ¡ }g | _t|| j ƒ}| | j¡ | ddi¡ |j| j| d}| 	¡ }t
 | j¡ |  |¡rhd S x |rˆ|  ||¡}|d krjd S qjW | jr°| j|t| jƒdk| jd d S | js¾tdƒ‚dS )Nr)   r(   )ÚargsÚobjectr   )Údisplay_optionsrl   zno commands suppliedT)Ú_get_toplevel_optionsrl   r   r–   Úset_negative_aliasesrŠ   Zset_aliasesÚgetoptrC   Zget_option_orderr	   Zset_verbosityr   Úhandle_display_optionsÚ_parse_command_optsr   Ú
_show_helpÚlenÚDistutilsArgError)r[   Ztoplevel_optionsrŽ   r”   Úoption_orderr   r   r   Úparse_command_line·  s,    	

zDistribution.parse_command_linec             C   s   | j dg S )N)zcommand-packages=Nz0list of packages that provide distutils commands)Úglobal_options)r[   r   r   r   r—   ú  s    z"Distribution._get_toplevel_optionsc          
   C   s  ddl m} |d }t |¡s*td| ƒ‚| j |¡ y|  |¡}W n* tk
rn } zt	|ƒ‚W d d }~X Y nX t
||ƒs†td| ƒ‚t|dƒrœt|jtƒs¬d}t|| ƒ‚| j}t|dƒrÐ| ¡ }| |j¡ t|dƒròt|jtƒròt|jƒ}ng }| | j|j | ¡ | |¡ | |d	d … ¡\}}	t|	d
ƒrV|	jrV| j|d|gd d S t|dƒrÐt|jtƒrÐd}
xP|jD ]F\}}}}t|	| |¡ƒr|d	}
t|ƒr°|ƒ  ntd||f ƒ‚q|W |
rÐd S |  |¡}x&t|	ƒ ¡ D ]\}}d|f||< qèW |S )Nr   )ÚCommandzinvalid command name '%s'z&command class %s must subclass CommandÚuser_optionszIcommand class %s must provide 'user_options' attribute (a list of tuples)rŠ   Úhelp_optionsr   r   )r–   rl   zYinvalid help function %r for help option '%s': must be a callable object (function, etc.)zcommand line) Údistutils.cmdr¢   Ú
command_reÚmatchÚ
SystemExitrl   r{   Úget_command_classÚDistutilsModuleErrorrž   Ú
issubclassZDistutilsClassErrorrV   r   r£   r   rŠ   ÚcopyÚupdater¤   Úfix_help_optionsÚset_option_tabler¡   r˜   r™   r   rœ   Zget_attr_nameÚcallablerP   ÚvarsrO   )r[   rŽ   r”   r¢   r^   Z	cmd_classr   rŠ   r¤   ZoptsZhelp_option_foundZhelp_optionZshortZdescÚfuncr_   r    r   r   r   r   r›     sb    










z Distribution._parse_command_optsc             C   sT   xNdD ]F}t | j|ƒ}|d kr qt|tƒrdd„ | d¡D ƒ}t| j||ƒ qW d S )N)r-   r+   c             S   s   g | ]}|  ¡ ‘qS r   )Ústrip)r1   Zelmr   r   r   r3   j  s    z1Distribution.finalize_options.<locals>.<listcomp>ú,)r?   r=   r   r   rj   r;   )r[   r\   r   r   r   r   rZ   `  s    

zDistribution.finalize_optionsr   c       
      C   s  ddl m} ddlm} |rR|r*|  ¡ }n| j}| |¡ | | jd ¡ t	dƒ |rt| | j
¡ | d¡ t	dƒ x„| jD ]z}t|tƒršt||ƒrš|}	n
|  |¡}	t|	dƒrÒt|	jtƒrÒ| |	jt|	jƒ ¡ n| |	j¡ | d|	j ¡ t	dƒ q|W t	|| jƒƒ d S )	Nr   )Ú	gen_usage)r¢   z
Global options:r5   zKInformation display options (just display information, ignore any commands)r¤   zOptions for '%s' command:)Údistutils.corerµ   r¥   r¢   r—   r¡   r¯   Ú
print_helpÚcommon_usageÚprintr–   rl   r   r   r«   r©   rV   r¤   r   r£   r®   r   rB   )
r[   rŽ   r¡   r–   rl   rµ   r¢   r6   r^   Úklassr   r   r   rœ   m  s4    



zDistribution._show_helpc       	      C   sÒ   ddl m} | jr4|  ¡  tdƒ t|| jƒƒ dS d}i }x| jD ]}d||d < qDW xt|D ]l\}}|r^| |¡r^t|ƒ}t	| j
d| ƒƒ }|dkr¦td |¡ƒ n |dkr¾td	 |¡ƒ nt|ƒ d}q^W |S )
Nr   )rµ   r5   r   r4   )r-   r+   r´   )r,   r.   r/   r0   r7   )r¶   rµ   Zhelp_commandsÚprint_commandsr¹   rB   r–   rN   r   r?   r=   ry   )	r[   rŸ   rµ   Zany_display_optionsZis_display_optionÚoptionr`   ra   r   r   r   r   rš   Ÿ  s*    z#Distribution.handle_display_optionsc          	   C   sn   t |d ƒ x\|D ]T}| j |¡}|s0|  |¡}y
|j}W n tk
rR   d}Y nX t d|||f ƒ qW d S )Nú:z(no description available)z
  %-*s  %s)r¹   r@   rN   r©   r*   ÚAttributeError)r[   rl   rk   Ú
max_lengthÚcmdrº   r*   r   r   r   Úprint_command_listÇ  s    



zDistribution.print_command_listc             C   sª   dd l }|jj}i }x|D ]}d||< qW g }x&| j ¡ D ]}| |¡s:| |¡ q:W d}x$|| D ]}t|ƒ|krdt|ƒ}qdW |  |d|¡ |r¦t	ƒ  |  |d|¡ d S )Nr   r   zStandard commandszExtra commands)
Údistutils.commandr^   Ú__all__r@   rh   rN   r{   r   rÁ   r¹   )r[   rq   Ústd_commandsÚis_stdrÀ   Úextra_commandsr¿   r   r   r   r»   Ø  s*    

zDistribution.print_commandsc       	   	   C   s¼   dd l }|jj}i }x|D ]}d||< qW g }x&| j ¡ D ]}| |¡s:| |¡ q:W g }x\|| D ]P}| j |¡}|s‚|  |¡}y
|j}W n t	k
r¤   d}Y nX | ||f¡ qdW |S )Nr   r   z(no description available))
rÂ   r^   rÃ   r@   rh   rN   r{   r©   r*   r¾   )	r[   rq   rÄ   rÅ   rÀ   rÆ   Úrvrº   r*   r   r   r   Úget_command_listù  s(    	




zDistribution.get_command_listc             C   sN   | j }t|tƒsJ|d krd}dd„ | d¡D ƒ}d|krD| dd¡ || _ |S )Nr5   c             S   s   g | ]}|d kr|  ¡ ‘qS )r5   )r³   )r1   Zpkgr   r   r   r3   !  s    z5Distribution.get_command_packages.<locals>.<listcomp>r´   zdistutils.commandr   )rA   r   r   rj   Úinsert)r[   Zpkgsr   r   r   Úget_command_packages  s    
z!Distribution.get_command_packagesc          	   C   s¶   | j  |¡}|r|S x|  ¡ D ]„}d||f }|}yt|ƒ tj| }W n tk
r^   wY nX yt||ƒ}W n& tk
r”   t	d|||f ƒ‚Y nX || j |< |S W t	d| ƒ‚d S )Nz%s.%sz3invalid command '%s' (no class '%s' in module '%s')zinvalid command '%s')
r@   rN   rÊ   Ú
__import__rS   rw   ÚImportErrorr?   r¾   rª   )r[   r^   rº   ZpkgnameZmodule_nameZ
klass_nameÚmoduler   r   r   r©   '  s(    
zDistribution.get_command_classc             C   sl   | j  |¡}|sh|rhtr&|  d| ¡ |  |¡}|| ƒ }| j |< d| j|< | j |¡}|rh|  ||¡ |S )Nz<Distribution.get_command_obj(): creating '%s' command objectr   )rL   rN   r
   ri   r©   rM   rD   Ú_set_command_options)r[   r^   ZcreateÚcmd_objrº   r6   r   r   r   Úget_command_objM  s    

zDistribution.get_command_objc             C   sb  |  ¡ }|d kr|  |¡}tr,|  d| ¡ x.| ¡ D ] \}\}}tr^|  d|||f ¡ ydd„ |jD ƒ}W n tk
rŠ   g }Y nX y
|j}W n tk
r®   i }Y nX y|t|t	ƒ}	||krà|	ràt
||| t|ƒ ƒ nJ||krþ|	rþt
||t|ƒƒ n,t||ƒrt
|||ƒ ntd|||f ƒ‚W q8 tk
rX }
 zt|
ƒ‚W d d }
~
X Y q8X q8W d S )Nz#  setting options for '%s' command:z    %s = %s (from %s)c             S   s   g | ]}t |ƒ‘qS r   )r   )r1   Úor   r   r   r3   |  s   z5Distribution._set_command_options.<locals>.<listcomp>z1error in %s: command '%s' has no such option '%s')Úget_command_namerP   r
   ri   rO   Zboolean_optionsr¾   rŠ   r   r   r;   r   rV   rŒ   r‹   )r[   rL   Zoption_dictÚcommand_namer¼   Úsourcer   Z	bool_optsZneg_optZ	is_stringr   r   r   r   rÎ   h  s>    	






z!Distribution._set_command_optionsr   c             C   s€   ddl m} t||ƒs&|}|  |¡}n| ¡ }|js8|S | ¡  d|_d| j|< |  |¡ |r|x| 	¡ D ]}|  
||¡ qhW |S )Nr   )r¢   )r¥   r¢   r   rÐ   rÒ   Z	finalizedZinitialize_optionsrM   rÎ   Zget_sub_commandsÚreinitialize_command)r[   r^   Zreinit_subcommandsr¢   rÓ   Úsubr   r   r   rÕ   ”  s    


z!Distribution.reinitialize_commandc             C   s   t   ||¡ d S )N)r	   )r[   r   Úlevelr   r   r   ri   ½  s    zDistribution.announcec             C   s   x| j D ]}|  |¡ qW d S )N)rl   Úrun_command)r[   rÀ   r   r   r   Úrun_commandsÀ  s    zDistribution.run_commandsc             C   sD   | j  |¡rd S t d|¡ |  |¡}| ¡  | ¡  d| j |< d S )Nz
running %sr   )rM   rN   r	   ÚinforÐ   Zensure_finalizedÚrun)r[   r^   rÏ   r   r   r   rØ   Ê  s    	
zDistribution.run_commandc             C   s   t | jp| jpg ƒdkS )Nr   )r   rE   rF   )r[   r   r   r   Úhas_pure_modulesÞ  s    zDistribution.has_pure_modulesc             C   s   | j ot| j ƒdkS )Nr   )rI   r   )r[   r   r   r   Úhas_ext_modulesá  s    zDistribution.has_ext_modulesc             C   s   | j ot| j ƒdkS )Nr   )rG   r   )r[   r   r   r   Úhas_c_librariesä  s    zDistribution.has_c_librariesc             C   s   |   ¡ p|  ¡ S )N)rÜ   rÝ   )r[   r   r   r   Úhas_modulesç  s    zDistribution.has_modulesc             C   s   | j ot| j ƒdkS )Nr   )rH   r   )r[   r   r   r   Úhas_headersê  s    zDistribution.has_headersc             C   s   | j ot| j ƒdkS )Nr   )rJ   r   )r[   r   r   r   Úhas_scriptsí  s    zDistribution.has_scriptsc             C   s   | j ot| j ƒdkS )Nr   )rK   r   )r[   r   r   r   Úhas_data_filesð  s    zDistribution.has_data_filesc             C   s   |   ¡ o|  ¡  o|  ¡  S )N)rÜ   rÝ   rÞ   )r[   r   r   r   Úis_pureó  s    
zDistribution.is_pure)N)NNr5   )N)r   )N)r   )(r   Ú
__module__Ú__qualname__r¡   r¸   r–   r:   rŠ   rd   rP   rp   r~   r“   r    r—   r›   rZ   rœ   rš   rÁ   r»   rÈ   rÊ   r©   rÐ   rÎ   rÕ   r	   ÚINFOri   rÙ   rØ   rÜ   rÝ   rÞ   rß   rà   rá   râ   rã   r   r   r   r   r   ,   sz   
 
0
:C[1(!"&

,
)
r   c               @   s  e Zd ZdZdAd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!d"„ ZeZd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Z d;d<„ Z!d=d>„ Z"d?d@„ Z#dS )Br<   )r    r!   r$   Úauthor_emailr%   Úmaintainer_emailr'   r(   r*   Úlong_descriptionr-   r+   r#   r&   Zcontact_emailr,   Údownload_urlr.   r/   r0   Nc             C   s‚   |d k	r|   t|ƒ¡ nfd | _d | _d | _d | _d | _d | _d | _d | _	d | _
d | _d | _d | _d | _d | _d | _d | _d | _d S )N)Úread_pkg_fileÚopenr    r!   r$   rç   r%   rè   r'   r(   r*   ré   r-   r+   r,   rê   r.   r/   r0   )r[   ru   r   r   r   rd     s&    zDistributionMetadata.__init__c                s  t |ƒ‰ ‡ fdd„}‡ fdd„}ˆ d }|dƒ| _|dƒ| _|dƒ| _|d	ƒ| _d | _|d
ƒ| _d | _|dƒ| _|dƒ| _	dˆ krŽ|dƒ| _
nd | _
|dƒ| _|dƒ| _dˆ krÀ|dƒ d¡| _|dƒ| _|dƒ| _|dkrü|dƒ| _|dƒ| _|dƒ| _nd | _d | _d | _d S )Nc                s   ˆ |  }|dkrd S |S )NÚUNKNOWNr   )r    r   )r   r   r   Ú_read_field(  s    z7DistributionMetadata.read_pkg_file.<locals>._read_fieldc                s   ˆ   | d ¡}|g krd S |S )N)Zget_all)r    Úvalues)r   r   r   Ú
_read_list.  s    z6DistributionMetadata.read_pkg_file.<locals>._read_listzmetadata-versionr    r!   Zsummaryr$   zauthor-emailz	home-pager(   zdownload-urlr*   r-   r´   ÚplatformZ
classifierz1.1r/   r.   r0   )r   r    r!   r*   r$   r%   rç   rè   r'   r(   rê   ré   rj   r-   r+   r,   r/   r.   r0   )r[   Úfilerî   rð   Zmetadata_versionr   )r   r   rë   $  s:    












z"DistributionMetadata.read_pkg_filec          	   C   s2   t tj |d¡ddd}|  |¡ W d Q R X d S )NzPKG-INFOÚwzUTF-8)Úencoding)rì   rt   ru   ry   Úwrite_pkg_file)r[   Zbase_dirZpkg_infor   r   r   Úwrite_pkg_infoX  s    
z#DistributionMetadata.write_pkg_infoc             C   sb  d}| j s"| js"| js"| js"| jr&d}| d| ¡ | d|  ¡  ¡ | d|  ¡  ¡ | d|  ¡  ¡ | d|  	¡  ¡ | d|  
¡  ¡ | d	|  ¡  ¡ | d
|  ¡  ¡ | jrÈ| d| j ¡ t|  ¡ ƒ}| d| ¡ d |  ¡ ¡}|r| d| ¡ |  |d|  ¡ ¡ |  |d|  ¡ ¡ |  |d|  ¡ ¡ |  |d|  ¡ ¡ |  |d|  ¡ ¡ d S )Nz1.0z1.1zMetadata-Version: %s
z	Name: %s
zVersion: %s
zSummary: %s
zHome-page: %s
zAuthor: %s
zAuthor-email: %s
zLicense: %s
zDownload-URL: %s
zDescription: %s
r´   zKeywords: %s
ZPlatformZ
ClassifierZRequiresZProvidesZ	Obsoletes)r.   r/   r0   r,   rê   rU   Úget_nameÚget_versionÚget_descriptionÚget_urlÚget_contactÚget_contact_emailÚget_licenser   Úget_long_descriptionry   Úget_keywordsÚ_write_listÚget_platformsÚget_classifiersÚget_requiresÚget_providesÚget_obsoletes)r[   rò   r!   Z	long_descr-   r   r   r   rõ   _  s0    z#DistributionMetadata.write_pkg_filec             C   s$   x|D ]}|  d||f ¡ qW d S )Nz%s: %s
)rU   )r[   rò   r    rï   r   r   r   r   r     s    
z DistributionMetadata._write_listc             C   s
   | j pdS )Nrí   )r    )r[   r   r   r   r÷   ‡  s    zDistributionMetadata.get_namec             C   s
   | j pdS )Nz0.0.0)r!   )r[   r   r   r   rø   Š  s    z DistributionMetadata.get_versionc             C   s   d|   ¡ |  ¡ f S )Nz%s-%s)r÷   rø   )r[   r   r   r   Úget_fullname  s    z!DistributionMetadata.get_fullnamec             C   s
   | j pdS )Nrí   )r$   )r[   r   r   r   Ú
get_author  s    zDistributionMetadata.get_authorc             C   s
   | j pdS )Nrí   )rç   )r[   r   r   r   Úget_author_email“  s    z%DistributionMetadata.get_author_emailc             C   s
   | j pdS )Nrí   )r%   )r[   r   r   r   Úget_maintainer–  s    z#DistributionMetadata.get_maintainerc             C   s
   | j pdS )Nrí   )rè   )r[   r   r   r   Úget_maintainer_email™  s    z)DistributionMetadata.get_maintainer_emailc             C   s   | j p| jpdS )Nrí   )r%   r$   )r[   r   r   r   rû   œ  s    z DistributionMetadata.get_contactc             C   s   | j p| jpdS )Nrí   )rè   rç   )r[   r   r   r   rü   Ÿ  s    z&DistributionMetadata.get_contact_emailc             C   s
   | j pdS )Nrí   )r'   )r[   r   r   r   rú   ¢  s    zDistributionMetadata.get_urlc             C   s
   | j pdS )Nrí   )r(   )r[   r   r   r   rý   ¥  s    z DistributionMetadata.get_licensec             C   s
   | j pdS )Nrí   )r*   )r[   r   r   r   rù   ©  s    z$DistributionMetadata.get_descriptionc             C   s
   | j pdS )Nrí   )ré   )r[   r   r   r   rþ   ¬  s    z)DistributionMetadata.get_long_descriptionc             C   s
   | j pg S )N)r-   )r[   r   r   r   rÿ   ¯  s    z!DistributionMetadata.get_keywordsc             C   s   t |dƒ| _d S )Nr-   )r   r-   )r[   r   r   r   r   Úset_keywords²  s    z!DistributionMetadata.set_keywordsc             C   s   | j p
dgS )Nrí   )r+   )r[   r   r   r   r  µ  s    z"DistributionMetadata.get_platformsc             C   s   t |dƒ| _d S )Nr+   )r   r+   )r[   r   r   r   r   Úset_platforms¸  s    z"DistributionMetadata.set_platformsc             C   s
   | j pg S )N)r,   )r[   r   r   r   r  »  s    z$DistributionMetadata.get_classifiersc             C   s   t |dƒ| _d S )Nr,   )r   r,   )r[   r   r   r   r   Úset_classifiers¾  s    z$DistributionMetadata.set_classifiersc             C   s
   | j pdS )Nrí   )rê   )r[   r   r   r   Úget_download_urlÁ  s    z%DistributionMetadata.get_download_urlc             C   s
   | j pg S )N)r/   )r[   r   r   r   r  Å  s    z!DistributionMetadata.get_requiresc             C   s0   dd l }x|D ]}|j |¡ qW t|ƒ| _d S )Nr   )Údistutils.versionpredicateÚversionpredicateÚVersionPredicater   r/   )r[   r   rq   r   r   r   r   Úset_requiresÈ  s    
z!DistributionMetadata.set_requiresc             C   s
   | j pg S )N)r.   )r[   r   r   r   r  Î  s    z!DistributionMetadata.get_providesc             C   s:   dd„ |D ƒ}x |D ]}dd l }|j |¡ qW || _d S )Nc             S   s   g | ]}|  ¡ ‘qS r   )r³   )r1   r   r   r   r   r3   Ò  s    z5DistributionMetadata.set_provides.<locals>.<listcomp>r   )r  r  Zsplit_provisionr.   )r[   r   r   rq   r   r   r   Úset_providesÑ  s
    
z!DistributionMetadata.set_providesc             C   s
   | j pg S )N)r0   )r[   r   r   r   r  Ø  s    z"DistributionMetadata.get_obsoletesc             C   s0   dd l }x|D ]}|j |¡ qW t|ƒ| _d S )Nr   )r  r  r  r   r0   )r[   r   rq   r   r   r   r   Úset_obsoletesÛ  s    
z"DistributionMetadata.set_obsoletes)N)$r   rä   rå   r>   rd   rë   rö   rõ   r   r÷   rø   r  r  r  r	  r
  rû   rü   rú   rý   Zget_licencerù   rþ   rÿ   r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r<   ÿ  sB   	
4"r<   c             C   s(   g }x| D ]}|  |dd… ¡ q
W |S )Nr   é   )r{   )r6   Znew_optionsZ
help_tupler   r   r   r®   á  s    
r®   )rS   rt   ÚreZemailr   rQ   rÌ   Zdistutils.errorsZdistutils.fancy_getoptr   r   Zdistutils.utilr   r   r   rq   r	   Zdistutils.debugr
   Úcompiler¦   r   r   r<   r®   r   r   r   r   Ú<module>   s2   

       Z c