Your IP : 18.216.156.226


Current Path : /opt/alt/python35/lib64/python3.5/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/__pycache__/cmd.cpython-35.opt-2.pyc



���]�J�@s�ddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
ddlmZGdd�d�ZGdd�de�Z
dS)	�N)�DistutilsOptionError)�util�dir_util�	file_util�archive_util�dep_util)�logc@s�eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�Zddd
d�Z	dd�Z
ddd�Zdd�Zddd�Z
ddd�Zdd�Zddd�Zdd�Zd d!�Zd"d#�Zd$d%�Zdd&d'�Zd(d)d*�Zd+d,�Zd-d.�Zd/d0�Zddd1d2�Zd3d4d5�Zddddd6d7�Zddd(dd8d9�Zdd:d;�Zddd<d=�Zddddd>d?�Z dddd@dA�Z!dS)B�CommandcCs�ddlm}t||�s+td��|jtkrFtd��||_|j�d|_	|j
|_
d|_d|_d|_
dS)Nr)�Distributionz$dist must be a Distribution instancezCommand is an abstract class)Zdistutils.distr
�
isinstance�	TypeError�	__class__r	�RuntimeError�distribution�initialize_optionsZ_dry_run�verbose�force�help�	finalized)�selfZdistr
�r�(/opt/alt/python35/lib64/python3.5/cmd.py�__init__/s	

			zCommand.__init__cCsR|dkrBt|d|�}|dkr;t|j|�S|Snt|��dS)N�dry_run�_)�getattrr�AttributeError)r�attrZmyvalrrr�__getattr___szCommand.__getattr__cCs |js|j�d|_dS)N�)r�finalize_options)rrrr�ensure_finalizedis	
zCommand.ensure_finalizedcCstd|j��dS)Nz,abstract method -- subclass %s must override)rr
)rrrrr{s
zCommand.initialize_optionscCstd|j��dS)Nz,abstract method -- subclass %s must override)rr
)rrrrr �szCommand.finalize_optionsN�cCs�ddlm}|dkr,d|j�}|j||dtj�|d}x||jD]q\}}}|j|�}|d	dkr�|dd
�}t||�}|j|d||fdtj�qZWdS)Nr)�
longopt_xlatezcommand options for '%s':�levelz  r�=z%s = %s���r&)	Zdistutils.fancy_getoptr#�get_command_name�announcer�INFO�user_options�	translater)r�header�indentr#�optionr�valuerrr�dump_options�s
zCommand.dump_optionscCstd|j��dS)Nz,abstract method -- subclass %s must override)rr
)rrrr�run�s
zCommand.runrcCstj||�dS)N)r)r�msgr$rrrr(�szCommand.announcecCs1ddlm}|r-t|�tjj�dS)Nr)�DEBUG)Zdistutils.debugr3�print�sys�stdout�flush)rr2r3rrr�debug_print�s
zCommand.debug_printcCs[t||�}|dkr/t|||�|St|t�sWtd|||f��|S)Nz'%s' must be a %s (got `%s`))r�setattrr�strr)rr.�what�default�valrrr�_ensure_stringlike�szCommand._ensure_stringlikecCs|j|d|�dS)N�string)r>)rr.r<rrr�
ensure_string�szCommand.ensure_stringcCs�t||�}|dkrdSt|t�rMt||tjd|��nMt|t�rxtdd�|D��}nd}|s�td||f��dS)Nz,\s*|\s+css|]}t|t�VqdS)N)rr:)�.0�vrrr�	<genexpr>�sz-Command.ensure_string_list.<locals>.<genexpr>Fz''%s' must be a list of strings (got %r))	rrr:r9�re�split�list�allr)rr.r=�okrrr�ensure_string_list�szCommand.ensure_string_listcCsL|j|||�}|dk	rH||�rHtd|||f��dS)Nzerror in '%s' option: )r>r)rr.Ztesterr;Z	error_fmtr<r=rrr�_ensure_tested_string�s
zCommand._ensure_tested_stringcCs |j|tjjdd�dS)N�filenamez$'%s' does not exist or is not a file)rJ�os�path�isfile)rr.rrr�ensure_filename�szCommand.ensure_filenamecCs |j|tjjdd�dS)Nzdirectory namez)'%s' does not exist or is not a directory)rJrLrM�isdir)rr.rrr�ensure_dirnameszCommand.ensure_dirnamecCs$t|d�r|jS|jjSdS)N�command_name)�hasattrrRr
�__name__)rrrrr'	szCommand.get_command_namecGse|jj|�}|j�xB|D]:\}}t||�dkr#t||t||��q#WdS)N)r�get_command_objr!rr9)rZsrc_cmdZoption_pairsZsrc_cmd_objZ
src_optionZ
dst_optionrrr�set_undefined_optionss

