509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \Â  ã               @   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j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               @   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dAdB„ Z	d˜dDdE„Z
dFdG„ Zd™dHdI„ZdJdK„ ZdLdM„ ZdNdO„ ZdPdQ„ Zddg fdRdS„ZdTdU„ ZdVdW„ ZdXdY„ ZdZd[„ Zd\d]„ Zd^d_„ Zdšd`da„Zd›dbdc„Zdœdedf„Zejfdgdh„Zdidj„ Zdkdl„ Zdmdn„ Z dodp„ Z!dqdr„ Z"dsdt„ Z#dudv„ Z$dwdx„ Z%dydz„ Z&d{d|„ Z'dS )�ÚDistributionÚverboseÚvúrun verbosely (default)é   ÚquietÚqú!run quietly (turns verbosity off)údry-runÚnúdon't actually do anythingÚhelpÚhúshow detailed help messageúno-user-cfgNú-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
úhelp-commandsúlist all available commandsÚnameúprint package nameÚversionÚVúprint package versionÚfullnameúprint <package name>-<version>Úauthorúprint the author's nameúauthor-emailú print the author's email addressÚ
maintainerúprint the maintainer's nameúmaintainer-emailú$print the maintainer's email addressÚcontactú7print the maintainer's name if known, else the author'súcontact-emailú@print the maintainer's email address if known, else the author'sÚurlúprint the URL for this packageÚlicenseú print the license of the packageÚlicenceúalias for --licenseÚdescriptionúprint the package descriptionúlong-descriptionú"print the long package descriptionÚ	platformsúprint the list of platformsÚclassifiersúprint the list of classifiersÚkeywordsúprint the list of keywordsÚprovidesú+print the list of packages/modules providedÚrequiresú+print the list of packages/modules requiredÚ	obsoletesú0print the list of packages/modules made obsoletec             C   s   g | ]}t |d  ƒ‘qS )r   )r   )Ú.0Úx© rH   ú&/usr/lib64/python3.6/distutils/dist.pyú
<listcomp>s   s    zDistribution.<listcomp>c             C   sˆ  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 | _|�r8|jdƒ}|d k	�rH|d= xD|jƒ D ]8\}}| j |ƒ}x"|jƒ D ]\}	}
d|
f||	< �q(W �qW d|k�rŽ|d |d< |d= d	}t!d k	�r~t!j"|ƒ nt#j$j%|d
 ƒ x¨|jƒ D ]œ\}}
t&| jd| ƒ�rÈt| jd| ƒ|
ƒ njt&| j|ƒ�ræt| j||
ƒ nLt&| |ƒ�r t| ||
ƒ n2dt'|ƒ }t!d k	�r"t!j"|ƒ nt#j$j%|d
 ƒ �q˜W d| _(| jd k	�r|x0| jD ]&}|j)dƒ�sdP |dk�rRd| _(P �qRW | j*ƒ  d S )Nr   r   Úget_Ú Úoptionszsetup scriptr4   r2   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_namerM   ÚcommandZcmd_optionsÚopt_dictÚoptÚvalÚmsgÚkeyÚargrH   rH   rI   Ú__init__z   s‚    






zDistribution.__init__c             C   s&   | j j|ƒ}|d kr"i  }| j |< |S )N)r[   re   )rr   ru   ÚdictrH   rH   rI   rg     s    zDistribution.get_option_dictrL   c       	      C   sÐ   ddl m} |d kr"t| jjƒ ƒ}|d k	r@| j|| ƒ |d }|sV| j|d ƒ d S xt|D ]l}| jj|ƒ}|d krˆ| j|d|  ƒ q\| j|d|  ƒ ||ƒ}x$|jdƒD ]}| j|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:rN   )Úpprintr~   Úsortedr[   ÚkeysÚannouncere   Úsplit)	rr   ÚheaderÚcommandsÚindentr~   Zcmd_namerv   ÚoutÚlinerH   rH   rI   Údump_option_dicts&  s&    
zDistribution.dump_option_dictsc             C   s¾   g }t ƒ  tjjtjd jƒ}tjj|dƒ}tjj|ƒrB|j	|ƒ tj
dkrRd}nd}| jrˆtjjtjjdƒ|ƒ}tjj|ƒrˆ|j	|ƒ d}tjj|ƒr¢|j	|ƒ trº| jdd	j|ƒ ƒ |S )
NÚ	distutilszdistutils.cfgÚposixz.pydistutils.cfgzpydistutils.cfgú~z	setup.cfgzusing config files: %sz, )r   ÚosÚpathÚdirnamerj   ÚmodulesÚ__file__ÚjoinÚisfileÚappendr   ro   Ú
expanduserr
   r‚   )rr   ÚfilesZsys_dirZsys_fileZuser_filenameZ	user_fileZ
local_filerH   rH   rI   Úfind_config_filesB  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| jƒ }trb| jdƒ |ƒ }x˜|D ]�}tr„| jd| ƒ |j	|ƒ xf|j
ƒ D ]Z}|j|ƒ}| j|ƒ}x@|D ]8}	|	dkr¶|	|kr¶|j||	ƒ}
|	jddƒ}	||
f||	< q¶W q˜W |jƒ  qnW d| jk�r°x | jd jƒ D ]Ž\}	\}}
| jj|	ƒ}yF|�rRt| |t|
ƒ ƒ n(|	dk�rnt| |	t|
ƒƒ nt| |	|
ƒ W n, tk
�r¨ } zt|ƒ‚W Y d d }~X 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 %sÚ__name__rO   Ú_Úglobalr   rP   )r   rP   )Zconfigparserr˜   rj   r™   Úbase_prefixÚ	frozensetr—   r
   r‚   ÚreadZsectionsrM   rg   re   Úreplacer|   r[   rf   Únegative_optrR   r   Ú
ValueErrorÚDistutilsOptionError)rr   Ú	filenamesr˜   Zignore_optionsÚparserÚfilenameZsectionrM   rv   rw   rx   ÚsrcÚaliasry   rH   rH   rI   Úparse_config_filesr  sJ    






zDistribution.parse_config_filesc             C   sÂ   | j ƒ }g | _t|| j ƒ}|j| jƒ |jddiƒ |j| j| d�}|j	ƒ }t
j| jƒ | j|ƒrhd S x |rˆ| j||ƒ}|d krjd S qjW | jr°| j|t| jƒdk| jd� d S | js¾tdƒ‚dS )Nr4   r2   )ÚargsÚobjectr   )Údisplay_optionsr…   zno commands suppliedT)Ú_get_toplevel_optionsr…   r   r¯   Úset_negative_aliasesr¤   Zset_aliasesÚgetoptrZ   Zget_option_orderr	   Zset_verbosityr   Úhandle_display_optionsÚ_parse_command_optsr   Ú
_show_helpÚlenÚDistutilsArgError)rr   Ztoplevel_optionsr¨   r­   Úoption_orderrH   rH   rI   Úparse_command_line¬  s,    	

zDistribution.parse_command_linec             C   s   | j dg S )Núcommand-packages=ú0list of packages that provide distutils commands)rº   Nr»   )Úglobal_options)rr   rH   rH   rI   r°   ï  s     z"Distribution._get_toplevel_optionsc             C   s  ddl m} |d }tj|ƒs*td| ƒ‚| jj|ƒ y| j|ƒ}W n* tk
rn } zt	|ƒ‚W Y d d }~X nX t
||ƒs†td| ƒ‚t|dƒošt|jtƒs¬d}t|| ƒ‚| j}t|dƒrÐ|jƒ }|j|jƒ t|dƒròt|jtƒròt|jƒ}ng }|j| j|j | ƒ |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|	|j|ƒƒ�r|d	}
t|ƒ�r°|ƒ  ntd||f ƒ‚�q|W |
�rÐd S | j|ƒ}x&t|	ƒjƒ 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¯   r…   zYinvalid help function %r for help option '%s': must be a callable object (function, etc.)zcommand line) Údistutils.cmdr½   Ú
command_reÚmatchÚ
SystemExitr…   r”   Úget_command_classÚDistutilsModuleErrorr·   Ú
issubclassZDistutilsClassErrorrm   Ú
isinstancer¾   Úlistr¤   ÚcopyÚupdater¿   Úfix_help_optionsÚset_option_tabler¼   r±   r²   r   rµ   Zget_attr_nameÚcallablerg   Úvarsrf   )rr   r¨   r­   r½   ru   Z	cmd_classry   r¤   r¿   ZoptsZhelp_option_foundZhelp_optionZshortZdescÚfuncrv   r   ÚvaluerH   rH   rI   r´   ú  sb    










z Distribution._parse_command_optsc             C   sT   xNdD ]F}t | j|ƒ}|d kr qt|tƒrdd„ |jdƒD ƒ}t| j||ƒ qW d S )Nr>   r:   c             S   s   g | ]}|j ƒ ‘qS rH   )Ústrip)rF   ZelmrH   rH   rI   rJ   _  s    z1Distribution.finalize_options.<locals>.<listcomp>ú,)r>   r:   )rV   rT   rÇ   Ústrrƒ   rR   )rr   rs   rÐ   rH   rH   rI   rq   U  s    

zDistribution.finalize_optionsc       
      C   s  ddl m} ddlm} |rR|r*| jƒ }n| j}|j|ƒ |j| jd ƒ t	dƒ |rt|j| j
ƒ |jd
ƒ t	dƒ x„| jD ]z}t|tƒršt||ƒrš|}	n
| j|ƒ}	t|	dƒrÒt|	jtƒrÒ|j|	jt|	jƒ ƒ n|j|	jƒ |jd	|	j ƒ t	dƒ q|W t	|| jƒƒ d S )Nr   )Ú	gen_usage)r½   z
Global options:rL   z*Information display options (just display z!information, ignore any commands)r¿   zOptions for '%s' command:zKInformation display options (just display information, ignore any commands))Údistutils.corerÔ   rÀ   r½   r°   r¼   rÌ   Z
print_helpÚcommon_usageÚprintr¯   r…   rÇ   ÚtyperÆ   rÄ   rm   r¿   rÈ   r¾   rË   r�   rY   )
rr   r¨   r¼   r¯   r…   rÔ   r½   rM   ru   ÚklassrH   rH   rI   rµ   b  s6    

 

zDistribution._show_helpc       	      C   sÒ   ddl m} | jr4| jƒ  tdƒ t|| jƒƒ dS d}i }x| jD ]}d||d < qDW xt|D ]l\}}|r^|j|ƒr^t|ƒ}t	| j
d| ƒƒ }|dkr¦tdj|ƒƒ n |dkr¾tdj|ƒƒ nt|ƒ d}q^W |S )Nr   )rÔ   rL   r   rK   r>   r:   rÒ   r<   r@   rB   rD   rN   )r>   r:   )r<   r@   rB   rD   )rÕ   rÔ   Zhelp_commandsÚprint_commandsr×   rY   r¯   re   r   rV   rT   r’   )	rr   r¸   rÔ   Zany_display_optionsZis_display_optionÚoptionrw   rx   rÐ   rH   rH   rI   r³   ”  s,    z#Distribution.handle_display_optionsc             C   sn   t |d ƒ x\|D ]T}| jj|ƒ}|s0| j|ƒ}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×   rW   re   rÄ   r6   ÚAttributeError)rr   r…   r„   Ú
max_lengthÚcmdrÙ   r6   rH   rH   rI   Ú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jƒ D ]}|j|ƒs:|j|ƒ q:W d}x$|| D ]}t|ƒ|krdt|ƒ}qdW | j|d|ƒ |r¦t	ƒ  | j|d|ƒ d S )Nr   r   zStandard commandszExtra commands)
Údistutils.commandru   Ú__all__rW   r�   re   r”   r¶   rà   r×   )rr   rŠ   Ústd_commandsÚis_stdrß   Úextra_commandsrÞ   rH   rH   rI   rÚ   Í  s*    

zDistribution.print_commandsc       	      C   s¼   dd l }|jj}i }x|D ]}d||< qW g }x&| jjƒ D ]}|j|ƒs:|j|ƒ q:W g }x\|| D ]P}| jj|ƒ}|s‚| j|ƒ}y
|j}W n t	k
r¤   d}Y nX |j||fƒ qdW |S )Nr   r   z(no description available))
rá   ru   râ   rW   r�   re   r”   rÄ   r6   rÝ   )	rr   rŠ   rã   rä   rß   rå   ÚrvrÙ   r6   rH   rH   rI   Úget_command_listî  s(    	




zDistribution.get_command_listc             C   sN   | j }t|tƒsJ|d krd}dd„ |jdƒD ƒ}d|krD|jddƒ || _ |S )NrL   c             S   s   g | ]}|d kr|j ƒ ‘qS )rL   )rÑ   )rF   ZpkgrH   rH   rI   rJ     s    z5Distribution.get_command_packages.<locals>.<listcomp>rÒ   zdistutils.commandr   )rX   rÇ   rÈ   rƒ   Úinsert)rr   ZpkgsrH   rH   rI   Úget_command_packages  s    
z!Distribution.get_command_packagesc             C   s¶   | j j|ƒ}|r|S x�| jƒ 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')
rW   re   ré   Ú
__import__rj   r�   ÚImportErrorrV   rÝ   rÅ   )rr   ru   rÙ   ZpkgnameZmodule_nameZ
klass_nameÚmodulerH   rH   rI   rÄ     s(    
zDistribution.get_command_classc             C   sn   | j j|ƒ}| rj|rjtr(| jd| ƒ | j|ƒ}|| ƒ }| j |< d| j|< | jj|ƒ}|rj| j||ƒ |S )Nz<Distribution.get_command_obj(): creating '%s' command objectr   )rc   re   r
   r‚   rÄ   rd   r[   Ú_set_command_options)rr   ru   ZcreateÚcmd_objrÙ   rM   rH   rH   rI   Úget_command_objB  s    


zDistribution.get_command_objc          !   C   sb  |j ƒ }|d kr| j|ƒ}tr,| jd| ƒ �x.|jƒ D �] \}\}}tr^| j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 Y d d }
~
X q8X q8W d S )Nz#  setting options for '%s' command:z    %s = %s (from %s)c             S   s   g | ]}t |ƒ‘qS rH   )r   )rF   ÚorH   rH   rI   rJ   q  s   z5Distribution._set_command_options.<locals>.<listcomp>z1error in %s: command '%s' has no such option '%s')Úget_command_namerg   r
   r‚   rf   Zboolean_optionsrÝ   r¤   rÇ   rÓ   rR   r   rm   r¦   r¥   )rr   rc   Zoption_dictÚcommand_namerÛ   ÚsourcerÐ   Z	bool_optsZneg_optZ	is_stringry   rH   rH   rI   rí   ]  s>    	






z!Distribution._set_command_optionsr   c             C   s€   ddl m} t||ƒs&|}| j|ƒ}n|jƒ }|js8|S |jƒ  d|_d| j|< | j|ƒ |r|x|j	ƒ D ]}| j
||ƒ qhW |S )Nr   )r½   )rÀ   r½   rÇ   rï   rñ   Z	finalizedZinitialize_optionsrd   rí   Zget_sub_commandsÚreinitialize_command)rr   ru   Zreinit_subcommandsr½   rò   ÚsubrH   rH   rI   rô   ‰  s    


z!Distribution.reinitialize_commandc             C   s   t j ||ƒ d S )N)r	   )rr   ry   ÚlevelrH   rH   rI   r‚   ²  s    zDistribution.announcec             C   s   x| j D ]}| j|ƒ qW d S )N)r…   Úrun_command)rr   rß   rH   rH   rI   Úrun_commandsµ  s    zDistribution.run_commandsc             C   sD   | j j|ƒrd S tjd|ƒ | j|ƒ}|jƒ  |jƒ  d| j |< d S )Nz
running %sr   )rd   re   r	   Úinforï   Zensure_finalizedZrun)rr   ru   rî   rH   rH   rI   r÷   ¿  s    	
zDistribution.run_commandc             C   s   t | jp| jpg ƒdkS )Nr   )r¶   r\   r]   )rr   rH   rH   rI   Úhas_pure_modulesÓ  s    zDistribution.has_pure_modulesc             C   s   | j ot| j ƒdkS )Nr   )r`   r¶   )rr   rH   rH   rI   Úhas_ext_modulesÖ  s    zDistribution.has_ext_modulesc             C   s   | j ot| j ƒdkS )Nr   )r^   r¶   )rr   rH   rH   rI   Úhas_c_librariesÙ  s    zDistribution.has_c_librariesc             C   s   | j ƒ p| jƒ S )N)rú   rû   )rr   rH   rH   rI   Úhas_modulesÜ  s    zDistribution.has_modulesc             C   s   | j ot| j ƒdkS )Nr   )r_   r¶   )rr   rH   rH   rI   Úhas_headersß  s    zDistribution.has_headersc             C   s   | j ot| j ƒdkS )Nr   )ra   r¶   )rr   rH   rH   rI   Úhas_scriptsâ  s    zDistribution.has_scriptsc             C   s   | j ot| j ƒdkS )Nr   )rb   r¶   )rr   rH   rH   rI   Úhas_data_fileså  s    zDistribution.has_data_filesc             C   s   | j ƒ o| jƒ  o| jƒ  S )N)rú   rû   rü   )rr   rH   rH   rI   Úis_pureè  s    
zDistribution.is_pure)r   r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   Nr   )r   Nr   )r   Nr   )r   r    r!   )r"   Nr#   )r$   Nr%   )r&   Nr'   )r(   Nr)   )r*   Nr+   )r,   Nr-   )r.   Nr/   )r0   Nr1   )r2   Nr3   )r4   Nr5   )r6   Nr7   )r8   Nr9   )r:   Nr;   )r<   Nr=   )r>   Nr?   )r@   NrA   )rB   NrC   )rD   NrE   )N)NNrL   )N)r   )N)r   )(r�   Ú
__module__Ú__qualname__r¼   rÖ   r¯   rQ   r¤   r|   rg   r‰   r—   r¬   r¹   r°   r´   rq   rµ   r³   rà   rÚ   rç   ré   rÄ   rï   rí   rô   r	   ÚINFOr‚   rø   r÷   rú   rû   rü   rý   rþ   rÿ   r   r  rH   rH   rH   rI   r      s¦    
                     
 "
