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_filelist.cpython-37.pyc
B

!��g�,�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZddlZddlmZmZdd	lmZd
Zdd�ZGd
d�dejej�ZGdd�dej�Zdd�Zedkr�ee��dS)zTests for distutils.filelist.�N)�debug)�WARN)�DistutilsTemplateError)�
glob_to_re�translate_pattern�FileList)�filelist)�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)z"Converts '/' in a string to os.sep�/)�replace�os�sep)�s�r�9/usr/local/lib/python3.7/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'sz!FileListTestCase.assertNoWarningscCs"|�t|�t��d�|��dS)Nr)Z
assertGreater�lenrrr)rrrr�assertWarnings+szFileListTestCase.assertWarningscCsNtj}tjdkrt�tj�}x,dD]$\}}|d|i}|�t|�|�q"WdS)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)rrZglob�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|_x*t�d�D]}|��dkrtqb|�|�qbWddd|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_lineAs8
z+FileListTestCase.test_process_template_linec	Csvt�}t��}|�d�WdQRX|�|��d�dt_z0t��}|�d�WdQRX|�|��d�Wddt_XdS)NZxxxr#Tzxxx
F)rr	Zdebug_printr�getvaluer�DEBUG)rr*�stdoutrrr�test_debug_printisz!FileListTestCase.test_debug_printcCs,t�}dddg}|�|�|�|j|�dS)N�a�b�c)r�set_allfilesrr$)rr*r)rrr�test_set_allfilesws

z"FileListTestCase.test_set_allfilescCsBt�}ddddddg|_|��|��|�|jddddg�dS)Nr2r3�gr4)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)Nr2TF)ZanchorZis_regex�searchz*.pyzfilelist.py)�
assertTrue�hasattrrr�compilerr:)rrrrr�test_translate_pattern�s
z'FileListTestCase.test_translate_patterncCsdt�}|�|�d��t�}ddg|_|�|�d��t�}ddg|_|�d�|�|jdg�dS)Nz*.pyza.pyzb.pyza.txt)r�assertFalseZexclude_patternr)r;r)rr*rrr�test_exclude_pattern�s


z%FileListTestCase.test_exclude_patterncCs�t�}|�g�|�|�d��t�}|�ddg�|�|�d��t�}|�|j�|�ddg�|�d�|�|jddg�dS)Nz*.pyza.pyzb.txt�*)rr5r?Zinclude_patternr;ZassertIsNoner$r)rr*rrr�test_include_pattern�s

z%FileListTestCase.test_include_patterncCs�t}t�}xdD]}|�t|j|�qWt�}|�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-excludeZgraftZpruneZblargza.pyzb.txtzd/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(r5rr)rr)rr+r*�actionrrr�test_process_template�s�
















z&FileListTestCase.test_process_templateN)�__name__�
__module__�__qualname__rrr r-r1r6r9r>r@rBrDrrrrr$s(rc@s,eZdZejjdd��Zdd�Zdd�ZdS)�FindAllTestCasec	Cs6tj���"t�dd�|�t��g�WdQRXdS)N�foo�bar)�testr�temp_cwdr�symlinkrr�findall)rrrr�test_missing_symlink*sz$FindAllTestCase.test_missing_symlinkc	Cs~tj���jt�d�tj�dd�}tj�|�t�d�tj�dd�}tj�|�||g}|�t	t
���|�WdQRXdS)z�
        When findall is called with no parameters or with
        '.' as the parameter, the dot should be omitted from
        the results.
        rIz	file1.txtrJz	file2.txtN)rKrrLr�mkdir�path�join�create_empty_filer�sortedrrN)r�file1Zfile2�expectedrrr�test_basic_discovery0s

z$FindAllTestCase.test_basic_discoveryc	CsLtj���8}tj�|d�}tj�|�|g}|�t�	|�|�WdQRXdS)zj
        When findall is called with another path, the full
        path name should be returned.
        z	file1.txtN)
rKr�temp_dirrrQrRrSrrrN)rrXrUrVrrr�test_non_local_discovery@s
z(FindAllTestCase.test_non_local_discoveryN)	rErFrGrKrZskip_unless_symlinkrOrWrYrrrrrH)srHcCst�t�t�t�t�g�S)N)�unittestZ	TestSuiteZ	makeSuiterrHrrrr�
test_suiteLsr[�__main__)�__doc__rrrZZ	distutilsrZ
distutils.logrZdistutils.errorsrZdistutils.filelistrrrrZtest.supportrKr	r
Zdistutils.testsrr%rZLoggingSilencerZTestCaserrHr[rErrrr�<module>s*#