zCommand.set_undefined_optionscCs#|jj||�}|j�|S)N)rrUr!)r�commandZcreateZcmd_objrrr�get_finalized_command$s
zCommand.get_finalized_commandrcCs|jj||�S)N)r�reinitialize_command)rrWZreinit_subcommandsrrrrY0szCommand.reinitialize_commandcCs|jj|�dS)N)r�run_command)rrWrrrrZ4szCommand.run_commandcCsIg}x<|jD]1\}}|dks4||�r|j|�qW|S)N)�sub_commands�append)r�commandsZcmd_name�methodrrr�get_sub_commands;s
zCommand.get_sub_commandscCs!tjd|j�|f�dS)Nzwarning: %s: %s
)r�warnr')rr2rrrr`Ks	zCommand.warncCs tj|||d|j�dS)Nr)r�executer)r�func�argsr2r$rrrraOszCommand.executei�cCstj||d|j�dS)Nr)r�mkpathr)r�name�moderrrrdRszCommand.mkpathc	Cs)tj|||||j|d|j�S)Nr)r�	copy_filerr)r�infile�outfile�
preserve_mode�preserve_times�linkr$rrrrgUszCommand.copy_filec	Cs)tj||||||jd|j�S)Nr)r�	copy_treerr)rrhrirjrkZpreserve_symlinksr$rrrrm^szCommand.copy_treecCstj||d|j�S)Nr)r�	move_filer)r�src�dstr$rrrrngszCommand.move_filecCs*ddlm}|||d|j�dS)Nr)�spawnr)Zdistutils.spawnrqr)r�cmdZsearch_pathr$rqrrrrqksz
Command.spawncCs+tj||||d|jd|d|�S)Nr�owner�group)r�make_archiver)r�	base_name�format�root_dir�base_dirrsrtrrrrups	zCommand.make_archivecCs�|dkrd|}t|t�r1|f}n!t|ttf�sRtd��|dkrwd|dj|�f}|js�tj||�r�|j	||||�n
t
j|�dS)Nzskipping %s (inputs unchanged)z9'infiles' must be a string, or a list or tuple of stringszgenerating %s from %sz, )rr:rF�tupler�joinrrZnewer_grouprar�debug)rZinfilesrirbrcZexec_msgZskip_msgr$rrr�	make_filevs

	zCommand.make_file)"rT�
__module__�__qualname__r[rrr!rr r0r1r(r8r>r@rIrJrOrQr'rVrXrYrZr_r`rardrgrmrnrqrur}rrrrr	sD0



r	c@sIeZdZd
gZdd�Zdd�Zdd	�Zd
d�ZdS)�install_misc�install-dir=�d�!directory to install the files tocCsd|_g|_dS)N)�install_dir�outfiles)rrrrr�s	zinstall_misc.initialize_optionscCs|jd|df�dS)N�installr�)rV)r�dirnamerrr�_install_dir_from�szinstall_misc._install_dir_fromcCsmg|_|sdS|j|j�xC|D];}|j||j�|jjtjj|j|��q*WdS)N)r�rdr�rgr\rLrMr{)rZfilelist�frrr�_copy_files�s	
zinstall_misc._copy_filescCs|jS)N)r�)rrrr�get_outputs�szinstall_misc.get_outputsN)r�r�r�)rTr~rr*rr�r�r�rrrrr��s
		r�)r5rLrDZdistutils.errorsrZ	distutilsrrrrrrr	r�rrrr�<module>s$(��

?>