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_filelist.cpython-310.opt-2.pyc
o

�i�,�@s�	ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZmZddlm
Z
ddlmZddlmZmZdd	lmZd
Zdd�ZGd
d�dejej�ZGdd�dej�Zdd�Zedkrlee��dSdS)�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�FileList)�filelist)�	os_helper)�captured_stdout�run_unittest)�supportz�include ok
include xo
exclude xo
include foo.tmp
include buildout.cfg
global-include *.x
global-include *.txt
global-exclude *.tmp
recursive-include f *.oo
recursive-exclude global *.x
graft dir
prune dir3
cCs	|�dtj�S)N�/)�replace�os�sep)�s�r�:/usr/local/lib/python3.10/distutils/tests/test_filelist.py�make_local_pathsrc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�FileListTestCasecCs|�|�t�g�|��dS�N)�assertEqual�get_logsr�
clear_logs��selfrrr�assertNoWarnings'sz!FileListTestCase.assertNoWarningscCs"|�t|�t��d�|��dS)Nr)Z
assertGreater�lenrrrrrrr�assertWarnings+szFileListTestCase.assertWarningscCsJtj}tjdkrt�tj�}dD]\}}|d|i}|�t|�|�qdS)N�\))zfoo*z(?s:foo[^%(sep)s]*)\Z)zfoo?z(?s:foo[^%(sep)s])\Z)zfoo??z(?s:foo[^%(sep)s][^%(sep)s])\Z)zfoo\\*z(?s:foo\\\\[^%(sep)s]*)\Z)zfoo\\\*z(?s:foo\\\\\\[^%(sep)s]*)\Z)zfoo????z2(?s:foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s])\Z)zfoo\\??z"(?s:foo\\\\[^%(sep)s][^%(sep)s])\Zr)rr�re�escaperr)rr�glob�regexrrr�test_glob_to_re/s

�z FileListTestCase.test_glob_to_recCs�t�}t}ddddd|d�|d�|d�|d	�|d
�|d�|d�|d
�|d�|d�g|_t�d�D]}|��dkr9q0|�|�q0ddd|d�|d�|d�|d�|d�|d
�g	}|�|j|�dS)Nzfoo.tmp�okZxozfour.txtzbuildout.cfgz.hg/last-message.txtzglobal/one.txtzglobal/two.txtzglobal/files.xzglobal/here.tmpzf/o/f.ooz
dir/graft-onezdir/dir2/graft2zdir3/okzdir3/sub/ok.txt�
�)	rr�allfiles�MANIFEST_IN�split�strip�process_template_liner�files)r�	file_list�l�lineZwantedrrr�test_process_template_lineAs<��z+FileListTestCase.test_process_template_linecCs�t�}t��
}|�d�Wd�n1swY|�|��d�dt_z&t��
}|�d�Wd�n1s:wY|�|��d�Wdt_dSdt_w)NZxxxr'Tzxxx
F)rr
Zdebug_printr�getvaluer�DEBUG)rr.�stdoutrrr�test_debug_printis��z!FileListTestCase.test_debug_printcCs*t�}gd�}|�|�|�|j|�dS)N)�a�b�c)r�set_allfilesrr()rr.r-rrr�test_set_allfilesws
z"FileListTestCase.test_set_allfilescCs6t�}gd�|_|��|��|�|jgd��dS)N)r6r7r6�gr8r;)r6r7r8r;)rr-�sortZremove_duplicatesr�rr.rrr�test_remove_duplicates}s

z'FileListTestCase.test_remove_duplicatescCsr|�ttdddd�d��t�d�}|�t|ddd�|�|�ttdddd�d��|�tdddd��d��dS)Nr6TF)�anchorZis_regex�search�*.pyzfilelist.py)�
assertTrue�hasattrrr �compilerr@)rr#rrr�test_translate_pattern�s$�
����z'FileListTestCase.test_translate_patterncCsdt�}|�|�d��t�}ddg|_|�|�d��t�}ddg|_|�d�|�|jdg�dS)NrA�a.pyzb.pyza.txt)r�assertFalseZexclude_patternr-rBrr=rrr�test_exclude_pattern�s


z%FileListTestCase.test_exclude_patterncCs�t�}|�g�|�|�d��t�}|�ddg�|�|�d��t�}|�|j�|�ddg�|�d�|�|jddg�dS)NrArF�b.txt�*)rr9rGZinclude_patternrBZassertIsNoner(rr=rrr�test_include_pattern�s

z%FileListTestCase.test_include_patterncCs�t}t�}dD]
}|�t|j|�qt�}|�dd|d�g�|�d�|�|jdg�|��|�d�|�|jdg�|�	�t�}dd|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�t�}|�dd|d�g�|�d	�|�|jd|d�g�|��|�d
�|�|jd|d�g�|�	�t�}dd|d�g|_|�d�|�|jdg�|��|�d�|�|jdg�|�	�t�}|�d|d
�|d�|d�g�|�d�|�|j|d
�|d�g�|��|�d�|�|j|d
�|d�g�|�	�t�}d|d
�|d�|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�t�}|�d|d
�|d�|d�g�|�d�|�|j|d
�|d�g�|��|�d�|�|j|d
�|d�g�|�	�t�}d|d
�|d�|d�g|_|�d�|�|jd|d�g�|��|�d�|�|jd|d�g�|�	�dS)N)	ZincludeZexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludeZgraftZpruneZblargrFrIzd/c.pyzinclude *.pyzinclude *.rbzexclude *.pyzexclude *.rbzglobal-include *.pyzglobal-include *.rbzglobal-exclude *.pyzglobal-exclude *.rbzd/b.pyzd/c.txtzd/d/e.pyzrecursive-include d *.pyzrecursive-include e *.pyzrecursive-exclude d *.pyzrecursive-exclude e *.pyzf/f.pyzgraft dzgraft ezprune dzprune e)
rrZassertRaisesrr,r9rr-rr)rr/r.�actionrrr�test_process_template�s��







�



�



z&FileListTestCase.test_process_templateN)�__name__�
__module__�__qualname__rrr$r1r5r:r>rErHrKrMrrrrr$s(rc@s*eZdZejdd��Zdd�Zdd�ZdS)�FindAllTestCasecCsJt���t�dd�|�t��g�Wd�dS1swYdS)N�foo�bar)r	�temp_cwdr�symlinkrr�findallrrrr�test_missing_symlink*s
"�z$FindAllTestCase.test_missing_symlinkcCs�	t���9t�d�tj�dd�}t�|�t�d�tj�dd�}t�|�||g}|�tt	�
��|�Wd�dS1sAwYdS)NrR�	file1.txtrSz	file2.txt)r	rTr�mkdir�path�join�create_empty_filer�sortedrrV)r�file1Zfile2�expectedrrr�test_basic_discovery0s




"�z$FindAllTestCase.test_basic_discoverycCs`	t���!}tj�|d�}t�|�|g}|�t�|�|�Wd�dS1s)wYdS)NrX)	r	�temp_dirrrZr[r\rrrV)rrar^r_rrr�test_non_local_discovery@s

"�z(FindAllTestCase.test_non_local_discoveryN)rNrOrPr	Zskip_unless_symlinkrWr`rbrrrrrQ)s

rQcCst�t�t�t�t�g�Sr)�unittestZ	TestSuiteZ	makeSuiterrQrrrr�
test_suiteLs�rd�__main__)rr rcZ	distutilsrZ
distutils.logrZdistutils.errorsrZdistutils.filelistrrrrZtest.supportr	r
rZdistutils.testsrr)rZLoggingSilencerZTestCaserrQrdrNrrrr�<module>s0�#