0
:C[1(!"&

,
)
r   c               @   sö   e Zd ZdNZdOd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d0d1„ Zd2d3„ Zd4d5„ ZeZd6d7„ Zd8d9„ Zd:d;„ Zd<d=„ Zd>d?„ Zd@dA„ ZdBdC„ ZdDdE„ ZdFdG„ ZdHdI„ ZdJdK„ ZdLdM„ Z dS )PrS   r   r   r$   Úauthor_emailr(   Úmaintainer_emailr0   r2   r6   Úlong_descriptionr>   r:   r"   r,   Úcontact_emailr<   Údownload_urlr@   rB   rD   Nc             C   s‚   |d k	r| j 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  r0   r2   r6   r  r>   r:   r<   r	  r@   rB   rD   )rr   rŽ   rH   rH   rI   r|     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ƒjdƒ| _|dƒ| _|dƒ| _|dkrü|dƒ| _|dƒ| _|dƒ| _nd | _d | _d | _d S )Nc                s   ˆ |  }|dkrd S |S )NÚUNKNOWNrH   )r   rÐ   )ry   rH   rI   Ú_read_field  s    z7DistributionMetadata.read_pkg_file.<locals>._read_fieldc                s   ˆ j | d ƒ}|g krd S |S )N)Zget_all)r   Úvalues)ry   rH   rI   Ú
_read_list#  s    z6DistributionMetadata.read_pkg_file.<locals>._read_listzmetadata-versionr   r   Zsummaryr$   zauthor-emailz	home-pager2   zdownload-urlr6   r>   rÒ   ÚplatformZ
classifierz1.1rB   r@   rD   )r   r   r   r6   r$   r(   r  r  r0   r2   r	  r  rƒ   r>   r:   r<   rB   r@   rD   )rr   Úfiler  r  Zmetadata_versionrH   )ry   rI   r
    s:    












z"DistributionMetadata.read_pkg_filec          	   C   s2   t tjj|dƒddd��}| j|ƒ W d Q R X d S )NzPKG-INFOÚwzUTF-8)Úencoding)r  r�   rŽ   r’   Úwrite_pkg_file)rr   Zbase_dirZpkg_inforH   rH   rI   Úwrite_pkg_infoM  s    
z#DistributionMetadata.write_pkg_infoc             C   sb  d}| j s"| js"| js"| js"| jr&d}|jd| ƒ |jd| jƒ  ƒ |jd| jƒ  ƒ |jd| jƒ  ƒ |jd| j	ƒ  ƒ |jd| j
ƒ  ƒ |jd	| jƒ  ƒ |jd
| jƒ  ƒ | jrÈ|jd| j ƒ t| jƒ ƒ}|jd| ƒ dj| jƒ ƒ}|�r|jd| ƒ | j|d| jƒ ƒ | j|d| jƒ ƒ | j|d| jƒ ƒ | j|d| jƒ ƒ | j|d| jƒ ƒ 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@   rB   rD   r<   r	  rl   Úget_nameÚget_versionÚget_descriptionÚget_urlÚget_contactÚget_contact_emailÚget_licenser   Úget_long_descriptionr’   Úget_keywordsÚ_write_listÚget_platformsÚget_classifiersÚget_requiresÚget_providesÚget_obsoletes)rr   r  r   Z	long_descr>   rH   rH   rI   r  T  s0    z#DistributionMetadata.write_pkg_filec             C   s$   x|D ]}|j d||f ƒ qW d S )Nz%s: %s
)rl   )rr   r  r   r  rÐ   rH   rH   rI   r  v  s    
z DistributionMetadata._write_listc             C   s
   | j pdS )Nr  )r   )rr   rH   rH   rI   r  |  s    zDistributionMetadata.get_namec             C   s
   | j pdS )Nz0.0.0)r   )rr   rH   rH   rI   r    s    z DistributionMetadata.get_versionc             C   s   d| j ƒ | jƒ f S )Nz%s-%s)r  r  )rr   rH   rH   rI   Úget_fullname‚  s    z!DistributionMetadata.get_fullnamec             C   s
   | j pdS )Nr  )r$   )rr   rH   rH   rI   Ú
