Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/distutils/tests/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/distutils/tests/__pycache__/test_install.cpython-37.opt-1.pyc

B

� f�!�@s�dZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlmZ
ddlmZddl
mZddlmZdd	lmZdd
lmZddlmZddlmZdd
�ZGdd�dejejejej�Z dd�Z!e"dkr�ee!��dS)z$Tests for distutils.command.install.�N)�captured_stdout�run_unittest)�	sysconfig)�install)�	build_ext)�INSTALL_SCHEMES)�Distribution)�DistutilsOptionError)�	Extension)�supportcCs|t�d�S)NZ
EXT_SUFFIX)rZget_config_var)�modname�r
�A/opt/alt/python37/lib64/python3.7/distutils/tests/test_install.py�_make_ext_namesrc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�InstallTestCasecs���}tj�|d�}tddi�}tj�|d�|_tj|tj�|d�d�|jd<t	|�}||_
|����|j
|���|j|��fdd	�}tj�|dd
�}tj�|dd
�}||j|�||j|�||j|�||jtj�|dd
d��||jtj�|d
��||j|�dS)NZinstallation�nameZfoopkgzsetup.py�lib)Z
build_baseZ	build_libZbuildcs(tj�|�}tj�|�}��||�dS)N)�os�path�normpath�assertEqual)Zgot�expected)�selfr
r�
check_path6szAInstallTestCase.test_home_installation_scheme.<locals>.check_path�python�lib64Zinclude�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_schemecsZtj�_tj�_����_tj�	�jd��_
tj�	�jd��_�j
t_�jt_�j
t_�jt_�fdd�}tjj
�_|tj_
�fdd�}��|�xdD]}��|t�q�Wtdd	i�}t|�}d
d�|jD�}��d|�d
|_��tj��j
����tj��j��|����tj��j
����tj��j����d|j���d|j�dS)N�B�Scs�jS)N)�tmpdir)r)rr
r�_expanduserRsz3InstallTestCase.test_user_site.<locals>._expandusercs.�jt_�jt_�jt_�jt_�jtj_	dS)N)
�
old_user_base�site�	USER_BASE�
old_user_site�	USER_SITE�install_module�
old_expandrr�
expanduserr
)rr
r�cleanupWs
z/InstallTestCase.test_user_site.<locals>.cleanup)Znt_userZ	unix_userr�xxcSsg|]\}}}|�qSr
r
)�.0rZshortZlabler
r
r�
<listcomp>gsz2InstallTestCase.test_user_site.<locals>.<listcomp>�user��userbaseZusersite)r+r,r*r.r-rr(rrr�	user_base�	user_siter/r1r0Z
addCleanupZassertInrrrZuser_optionsr6ZassertFalse�existsr!Z
assertTrueZconfig_vars)rr)r2�keyr#r$Zoptionsr
)rr�test_user_siteEs:




zInstallTestCase.test_user_sitecCs�tddd��}t|�}|��|�|jddg�|�|jd�|�|jd�dg|_|��|�|jdg�|�|jd�|�|jd�d|_|_|��|�|jd�|�|jd�|�|jd�d|_|�t|j�dS)Nr3z	path,dirs)r�
extra_pathr�dirs�zpath,dirs,again)	rrZhandle_extra_pathrr>Z
extra_dirsZ	path_file�assertRaisesr	)rr#r$r
r
r�test_handle_extra_path|s$z&InstallTestCase.test_handle_extra_pathcCsftddi�}t|�}d|_d|_|�t|j�d|_d|_|�t|j�d|_d|_|�t|j�dS)Nrr3�prefix�baser r6)	rrrCr"rAr	Zfinalize_optionsr r6)rr#r$r
r
r�test_finalize_options�sz%InstallTestCase.test_finalize_optionsc	Cs�|��}|jdgdgd�\}}t�|�|�dd�|�dd�t|�}||jd<||_tj�	|d�|_
|��|��t
|j
�}z|��}Wd|��Xd	d
�|��D�}ddtjjddtjdd
�g}|�||�dS)NZhelloZsayhi)Z
py_modulesZscriptszhello.pyzdef main(): print('o hai')zfrom hello import main; main()r�filelistcSsg|]}tj�|��qSr
)rr�basename)r4�liner
r
rr5�sz/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�
splitlines�sys�implementation�	cache_tag�version_infor)	r�install_dir�project_dirr#r$�f�content�foundrr
r
r�test_record�s*



zInstallTestCase.test_recordc
Cst��}|dk	r|�d|�|��}|jtddg�gd�\}}t�|�t�	|�t
|�}t�|�|��t
|�}||jd<||jd<||_tj�|d�|_|��|��t|j�}z|��}Wd|��Xdd	�|��D�}td�d
tjdd�g}	|�||	�dS)NzThe %r command is not foundr3z
xxmodule.c)Zext_modulesrrrFcSsg|]}tj�|��qSr
)rrrG)r4rHr
r
rr5�sz:InstallTestCase.test_record_extensions.<locals>.<listcomp>zUNKNOWN-0.0.0-py%s.%s.egg-inforI)�test_supportZmissing_compiler_executableZskipTestrrJr
rrKrZcopy_xxmodule_crZfixup_build_extr!rrrLrrrMrNrOrPrQrRrrSrVr)
rr$rWrXr#ZbuildextcmdrYrZr[rr
r
r�test_record_extensions�s4






z&InstallTestCase.test_record_extensionsc	CsNt|j�}dt_zt��|��WdQRXWddt_X|�t|j�|�dS)NTF)�lenZlogsr/�DEBUGrr\Z
assertGreater)rZold_logs_lenr
r
r�test_debug_mode�s
zInstallTestCase.test_debug_modeN)
�__name__�
__module__�__qualname__r%r=rBrEr\r^rar
r
r
rrs%7!rcCs
t�t�S)N)�unittestZ	makeSuiterr
r
r
r�
test_suite�srf�__main__)#�__doc__rrSrer+Ztest.supportrrZ	distutilsrZdistutils.command.installrZdistutils.commandr/Zdistutils.command.build_extrrZdistutils.corerZdistutils.errorsr	Zdistutils.extensionr
Zdistutils.testsrZtestr]rZTempdirManagerZEnvironGuardZLoggingSilencerZTestCaserrfrbr
r
r
r�<module>s0X