HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/distutils/tests/__pycache__/test_install.cpython-37.opt-2.pyc
B

!��gW!�@s�ddlZddlZddlZddlZddlmZmZddlmZddl	m
Z
ddlm
Zddl
mZddl	mZddlmZddlmZdd	lmZdd
lmZdd
lmZdd�ZGd
d�dejejejej�Zdd�Z e!dkr�ee ��dS)�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.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
�}||j|�||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_libZinstall_platlibZinstall_purelibZinstall_headersZinstall_scriptsZinstall_data)rZbuilddirZdestination�dist�cmdrZlibdirr
)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�_expanduserQsz3InstallTestCase.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�cleanupVs
z/InstallTestCase.test_user_site.<locals>.cleanup)Znt_userZ	unix_userr�xxcSsg|]\}}}|�qSr
r
)�.0rZshortZlabler
r
r�
<listcomp>fsz2InstallTestCase.test_user_site.<locals>.<listcomp>�user��userbaseZusersite)r)r*r(r,r+rr&rrr�	user_base�	user_siter-r/r.Z
addCleanupZassertInrrrZuser_optionsr4ZassertFalse�existsrZ
assertTrueZconfig_vars)rr'r0�keyr!r"�optionsr
)rr�test_user_siteDs:




zInstallTestCase.test_user_sitecCs�tddd��}t|�}|��|�|jddg�|�|jd�|�|jd�dg|_|��|�|jdg�|�|jd�|�|jd�d|_|_|��|�|jd�|�|jd�|�|jd�d|_|�t|j�dS)Nr1z	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)Nrr1�prefix�baserr4)	rrrBr r@r	Zfinalize_optionsrr4)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)r2�liner
r
rr3�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 foundr1z
xxmodule.c)Zext_modulesrrrEcSsg|]}tj�|��qSr
)rrrF)r2rGr
r
rr3�sz:InstallTestCase.test_record_extensions.<locals>.<listcomp>zUNKNOWN-0.0.0-py%s.%s.egg-inforH)�test_supportZmissing_compiler_executableZskipTestrrIr
rrJrZcopy_xxmodule_crZfixup_build_extrrrrKrrrLrMrNrOrPrQrrRrUr)
rr"rVrWr!ZbuildextcmdrXrYrZrr
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<rArDr[r]r`r
r
r
rrs$7!rcCs
t�t�S)N)�unittestZ	makeSuiterr
r
r
r�
test_suite�sre�__main__)"rrRrdr)Ztest.supportrrZ	distutilsrZdistutils.command.installrZdistutils.commandr-Zdistutils.command.build_extrrZdistutils.corerZdistutils.errorsr	Zdistutils.extensionr
Zdistutils.testsrZtestr\rZTempdirManagerZEnvironGuardZLoggingSilencerZTestCaserrerar
r
r
r�<module>s.W