get_author…  s    zDistributionMetadata.get_authorc             C   s
   | j pdS )Nr  )r  )rr   rH   rH   rI   Úget_author_emailˆ  s    z%DistributionMetadata.get_author_emailc             C   s
   | j pdS )Nr  )r(   )rr   rH   rH   rI   Úget_maintainer‹  s    z#DistributionMetadata.get_maintainerc             C   s
   | j pdS )Nr  )r  )rr   rH   rH   rI   Úget_maintainer_emailŽ  s    z)DistributionMetadata.get_maintainer_emailc             C   s   | j p| jpdS )Nr  )r(   r$   )rr   rH   rH   rI   r  ‘  s    z DistributionMetadata.get_contactc             C   s   | j p| jpdS )Nr  )r  r  )rr   rH   rH   rI   r  ”  s    z&DistributionMetadata.get_contact_emailc             C   s
   | j pdS )Nr  )r0   )rr   rH   rH   rI   r  —  s    zDistributionMetadata.get_urlc             C   s
   | j pdS )Nr  )r2   )rr   rH   rH   rI   r  š  s    z DistributionMetadata.get_licensec             C   s
   | j pdS )Nr  )r6   )rr   rH   rH   rI   r  ž  s    z$DistributionMetadata.get_descriptionc             C   s
   | j pdS )Nr  )r  )rr   rH   rH   rI   r  ¡  s    z)DistributionMetadata.get_long_descriptionc             C   s
   | j pg S )N)r>   )rr   rH   rH   rI   r  ¤  s    z!DistributionMetadata.get_keywordsc             C   s   | j p
