8fX7dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dgZ ej eZejdejZejd ejejzZejdd ZGd deZdS) zu Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. N)DistlibException)fsdecode convert_pathManifestz\\w* z#.*?(?= )| (?=$)cpeZdZdZddZdZdZdZddZd Z d Z d Z dd Z ddZ ddZdZdS)rz A list of files built by exploring the filesystem and filtered by applying various patterns to what we find there. Nctjtj|ptj|_|jtjz|_d|_t|_ dS)zd Initialise an instance. :param base: The base directory to explore under. N) ospathabspathnormpathgetcwdbasesepprefixallfilessetfiles)selfrs |/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/manifest.py__init__zManifest.__init__,sZ GOOBG$4$4T5HRY[[$I$IJJ i"&(  UU cddlm}m}m}gx|_}|j}|g}|j}|j}|r|}tj |} | D]} tj || } tj| } | j } || r#|t| k|| r|| s || |dSdS)zmFind all files under the base and set ``allfiles`` to the absolute pathnames of files found. r)S_ISREGS_ISDIRS_ISLNKN)statrrrrrpopappendr listdirr joinst_moder)rrrrrrootstackr pushnamesnamefullnamermodes rfindallzManifest.findall;s  3222222222#%% yi| #355DJt$$E # #7<<d33wx((|74==#OOHX$6$67777WT]]#774==#DNNN # # # # #rc||js%tj|j|}|jtj|dS)zz Add a file to the manifest. :param item: The pathname to add. This can be relative to the base. N) startswithrr r r#rraddr)ritems rr/z Manifest.addVs[ t{++ 17<< 400D rw''--.....rc:|D]}||dS)z Add a list of files to the manifest. :param items: The pathnames to add. These can be relative to the base. N)r/)ritemsr0s radd_manyzManifest.add_many`s.   D HHTNNNN  rFcfdtj}|rAt}|D]+}|tj|,||z}dt d|DDS)z8 Return sorted files in directory order c||td||jkr6tj|\}}|dvsJ||dSdS)Nzadd_dir added %s)/)r/loggerdebugrr r split)dirsdparent_add_dirrs rr?z Manifest.sorted..add_dirnsy HHQKKK LL+Q / / /DI~~GMM!,, Y....f%%%%%~rc4g|]}tjj|S)r r r#).0 path_tuples r z#Manifest.sorted..|s3@@@j j)@@@rc3TK|]#}tj|V$dSN)r r r:)rBr s r z"Manifest.sorted..}s0>>trw}}T**>>>>>>r)rrr r dirnamesorted)rwantdirsresultr;fr?s` @rrIzManifest.sortedis  & & & & & &TZ  55D 2 2bgooa001111 dNF@@>>v>>>>>@@@ @rc:t|_g|_dS)zClear all collected files.N)rrr)rs rclearzManifest.clearsUU  rc||\}}}}|dkr9|D]4}||dstd|5dS|dkr|D]}||ddS|dkr9|D]4}||dstd|5dS|d kr|D]}||ddS|d kr:|D]5}||| std ||6dS|d kr|D]}||| dS|dkr6|d| std|dSdS|dkr6|d| std|dSdSt d|z)av Process a directive which either adds some files from ``allfiles`` to ``files``, or removes some files from ``files``. :param directive: The directive to process. This should be in a format compatible with distutils ``MANIFEST.in`` files: http://docs.python.org/distutils/sourcedist.html#commands includeT)anchorzno files found matching %rexcludeglobal-includeFz3no files found matching %r anywhere in distributionglobal-excluderecursive-include)rz-no files found matching %r under directory %rrecursive-excludegraftNz no directories found matching %rprunez4no previously-included directories found matching %rzinvalid action %r)_parse_directive_include_patternr8warning_exclude_patternr)r directiveactionpatternsthedir dirpatternpatterns rprocess_directivezManifest.process_directives04/D/DY/O/O,&* Y  # J J,,WT,BBJNN#?III J Jy # < <%%gd%;;;; < <' ' '# H H,,WU,CCHNN$>?FHHH H H ' ' '# = =%%ge%<<<< = =* * *# J J,,WV,DDJNN$89@&JJJ J J * * *# > >%%gf%==== > >w  ((j(AA +A)+++++ + +w  ((j(AA : -.8::::: : : ##f,.. .rc||}t|dkr |ddvr|dd|d}dx}x}}|dvr:t|dkrtd|zd |ddD}n|d vrOt|d krtd |zt |d}d |ddD}nQ|dvr;t|dkrtd|zt |d}ntd|z||||fS)z Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns rr)rPrRrSrTrUrVrWrXrPN)rPrRrSrTr z$%r expects ...c,g|]}t|SrArrBwords rrDz-Manifest._parse_directive.. AAAt T**AAAr)rUrVz*%r expects ...c,g|]}t|SrArrfs rrDz-Manifest._parse_directive..rhr)rWrXz!%r expects a single zunknown action %r)r:leninsertrr)rr]wordsr^r_r` dir_patterns rrYzManifest._parse_directives !! u::??uQx0B B B LLI & & &q*...6K : : :5zzA~~&:VCEEEBAuQRRyAAAHH A A A5zzA~~&@6IKKK"%(++FAAuQRRyAAAHH ) ) )5zzQ&7&@BBB'uQx00KK##6#?@@ @x44rTcd}|||||}|j||jD]3}||r|j|d}4|S)aSelect strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform-dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found. FNT)_translate_patternrr,searchrr/)rrbrQris_regexfound pattern_rer)s rrZzManifest._include_patterns8,,WffhOO  = LLNNNM  D  &&  t$$$ rcd}|||||}t|jD]3}||r|j|d}4|S)atRemove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found. This API is public to allow e.g. exclusion of SCM subdirs, e.g. when packaging source distributions FT)rplistrrqremove)rrbrQrrrrsrtrLs rr\zManifest._exclude_pattern sr,,WffhOO dj!!  A  ##  !!!$$$ rc |r+t|trtj|S|Stdkr,|dd\}}}|rM||}tdkr,||r||sJnd}tj tj |j d} |OtdkrA|d} ||dt|  } nu||} | |r| |sJ| t|t| t|z } tj} tjdkrd} tdkr!d| z| | d|zfz}nw|t|t|t|z }|| | | d||}n3|r1tdkr d| z|z}n|| |t|d}tj|S) aTranslate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). )rir r>r6N\z\\^z.*) isinstancestrrecompile_PYTHON_VERSION _glob_to_re partitionr.endswithescaper r r#rrkr) rrbrQrrrstartr>endrtr empty_pattern prefix_rers rrpzManifest._translate_pattern4s  '3'' z'*** V # # ,,S11;;C@@ME1c  ))'22J''!,,U33P 8K8KC8P8PPPPJydi4455  &(( $ 0 0 4 4  ,,V445Is=7I7I6I5IJ  ,,V44  ++E22Ny7I7I#7N7NNNN%c%jj#i..3s882K&KL &Cv~~&(( 4Z#((I48:4E4G+H+HH (E C OOc#hh4N(NO 27%yy###2<*ccC  T"f,,!$tj!8JJ.3eTT:c%jjkk;R;R!SJz*%%%rctj|}tj}tjdkrd}d|z}t jd||}|S)zTranslate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). ryz\\\\z\1[^%s]z((?>Cs"V17JGG rrF)F)TNF)__name__ __module__ __qualname____doc__rr,r/r3rIrNrcrYrZr\rprrArrrr&s    ###6///@@@@, >.>.>.H-5-5-5^=A"'''''R=A"'(?C$)5&5&5&5&nr)rrloggingr r}sysr6rcompatrutilr__all__ getLoggerrr8r~M_COLLAPSE_PATTERNS_COMMENTED_LINE version_inforobjectrrArrrs    ,  8 $ $BJz2400"*124"$;??"2A2&ZZZZZvZZZZZr