Viewing File: /opt/alt/python35/lib64/python3.5/distutils/__pycache__/filelist.cpython-35.opt-2.pyc



й¼]æ0ã@s¼ddlZddlZddlZddlZddlmZddlmZmZddl	m
Z
Gdd„dƒZdd„Zej
d	d
„Zdd„Zd
dddd„ZdS)éN)Úconvert_path)ÚDistutilsTemplateErrorÚDistutilsInternalError)Úlogc@s¾eZdZdddd„Zdd„Zejdd„Zdd	„Zd
d„Z	dd
„Z
dd„Zdd„Zdd„Z
dd„Zddddd„Zddddd„ZdS)ÚFileListNcCsd|_g|_dS)N)ÚallfilesÚfiles)ÚselfÚwarnÚdebug_print©rú-/opt/alt/python35/lib64/python3.5/filelist.pyÚ__init__s	zFileList.__init__cCs
||_dS)N)r)r	rrrr
Úset_allfiles#szFileList.set_allfilescCst|ƒ|_dS)N)Úfindallr)r	Údirrrr
r&szFileList.findallcCs$ddlm}|r t|ƒdS)Nr)ÚDEBUG)Zdistutils.debugrÚprint)r	Úmsgrrrr
r)szFileList.debug_printcCs|jj|ƒdS)N)rÚappend)r	Úitemrrr
r3szFileList.appendcCs|jj|ƒdS)N)rÚextend)r	Úitemsrrr
r6szFileList.extendcCsXtttjj|jƒƒ}g|_x*|D]"}|jjtjj|Œƒq.WdS)N)ÚsortedÚmapÚosÚpathÚsplitrrÚjoin)r	Zsortable_filesZ
sort_tuplerrr
Úsort9s	
z
FileList.sortcCsVxOtt|jƒdddƒD].}|j||j|dkr |j|=q WdS)Néréÿÿÿÿ)ÚrangeÚlenr)r	Úirrr
Úremove_duplicatesCs&zFileList.remove_duplicatescCs1|jƒ}|d}d}}}|dkrrt|ƒdkrRtd|ƒ‚dd	„|d
d…Dƒ}n¯|dkrÐt|ƒd
kr td|ƒ‚t|d
ƒ}dd	„|dd…Dƒ}nQ|dkrt|ƒdkrþtd|ƒ‚t|d
ƒ}ntd|ƒ‚||||fS)NrÚincludeÚexcludeúglobal-includeúglobal-excludeéz&'%s' expects <pattern1> <pattern2> ...cSsg|]}t|ƒ‘qSr)r)Ú.0Úwrrr
ú
<listcomp>Ws	z1FileList._parse_template_line.<locals>.<listcomp>r úrecursive-includeúrecursive-excludeéz,'%s' expects <dir> <pattern1> <pattern2> ...cSsg|]}t|ƒ‘qSr)r)r+r,rrr
r-]s	ÚgraftÚprunez#'%s' expects a single <dir_pattern>zunknown action '%s')r&r'r(r))r.r/)r1r2)rr#rr)r	ÚlineZwordsÚactionÚpatternsrÚdir_patternrrr
Ú_parse_template_lineLs,
	
 
 
zFileList._parse_template_linecCs|j|ƒ\}}}}|dkrz|jddj|ƒƒx½|D]+}|j|ddƒsHtjd|ƒqHWn‡|dkrÙ|jddj|ƒƒx^|D]+}|j|ddƒs§tjd	|ƒq§Wn(|d
kr8|jddj|ƒƒxÿ|D]+}|j|ddƒstjd
|ƒqWnÉ|dkr—|jddj|ƒƒx |D]+}|j|ddƒsetjd|ƒqeWnj|dkrÿ|jd|dj|ƒfƒx;|D].}|j|d|ƒsÊtjd||ƒqÊWn|dkrg|jd|dj|ƒfƒxÓ|D].}|j|d|ƒs2tjd||ƒq2Wnš|dkr¬|jd|ƒ|jdd|ƒstjd|ƒnU|dkrñ|jd|ƒ|jdd|ƒstjd|ƒntd|ƒ‚dS)Nr&zinclude ú Úanchorr z%warning: no files found matching '%s'r'zexclude z9warning: no previously-included files found matching '%s'zglobal-includezglobal-include rz>warning: no files found matching '%s' anywhere in distributionzglobal-excludezglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionzrecursive-includezrecursive-include %s %sÚprefixz:warning: no files found matching '%s' under directory '%s'zrecursive-excludezrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'r1zgraft z+warning: no directories found matching '%s'r2zprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')r7rrÚinclude_patternrr
Úexclude_patternr)r	r3r4r5rr6Úpatternrrr
Úprocess_template_linehsf
	
	
	
		
		
		
	
zFileList.process_template_liner rcCs–d}t||||ƒ}|jd|jƒ|jdkrH|jƒxG|jD]<}|j|ƒrR|jd|ƒ|jj|ƒd}qRW|S)NFz%include_pattern: applying regex r'%s'z adding T)Útranslate_patternrr=rrÚsearchrr)r	r=r9r:Úis_regexÚfiles_foundÚ
pattern_reÚnamerrr
r;´s	

zFileList.include_patterncCs›d}t||||ƒ}|jd|jƒxett|jƒdddƒD]D}|j|j|ƒrO|jd|j|ƒ|j|=d}qOW|S)NFz%exclude_pattern: applying regex r'%s'r z
 removing Tr!r!)r?rr=r"r#rr@)r	r=r9r:rArBrCr$rrr
r<ßs	&

zFileList.exclude_pattern)Ú__name__Ú
__module__Ú__qualname__rrrÚcurdirrrrrrr%r7r>r;r<rrrr
rs

	L,rcCs5dd„tj|ddƒDƒ}ttjj|ƒS)Ncss:|]0\}}}|D]}tjj||ƒVqqdS)N)rrr)r+ÚbaseÚdirsrÚfilerrr
ú	<genexpr>ûsz#_find_all_simple.<locals>.<genexpr>ÚfollowlinksT)rÚwalkÚfilterrÚisfile)rÚresultsrrr
Ú_find_all_simpleös	rRcCsOt|ƒ}|tjkrEtjtjjd|ƒ}t||ƒ}t|ƒS)NÚstart)	rRrrHÚ	functoolsÚpartialrÚrelpathrÚlist)rrZmake_relrrr
rs
rcCsPtj|ƒ}tj}tjdkr-d}d|}tjd||ƒ}|S)Nú\z\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)ÚfnmatchÚ	translaterÚsepÚreÚsub)r=rCr[Úescapedrrr
Ú
glob_to_res	
r_r cCsÑ|r&t|tƒr"tj|ƒS|S|r;t|ƒ}nd}|dk	r´tdƒ}t|ƒdt|ƒ…}tj}tjdkr”d}d|j|d|fƒ}n|rÄd|}tj|ƒS)NÚrXz\\ú^z.*)	Ú
isinstanceÚstrr\Úcompiler_r#rr[r)r=r9r:rArCZ
empty_patternZ	prefix_rer[rrr
r?%s"
	 
r?)rr\rYrTZdistutils.utilrZdistutils.errorsrrZ	distutilsrrrRrHrr_r?rrrr
Ú<module>sè
Back to Directory File Manager