a DOg 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|_dSN)allfilesfiles)selfwarn debug_printr7/opt/alt/python39/lib64/python3.9/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.debugrprint)r msgrrrrr )s zFileList.debug_printcCs|j|dSr)r append)r itemrrrr3szFileList.appendcCs|j|dSr)r extend)r itemsrrrr6szFileList.extendcCs<tttjj|j}g|_|D]}|jtjj|qdSr)sortedmapospathsplitr rjoin)r Zsortable_filesZ sort_tuplerrrsort9sz FileList.sortcCs@tt|jdddD]$}|j||j|dkr|j|=qdS)Nr)rangelenr )r irrrremove_duplicatesCszFileList.remove_duplicatescCs|}|d}d}}}|dvrTt|dkr ...cSsg|] }t|qSrr.0wrrr Wz1FileList._parse_template_line..r")recursive-includerecursive-excludez,'%s' expects ...cSsg|] }t|qSrrr-rrrr0]r1)graftprunez#'%s' expects a single zunknown action '%s')rr%rr)r lineZwordsactionpatternsr dir_patternrrr_parse_template_lineLs0      zFileList._parse_template_linecCs@||\}}}}|dkrV|dd||D]}|j|dds2td|q2n|dkr|dd||D]}|j|ddsvtd |qvn|d kr|d d||D]}|j|d dstd |qn^|dkr(|dd||D]"}|j|d dstd|qn|dkrv|d|d|f|D]$}|j||dsNtd||qNn|dkr|d|d|f|D]$}|j||dstd||qnx|dkr|d||jd|dswarning: no files found matching '%s' anywhere in distributionr+zglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionr2zrecursive-include %s %s)prefixz:warning: no files found matching '%s' under directory '%s'r3zrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'r5zgraft z+warning: no directories found matching '%s'r6zprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')r;r r include_patternrr exclude_patternr)r r7r8r9rr:patternrrrprocess_template_linehs|             zFileList.process_template_liner"rcCsld}t||||}|d|j|jdur4||jD],}||r:|d||j|d}q:|S)NFz%include_pattern: applying regex r'%s'z adding T)translate_patternr rAr rsearchr r)r rAr=r>is_regex files_found pattern_renamerrrr?s    zFileList.include_patterncCsrd}t||||}|d|jtt|jdddD]4}||j|r8|d|j||j|=d}q8|S)NFz%exclude_pattern: applying regex r'%s'r"r#z removing T)rCr rAr$r%r rD)r rAr=r>rErFrGr&rrrr@szFileList.exclude_pattern)NN)r"Nr)r"Nr)__name__ __module__ __qualname__rrrcurdirrr rrr!r'r;rBr?r@rrrrrs    L ,rcCs&ddtj|ddD}ttjj|S)Ncss,|]$\}}}|D]}tj||VqqdSr)rrr )r.basedirsr filerrr sz#_find_all_simple..T) followlinks)rwalkfilterrisfile)rZresultsrrr_find_all_simples rUcCs6t|}|tjkr.tjtjj|d}t||}t|S)N)start) rUrrL functoolspartialrrelpathrlist)rr Zmake_relrrrrs   rcCs8t|}tj}tjdkrd}d|}td||}|S)N\z\\\\z\1[^%s]z((?t|}nd}|durt|}|t|t|t|}tj} tjdkrd} |t|t|t|}d||| ||f}n|rd||t|df}t|S)N_r[z\\z%s\A%s%s.*%s%sz%s\A%s) isinstancestrr_compilera partitionr%rr^) rAr=r>rErVrbendrGZ prefix_rer^rrrrC%s(   rC)r"Nr)rr_r\rWZdistutils.utilrZdistutils.errorsrrZ distutilsrrrUrLrrarCrrrrs  i