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.10/distutils/tests/__pycache__/test_install.cpython-310.pyc
o

�i#�@s�dZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZddl
mZdd	lmZdd
lmZddlmZddlmZddlmZd
d�ZGdd�dejejejej �Z!dd�Z"e#dkrzee"��dSdS)z$Tests for distutils.command.install.�N)�captured_stdout�run_unittest)�	sysconfig)�install�
HAS_USER_SITE)r)�	build_ext)�INSTALL_SCHEMES)�Distribution)�DistutilsOptionError)�	Extension)�supportcCs|t�d�S)NZ
EXT_SUFFIX)rZget_config_var)�modname�r�9/usr/local/lib/python3.10/distutils/tests/test_install.py�_make_ext_namesrcsleZdZ�fdd�Z�fdd�Zdd�Ze�ed�dd	��Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Z�ZS)�InstallTestCasecst���ttj�|_dS�N)�super�setUp�dictr�_config_vars�_backup_config_vars��self��	__class__rrr s
zInstallTestCase.setUpcs&t���tj��tj�|j�dSr)r�tearDownrr�clear�updaterrrrrr$s

zInstallTestCase.tearDowncs���}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�|�}��||�dSr)�os�path�normpath�assertEqual)Zgot�expectedrrr�
check_path?szAInstallTestCase.test_home_installation_scheme.<locals>.check_pathZpythonZinclude�bin)�mkdtempr!r"�joinr	Zscript_namerZDummyCommand�command_objr�home�ensure_finalizedr$�install_baseZinstall_platbaseZinstall_lib�sys�
platlibdirZinstall_platlibZinstall_purelibZinstall_headersZinstall_scriptsZinstall_data)rZbuilddirZdestination�dist�cmdr&�libdirr/rrr�test_home_installation_scheme)s0��z-InstallTestCase.test_home_installation_schemezneed user sitecsZtj�_tj�_����_tj�	�jd��_
tj�	�jd��_�j
t_�jt_�j
t_�jt_�fdd�}tjj
�_|tj_
�fdd�}��|�trVdD]}��|t�qMtdd	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)r"rrr�_expanduser\sz3InstallTestCase.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_expandr!r"�
expanduserrrrr�cleanupas
z/InstallTestCase.test_user_site.<locals>.cleanup)Znt_userZ	unix_userr�xxcSsg|]\}}}|�qSrr)�.0rZshortZlablerrr�
<listcomp>rsz2InstallTestCase.test_user_site.<locals>.<listcomp>�user��userbaseZusersite)r9r:r8r<r;r(r6r!r"r)�	user_base�	user_siter=r?r>Z
addCleanuprZassertInrr	rZuser_optionsrDZassertFalse�existsr,Z
assertTrueZconfig_vars)rr7r@�keyr0r1�optionsrrr�test_user_siteNs>


�zInstallTestCase.test_user_sitecCs�tddd��}t|�}|��|�|jddg�|�|jd�|�|jd�dg|_|��|�|jdg�|�|jd�|�|jd�d|_|_|��|�|jd�|�|jd�|�|jd�d|_|�t|j�dS)NrAz	path,dirs)r�
extra_pathr"�dirs�zpath,dirs,again)	r	rZhandle_extra_pathr$rMZ
extra_dirsZ	path_file�assertRaisesr
�rr0r1rrr�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)NrrA�prefix�baser+rD)	r	rrSr-rPr
Zfinalize_optionsr+rDrQrrr�test_finalize_options�sz%InstallTestCase.test_finalize_optionsc	Cs�|��}|jdgdgd�\}}t�|�|�dd�|�dd�t|�}||jd<||_tj�	|d�|_
|��|��t
|j
�}z
|��}W|��n|��wd	d
�|��D�}ddtjjddtjdd
�g}|�||�dS)NZhelloZsayhi)Z
py_modulesZscriptszhello.pyzdef main(): print('o hai')zfrom hello import main; main()r�filelistcS�g|]}tj�|��qSr�r!r"�basename�rB�linerrrrC��z/InstallTestCase.test_record.<locals>.<listcomp>zhello.%s.pyc�UNKNOWN-0.0.0-py%s.%s.egg-info�)r(�create_distr!�chdirZ
write_filerr*�rootr"r)�recordr,�run�open�read�close�
splitlinesr.�implementation�	cache_tag�version_infor$)	r�install_dir�project_dirr0r1�f�content�foundr%rrr�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|��wdd	�|��D�}td�d
tjdd�g}	|�||	�dS)NzThe %r command is not foundrAz
xxmodule.c)Zext_modulesrrrVcSrWrrXrZrrrrC�r\z:InstallTestCase.test_record_extensions.<locals>.<listcomp>r]r^)�test_supportZmissing_compiler_executableZskipTestr(r_rr!r`rZcopy_xxmodule_crZfixup_build_extr,rr*rar"r)rbrcrdrerfrgrr.rjr$)
rr1rkrlr0Zbuildextcmdrmrnror%rrr�test_record_extensions�s8
�






�z&InstallTestCase.test_record_extensionscCsht|j�}dt_zt��|��Wd�n1swYWdt_ndt_w|�t|j�|�dS)NTF)�lenZlogsr=�DEBUGrrpZ
assertGreater)rZold_logs_lenrrr�test_debug_mode�s

��zInstallTestCase.test_debug_mode)�__name__�
__module__�__qualname__rrr3�unittestZ
skipUnlessrrLrRrUrprrru�
__classcell__rrrrrs
%
8!rcCs
t�t�Sr)ryZ	makeSuiterrrrr�
test_suites
r{�__main__)$�__doc__r!r.ryr9Ztest.supportrrZ	distutilsrZdistutils.command.installrrZdistutils.commandr=Zdistutils.command.build_extrrZdistutils.corer	Zdistutils.errorsr
Zdistutils.extensionrZdistutils.testsr�testrqrZTempdirManagerZEnvironGuardZLoggingSilencerZTestCaserr{rvrrrr�<module>s6�f