U e5d 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.8/distutils/filelist.pyÚ__init__szFileList.__init__cCs ||_dSr)r )r r rrrÚ set_allfiles#szFileList.set_allfilescCst|ƒ|_dSr)Úfindallr )r Údirrrrr&szFileList.findallcCsddlm}|rt|ƒdS)Nr)ÚDEBUG)Zdistutils.debugrÚprint)r Úmsgrrrrr )s zFileList.debug_printcCs|j |¡dSr)r Úappend)r Úitemrrrr3szFileList.appendcCs|j |¡dSr)r Úextend)r Úitemsrrrr6szFileList.extendcCs<tttjj|jƒƒ}g|_|D]}|j tjj|Ž¡qdSr)ÚsortedÚmapÚosÚpathÚsplitr rÚjoin)r Zsortable_filesZ sort_tuplerrrÚsort9sz FileList.sortcCs@tt|jƒdddƒD]$}|j||j|dkr|j|=qdS)Néréÿÿÿÿ)ÚrangeÚlenr )r ÚirrrÚremove_duplicatesCszFileList.remove_duplicatescCsÞ| ¡}|d}d}}}|dkrTt|ƒdkr ...cSsg|] }t|ƒ‘qSrr©Ú.0ÚwrrrÚ Wsz1FileList._parse_template_line..r")úrecursive-includeúrecursive-excludeéz,'%s' expects ...cSsg|] }t|ƒ‘qSrrr-rrrr0]s)ÚgraftÚprunez#'%s' expects a single zunknown action '%s')rr%rr)r ÚlineZwordsÚactionÚpatternsrÚ dir_patternrrrÚ_parse_template_lineLs0  ÿ ÿ  ÿ zFileList._parse_template_linecCs@| |¡\}}}}|dkrV| dd |¡¡|D]}|j|dd�s2t d|¡q2�næ|dkrš| dd |¡¡|D]}|j|dd�svt d |¡qv�n¢|d krÞ| d d |¡¡|D]}|j|d d�sºt d |¡qº�n^|dk�r(| dd |¡¡|D]"}|j|d d��st d|¡�q�n|dk�rv| d|d |¡f¡|D]$}|j||d��sNt d||¡�qNnÆ|dk�rÄ| d|d |¡f¡|D]$}|j||d��sœt d||¡�qœnx|dk�rú| d|¡|jd|d��swarning: no files found matching '%s' anywhere in distributionr+zglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionr1zrecursive-include %s %s)Úprefixz:warning: no files found matching '%s' under directory '%s'r2zrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'r4zgraft z+warning: no directories found matching '%s'r5zprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')r:r r Úinclude_patternrr Úexclude_patternr)r r6r7r8rr9ÚpatternrrrÚprocess_template_linehs€ÿ ÿ ÿ  þ   ÿþ   ÿþ  ÿ ÿÿzFileList.process_template_liner"rcCsld}t||||ƒ}| d|j¡|jdkr4| ¡|jD],}| |¡r:| d|¡|j |¡d}q:|S)NFz%include_pattern: applying regex r'%s'z adding T)Útranslate_patternr r@r rÚsearchr r)r r@r<r=Úis_regexÚ files_foundÚ pattern_reÚnamerrrr>´sÿ    zFileList.include_patterncCsrd}t||||ƒ}| d|j¡tt|jƒdddƒD]4}| |j|¡r8| d|j|¡|j|=d}q8|S)NFz%exclude_pattern: applying regex r'%s'r"r#z removing T)rBr r@r$r%r rC)r r@r<r=rDrErFr&rrrr?ßsÿzFileList.exclude_pattern)NN)r"Nr)r"Nr)Ú__name__Ú __module__Ú __qualname__rrrÚcurdirrr rrr!r'r:rAr>r?rrrrrs    L ,ÿrcCs&dd„tj|dd�Dƒ}ttjj|ƒS)Ncss,|]$\}}}|D]}tj ||¡VqqdSr)rrr )r.ÚbaseÚdirsr ÚfilerrrÚ úsþz#_find_all_simple..T)Ú followlinks)rÚwalkÚfilterrÚisfile)rZresultsrrrÚ_find_all_simpleös þrTcCs6t|ƒ}|tjkr.tjtjj|d�}t||ƒ}t|ƒS)N)Ústart) rTrrKÚ functoolsÚpartialrÚrelpathrÚlist)rr Zmake_relrrrrs   rcCs8t |¡}tj}tjdkrd}d|}t d||¡}|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}t |¡S)NÚ_ÚrZz\\z%s\A%s%s.*%s%sz%s\A%s) Ú isinstanceÚstrr^Úcompiler`Ú partitionr%rr]) r@r<r=rDrUraÚendrFZ prefix_rer]rrrrB%s(   rB)r"Nr)rr^r[rVZdistutils.utilrZdistutils.errorsrrZ distutilsrrrTrKrr`rBrrrrÚs  i