Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/distutils/tests/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/distutils/tests/__pycache__/test_install.cpython-39.opt-1.pyc

a

��g�!�@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
�8/usr/local/lib/python3.9/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
�}||j|�tj�|tjd
�}||j|�||j|�||jtj�|dd
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_pathZpythonZinclude�bin)�mkdtemprr�joinrZscript_namerZDummyCommand�command_objr�home�ensure_finalizedr�install_baseZinstall_platbaseZinstall_lib�sys�
platlibdirZinstall_platlibZinstall_purelibZinstall_headersZinstall_scriptsZinstall_data)rZbuilddirZdestination�dist�cmdr�libdirr$r
rr�test_home_installation_scheme s0��z-InstallTestCase.test_home_installation_schemecsVtj�_tj�_����_tj�	�jd��_
tj�	�jd��_�j
t_�jt_�j
t_�jt_�fdd�}tjj
�_|tj_
�fdd�}��|�dD]}��|t�q�tdd	i�}t|�}d
d�|jD�}��d|�d
|_��tj��j
����tj��j��|����tj��j
����tj��j����d|j���d|j�dS)N�B�Scs�jSr)�tmpdir)rrr
r�_expanduserRsz3InstallTestCase.test_user_site.<locals>._expandusercs.�jt_�jt_�jt_�jt_�jtj_	dSr)
�
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>g�z2InstallTestCase.test_user_site.<locals>.<listcomp>�user��userbaseZusersite)r.r/r-r1r0rr+rrr�	user_base�	user_siter2r4r3Z
addCleanupZassertInrrrZuser_optionsr:ZassertFalse�existsr!Z
assertTrueZconfig_vars)rr,r5�keyr%r&�optionsr
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)Nr6z	path,dirs)r�
extra_pathr�dirs�zpath,dirs,again)	rrZhandle_extra_pathrrCZ
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)Nrr6�prefix�baser r:)	rrrIr"rFr	Zfinalize_optionsr r:rGr
r
r�test_finalize_options�sz%InstallTestCase.test_finalize_optionsc	Cs�|��}|jdgdgd�\}}t�|�|�dd�|�dd�t|�}||jd<||_tj�	|d�|_
|��|��t
|j
�}z|��}W|��n
|��0d	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�r7�liner
r
rr8�r9z/InstallTestCase.test_record.<locals>.<listcomp>zhello.%s.pyc�UNKNOWN-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�foundrr
r
r�test_record�s.�




�zInstallTestCase.test_recordc
Cst��}|dur|�d|�|��}|jtddg�gd�\}}t�|�t�	|�t
|�}t�|�|��t
|�}||jd<||jd<||_tj�|d�|_|��|��t|j�}z|��}W|��n
|��0dd	�|��D�}td�d
tjdd�g}	|�||	�dS)NzThe %r command is not foundr6z
xxmodule.c)Zext_modulesrrrLcSsg|]}tj�|��qSr
rMrOr
r
rr8�r9z:InstallTestCase.test_record_extensions.<locals>.<listcomp>rQrR)�test_supportZmissing_compiler_executableZskipTestrrSr
rrTrZcopy_xxmodule_crZfixup_build_extr!rrrUrrrVrWrXrYrZr[rr#r^r)
rr&r_r`r%Zbuildextcmdrarbrcrr
r
r�test_record_extensions�s8
�






�z&InstallTestCase.test_record_extensionscCsht|j�}dt_z8t��|��Wd�n1s60YWdt_ndt_0|�t|j�|�dS)NTF)�lenZlogsr2�DEBUGrrdZ
assertGreater)rZold_logs_lenr
r
r�test_debug_mode�s
(zInstallTestCase.test_debug_modeN)
�__name__�
__module__�__qualname__r(rBrHrKrdrfrir
r
r
rrs%7!rcCs
t�t�Sr)�unittestZ	makeSuiterr
r
r
r�
test_suite�srn�__main__)#�__doc__rr#rmr.Ztest.supportrrZ	distutilsrZdistutils.command.installrZdistutils.commandr2Zdistutils.command.build_extrrZdistutils.corerZdistutils.errorsr	Zdistutils.extensionr
Zdistutils.testsr�testrerZTempdirManagerZEnvironGuardZLoggingSilencerZTestCaserrnrjr
r
r
r�<module>s2�[

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists