3 \ 2ã@s‚ddlZddlZddlZddlZddlmZddlmZmZddl m Z Gdd„dƒZ dd„Z ej fd d „Zd d „Zddd„ZdS)éN)Ú convert_path)ÚDistutilsTemplateErrorÚDistutilsInternalError)Úlogc@sxeZdZddd„Zdd„Zejfdd„Zdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„Zddd„Zddd„ZdS)ÚFileListNcCsd|_g|_dS)N)ÚallfilesÚfiles)ÚselfÚwarnÚ debug_print©r ú*/usr/lib64/python3.6/distutils/filelist.pyÚ__init__szFileList.__init__cCs ||_dS)N)r)r rr r r Ú set_allfiles#szFileList.set_allfilescCst|ƒ|_dS)N)Úfindallr)r Údirr r r r&szFileList.findallcCsddlm}|rt|ƒdS)Nr)ÚDEBUG)Zdistutils.debugrÚprint)r Úmsgrr r r r )s zFileList.debug_printcCs|jj|ƒdS)N)rÚappend)r Úitemr r r r3szFileList.appendcCs|jj|ƒdS)N)rÚextend)r Úitemsr r r r6szFileList.extendcCs@tttjj|jƒƒ}g|_x |D]}|jjtjj|Žƒq WdS)N)ÚsortedÚmapÚosÚpathÚsplitrrÚjoin)r Zsortable_filesZ sort_tupler r r Úsort9s z FileList.sortcCsDx>tt|jƒdddƒD]$}|j||j|dkr|j|=qWdS)Néréÿÿÿÿ)ÚrangeÚlenr)r Úir r r Úremove_duplicatesCszFileList.remove_duplicatescCsÞ|jƒ}|d}d}}}|dkrTt|ƒdkr ...cSsg|] }t|ƒ‘qSr )r)Ú.0Úwr r r ú Wsz1FileList._parse_template_line..r úrecursive-includeúrecursive-excludeéz,'%s' expects ...cSsg|] }t|ƒ‘qSr )r)r+r,r r r r-]sÚgraftÚprunez#'%s' expects a single 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_linecCsX|j|ƒ\}}}}|dkrZ|jddj|ƒƒx&|D]}|j|dd�s4tjd|ƒq4W�nú|dkr¢|jddj|ƒƒx&|D]}|j|dd�s|tjd |ƒq|W�n²|d krê|jd dj|ƒƒx&|D]}|j|d d�sÄtjd |ƒqÄW�nj|dk�r8|jddj|ƒƒx*|D]"}|j|d d��stjd|ƒ�qW�n|dk�rŠ|jd|dj|ƒfƒx,|D]$}|j||d��s`tjd||ƒ�q`WnÊ|dk�rÜ|jd|dj|ƒfƒx¦|D]$}|j||d��s²tjd||ƒ�q²Wnx|dk�r|jd|ƒ|jd|d��sTtjd|ƒnB|dk�rH|jd|ƒ|jd|d��sTtjd|ƒn td|ƒ‚dS)Nr&zinclude ú r )Úanchorz%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')r7r rÚinclude_patternrr Úexclude_patternr)r r3r4r5rr6Úpatternr r r Úprocess_template_linehsf           zFileList.process_template_liner rcCspd}t||||ƒ}|jd|jƒ|jdkr4|jƒx6|jD],}|j|ƒr<|jd|ƒ|jj|ƒd}qr;r<r r r r rs    L ,rcCs&dd„tj|dd�Dƒ}ttjj|ƒS)Ncss,|]$\}}}|D]}tjj||ƒVqqdS)N)rrr)r+ÚbaseÚdirsrÚfiler r r ú ûsz#_find_all_simple..T)Ú followlinks)rÚwalkÚfilterrÚisfile)rZresultsr r r Ú_find_all_simpleösrQcCs6t|ƒ}|tjkr.tjtjj|d�}t||ƒ}t|ƒS)N)Ústart) rQrrHÚ functoolsÚpartialrÚrelpathrÚlist)rrZmake_relr r r rs   rcCs8tj|ƒ}tj}tjdkrd}d|}tjd||ƒ}|S)Nú\z\\\\z\1[^%s]z((?t|ƒ}nd}|dk r²t|ƒ}|t|ƒt|ƒt|ƒ…}tj} tjdkr‚d} |t|ƒt|ƒt|ƒ…}d||| ||f}n|rÎd||t|ƒd…f}tj|ƒS)NÚ_ÚrWz\\z%s\A%s%s.*%s%sz%s\A%s) Ú isinstanceÚstrr[Úcompiler]Ú partitionr#rrZ) r=r9r:rArRr^ÚendrCZ prefix_rerZr r r r?%s(   r?)r Nr)rr[rXrSZdistutils.utilrZdistutils.errorsrrZ distutilsrrrQrHrr]r?r r r r Ús  i