Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/tests/__pycache__/test_install.cpython-34.pyo

�
i f6!�@s?dZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlmZ
ddlmZddl
mZddlmZdd	lmZdd
lmZddlmZdd
�ZGdd�dejejejej�Zdd�Ze dkr;ee��ndS)z$Tests for distutils.command.install.�N)�captured_stdout�run_unittest)�	sysconfig)�install)�	build_ext)�INSTALL_SCHEMES)�Distribution)�DistutilsOptionError)�	Extension)�supportcCs?tjdkr.tjjd�r.|d7}n|tjd�S)N�ntz_d.exeZ_d�
EXT_SUFFIX)�os�name�sys�
executable�endswithr�get_config_var)�modname�r�A/opt/alt/python34/lib64/python3.4/distutils/tests/test_install.py�_make_ext_names!
rc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�InstallTestCasecs��j�}tjj|d�}tidd6�}tjj|d�|_tjd|dtjj|d��|jd<t	|�}||_
|j��j|j
|��j|j|��fd	d
�}tjj|dd�}tjj|dd�}||j|�||j|�||j|�||jtjj|d
dd��||jtjj|d��||j|�dS)NZinstallationZfoopkgrzsetup.pyZ
build_baseZ	build_lib�libZbuildcs8tjj|�}tjj|�}�j||�dS)N)r�path�normpath�assertEqual)Zgot�expected)�selfrr�
check_path7szAInstallTestCase.test_home_installation_scheme.<locals>.check_path�python�lib64�include�bin)�mkdtemprr�joinrZscript_namerZDummyCommand�command_objr�home�ensure_finalizedr�install_baseZinstall_platbaseZinstall_libZinstall_platlibZinstall_purelibZinstall_headersZinstall_scriptsZinstall_data)rZbuilddirZdestination�dist�cmdrZlibdirZ
platlibdirr)rr�test_home_installation_scheme!s,		
	z-InstallTestCase.test_home_installation_schemecs�tj�_tj�_�j��_tjj	�jd��_
tjj	�jd��_�j
t_�jt_�j
t_�jt_�fdd�}tjj
�_|tj_
�fdd�}�j|�xdD]}�j|t�q�Wtid	d
6�}t|�}dd�|jD�}�jd
|�d|_�jtjj�j
���jtjj�j��|j��jtjj�j
���jtjj�j���jd|j��jd|j�dS)N�B�Scs�jS)N)�tmpdir)r)rrr�_expanduserSsz3InstallTestCase.test_user_site.<locals>._expandusercsC�jt_�jt_�jt_�jt_�jtj_	dS)N)
�
old_user_base�site�	USER_BASE�
old_user_site�	USER_SITE�install_module�
old_expandrr�
expanduserr)rrr�cleanupXs
z/InstallTestCase.test_user_site.<locals>.cleanup�nt_user�	unix_user�xxrcSsg|]\}}}|�qSrr)�.0rZshortZlablerrr�
<listcomp>hs	z2InstallTestCase.test_user_site.<locals>.<listcomp>�user��userbaseZusersite)znt_userr;)r2r3r1r5r4r$r/rrr%�	user_base�	user_siter6r8r7Z
addCleanupZassertInrrrZuser_optionsr?ZassertFalse�existsr(Z
assertTrueZconfig_vars)rr0r9�keyr*r+Zoptionsr)rr�test_user_siteFs:

	
	
zInstallTestCase.test_user_sitecCs4tidd6dd6�}t|�}|j�|j|jddg�|j|jd�|j|jd�dg|_|j�|j|jdg�|j|jd�|j|jd�d|_|_|j�|j|jd�|j|jd�|j|jd�d|_|jt|j�dS)	Nr<rz	path,dirs�
extra_pathr�dirs�zpath,dirs,again)	rrZhandle_extra_pathrrGZ
extra_dirsZ	path_file�assertRaisesr	)rr*r+rrr�test_handle_extra_path}s$


	z&InstallTestCase.test_handle_extra_pathcCs�tidd6�}t|�}d|_d|_|jt|j�d|_d|_|jt|j�d|_d|_|jt|j�dS)Nr<r�prefix�baser'r?)	rrrLr)rJr	Zfinalize_optionsr'r?)rr*r+rrr�test_finalize_options�s						z%InstallTestCase.test_finalize_optionsc	Cs2|j�}|jddgddg�\}}tj|�|jdd�|jdd�t|�}||jd<||_tjj	|d	�|_
|j�|j�t
|j
�}z|j�}Wd|j�Xd
d�|j�D�}ddtjjdd
tjdd�g}|j||�dS)NZ
py_modulesZhello�scriptsZsayhizhello.pyzdef main(): print('o hai')zfrom hello import main; main()r�filelistcSs"g|]}tjj|��qSr)rr�basename)r=�linerrrr>�s	z/InstallTestCase.test_record.<locals>.<listcomp>zhello.%s.pyczUNKNOWN-0.0.0-py%s.%s.egg-info�)r$�create_distr�chdirZ
write_filerr&�rootrr%�recordr(�run�open�read�close�
splitlinesr�implementation�	cache_tag�version_infor)	r�install_dir�project_dirr*r+�f�content�foundrrrr�test_record�s*

	

zInstallTestCase.test_recordc

CsH|j�}|jdtddg�g�\}}tj|�tj|�t|�}tj|�|j	�t
|�}||jd<||jd<||_tj
j|d�|_|j	�|j�t|j�}z|j�}Wd|j�Xdd�|j�D�}td�d	tjdd
�g}	|j||	�dS)NZext_modulesr<z
xxmodule.crrrPcSs"g|]}tjj|��qSr)rrrQ)r=rRrrrr>�s	z:InstallTestCase.test_record_extensions.<locals>.<listcomp>zUNKNOWN-0.0.0-py%s.%s.egg-inforS)r$rTr
rrUrZcopy_xxmodule_crZfixup_build_extr(rr&rVrr%rWrXrYrZr[r\rrr_r)
rr`rar*Zbuildextcmdr+rbrcrdrrrr�test_record_extensions�s.	





	

	z&InstallTestCase.test_record_extensionscCs`t|j�}dt_zt��|j�WdQXWddt_X|jt|j�|�dS)NTF)�lenZlogsr6�DEBUGrreZ
assertGreater)rZold_logs_lenrrr�test_debug_mode�s	

zInstallTestCase.test_debug_modeN)
�__name__�
__module__�__qualname__r,rFrKrNrerfrirrrrrs%7rcCs
tjt�S)N)�unittestZ	makeSuiterrrrr�
test_suite�srn�__main__)!�__doc__rrrmr2Ztest.supportrrZ	distutilsrZdistutils.command.installrZdistutils.commandr6Zdistutils.command.build_extrrZdistutils.corerZdistutils.errorsr	Zdistutils.extensionr
Zdistutils.testsrrZTempdirManagerZEnvironGuardZLoggingSilencerZTestCaserrnrjrrrr�<module>s,