3 \ 2@sddlZddlZddlZddlZddlmZddlmZmZddl m Z GdddZ ddZ ej fd d Zd d ZdddZdS)N) convert_path)DistutilsTemplateErrorDistutilsInternalError)logc@sxeZdZdddZddZejfddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdddZdddZdS)FileListNcCsd|_g|_dS)N)allfilesfiles)selfwarn debug_printr */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.debugrprint)r msgrr r r r )s zFileList.debug_printcCs|jj|dS)N)rappend)r itemr r r r3szFileList.appendcCs|jj|dS)N)rextend)r itemsr r r r6szFileList.extendcCs@tttjj|j}g|_x |D]}|jjtjj|q WdS)N)sortedmapospathsplitrrjoin)r Zsortable_filesZ sort_tupler r r sort9s z FileList.sortcCsDx>tt|jdddD]$}|j||j|dkr|j|=qWdS)Nr)rangelenr)r ir r r remove_duplicatesCszFileList.remove_duplicatescCs|j}|d}d}}}|dkrTt|dkr ...cSsg|] }t|qSr )r).0wr r r Wsz1FileList._parse_template_line..r recursive-includerecursive-excludez,'%s' expects ...cSsg|] }t|qSr )r)r+r,r r r r-]sgraftprunez#'%s' expects a single zunknown action '%s')r&r'r(r))r.r/)r1r2)rr#rr)r lineZwordsactionpatternsr dir_patternr r r _parse_template_lineLs,         zFileList._parse_template_linecCsX|j|\}}}}|dkrZ|jddj|x&|D]}|j|dds4tjd|q4Wn|dkr|jddj|x&|D]}|j|dds|tjd |q|Wn|d kr|jd dj|x&|D]}|j|d dstjd |qWnj|dkr8|jddj|x*|D]"}|j|d dstjd|qWn|dkr|jd|dj|fx,|D]$}|j||ds`tjd||q`Wn|dkr|jd|dj|fx|D]$}|j||dstjd||qWnx|dkr|jd||jd|dsTtjd|nB|dkrH|jd||jd|dsTtjd|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 rinclude_patternrr exclude_patternr)r r3r4r5rr6patternr r r process_template_linehsf           zFileList.process_template_liner rcCspd}t||||}|jd|j|jdkr4|jx6|jD],}|j|r<|jd||jj|d}qr;r<r r r r rs    L ,rcCs&ddtj|ddD}ttjj|S)Ncss,|]$\}}}|D]}tjj||VqqdS)N)rrr)r+basedirsrfiler r r sz#_find_all_simple..T) followlinks)rwalkfilterrisfile)rZresultsr r r _find_all_simplesrQcCs6t|}|tjkr.tjtjj|d}t||}t|S)N)start) rQrrH functoolspartialrrelpathrlist)rrZmake_relr r r rs   rcCs8tj|}tj}tjdkrd}d|}tjd||}|S)N\z\\\\z\1[^%s]z((?t|}nd}|dk rt|}|t|t|t|}tj} tjdkrd} |t|t|t|}d||| ||f}n|rd||t|df}tj|S)N_rWz\\z%s\A%s%s.*%s%sz%s\A%s) isinstancestrr[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