dgS )Nr  )r:   )rr   rH   rH   rI   r   §  s    z"DistributionMetadata.get_platformsc             C   s
   | j pg S )N)r<   )rr   rH   rH   rI   r!  ª  s    z$DistributionMetadata.get_classifiersc             C   s
   | j pdS )Nr  )r	  )rr   rH   rH   rI   Úget_download_url­  s    z%DistributionMetadata.get_download_urlc             C   s
   | j pg S )N)rB   )rr   rH   rH   rI   r"  ±  s    z!DistributionMetadata.get_requiresc             C   s,   dd l }x|D ]}|jj|ƒ qW || _d S )Nr   )Údistutils.versionpredicateÚversionpredicateÚVersionPredicaterB   )rr   rÐ   rŠ   r   rH   rH   rI   Úset_requires´  s    
z!DistributionMetadata.set_requiresc             C   s
   | j pg S )N)r@   )rr   rH   rH   rI   r#  º  s    z!DistributionMetadata.get_providesc             C   s:   dd„ |D ƒ}x |D ]}dd l }|jj|ƒ qW || _d S )Nc             S   s   g | ]}|j ƒ ‘qS rH   )rÑ   )rF   r   rH   rH   rI   rJ   ¾  s    z5DistributionMetadata.set_provides.<locals>.<listcomp>r   )r+  r,  Zsplit_provisionr@   )rr   rÐ   r   rŠ   rH   rH   rI   Úset_provides½  s
    
z!DistributionMetadata.set_providesc             C   s
   | j pg S )N)rD   )rr   rH   rH   rI   r$  Ä  s    z"DistributionMetadata.get_obsoletesc             C   s,   dd l }x|D ]}|jj|ƒ qW || _d S )Nr   )r+  r,  r-  rD   )rr   rÐ   rŠ   r   rH   rH   rI   Úset_obsoletesÇ  s    
z"DistributionMetadata.set_obsoletes)r   r   r$   r  r(   r  r0   r2   r6   r  r>   r:   r"   r,   r  r<   r	  r@   rB   rD   )N)!r�   r  r  rU   r|   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$  r0  rH   rH   rH   rI   rS   ô  sF        
4"rS   c             C   s(   g }x| D ]}|j |dd… ƒ q
W |S )Nr   é   )r”   )rM   Znew_optionsZ
help_tuplerH   rH   rI   rË   Í  s    
rË   )rj   r�   ÚreZemailr   rh   rë   Zdistutils.errorsZdistutils.fancy_getoptr   r   Zdistutils.utilr   r   r   rŠ   r	   Zdistutils.debugr
   ÚcompilerÁ   r   rS   rË   rH   rH   rH   rI   Ú<module>   s0   

       ] Z