QfP ddlZddlZddlZddlZddlZddlZddlmZddl m Z gdZ d dZ dddddddZ ddddddd Z dd Zd Zed k(r!ee Zej(eyy)N)partial)Path) compile_dir compile_file compile_pathc#K|dkr/t|tjrtj|}|st dj | tj |}|j|D]}|dk(r tjj||}tjj|s|M|dkDsS|tjk7sg|tjk7s{tjj|stjj|rt||dz |Ed{y#t$r%|dkrt dj |g}YwxYw78w)NzListing {!r}...zCan't list {!r} __pycache__r) maxlevelsquiet) isinstanceosPathLikefspathprintformatlistdirOSErrorsortpathjoinisdircurdirpardirislink _walk_dir)dirr r namesnamefullnames 1/opt/alt/python312/lib64/python3.12/compileall.pyrrs( qyZR[[1iin  &&s+, 3  JJL = 77<<T*ww}}X&N!m 1dbii6GggmmH%bggnnX.F Y]',. . .  19 #**3/ 0 .sUAFE)A$FF"F6FF6F F F*F<F?FFFstripdir prependdir limit_sl_desthardlink_dupesc d d}|| | td||} |} d}|dkr td|dk7rddlm} |ddlm}|t j}t|||}d}|dk7r|~ddl }|jd k(r|jd }nd}|xsd}||| 5}|jtt||||||| | | | | |}t|d }ddd|S|D]}t|||||||| | | | |  rd}|S#t $rd}YwxYw#1swY|SxYw)NPDestination dir (ddir) cannot be used in combination with stripdir or prependdirrz%workers must be greater or equal to 0r )_check_system_limits)ProcessPoolExecutor)r r Tfork forkserver) max_workers mp_context) ddirforcerxr legacyoptimizeinvalidation_moder$r%r&r')defaultr#F) ValueErrorconcurrent.futures.processr*concurrent.futuresr+NotImplementedErrorsysgetrecursionlimitrmultiprocessingget_start_method get_contextmaprrmin)rr r0r1r2r r3r4workersr5r$r%r&r'r+r*filessuccessr=r/executorresultsfiles r"rr0s0 X1Z5KGI I  {@AA!|C ? " ?))+ c) t%| j't%|j'j(vr| Si}tjj+|r|D]f}|r |dz||<|dk\r0|dk\r|nd}t,j.j1|| }|||<Ct,j.j1|}|||<h| dd | d d}}|d k(rU|s ttj2|j4}t7j8d t,j.j:d|d z}|j=D]/}t?|d5}|jAd}ddd|k7s/n| S |stEdjG| tI|D]}\}}||}tKjL|||d||} |dkDs,| s/|||dz }!tOjP||!dsStjR|tjT|!|  dk(rd} | S| S#1swYxYw#tB$rYwxYw#tJjV$r}"d} |dk\r| cYd}"~"S|rtEdjG|n tEddtXjZj\xstYj^}#|"j`jc|#dje|#}$tE|$Yd}"~"| Sd}"~"wtfthtBf$rf}%d} |dk\r| cYd}%~%S|rtEdjG|n tEddtE|%jjjldz|%Yd}%~%| Sd}%~%wwxYw)Nr)Tr zXHardlinking of duplicated bytecode makes sense only for more than one optimization levelcrr ) optimizationz.pyz<4sLLlrb zCompiling {!r}...)r4r5F)shallowz*** Error compiling {!r}...z*** )endbackslashreplace)errors:)7r7rrrbasenamersplitseplistzipremoverintsortedsetlensearchrrresolveparentsisfile importlibutilcache_from_sourcestatst_mtimestructpack MAGIC_NUMBERvaluesopenreadrrr enumerate py_compilecompilefilecmpcmpunlinklinkPyCompileErrorr;stdoutencodinggetdefaultencodingmsgencodedecode SyntaxError UnicodeError __class____name__)&r!r0r1r2r r3r4r5r$r%r&r'rDr dfilefullname_partsstripdir_parts ddir_partsspartopartmo opt_cfiles opt_leveloptcfileheadtailmtimeexpectchandleactualindexokprevious_cfileerrrvrxes& r"rrs. X1Z5KGI IGyy"H&.&:ryy"H 77  H %D E  T4(! 4! 4.) ?LE5~!!%(@ j) =GGLLX6EGGLLU3E(C :c(m$H#h-!+FG G ~ YYx  N RWW^^H%=   & & (X0F0F0H0P0P PNJ ww~~h!I(03 9%>'0A~)2C&^^==%C>9E,1Jy)%NN<>OQBqy^)3HUQY4G)H";;uneLIIe,GGNE:)<@7#G N7N[/. ,, A:"N7>>xHI&b)::..J#2H2H2JggnnX6HnIPPQYZc  N w7 5A:"N7>>xHI&b)akk**S0!44 N 5s A:P)P P)#P)6P8=P8#P8$-P8P& "P)) P54P58U- S0U-BS00U-U(U-A U((U-c  d}tjD]B}|r|tjk(r|r|dks t d,|xrt ||d|||||}D|S)NTr zSkipping current directory)r r3r4r5)r;rrrrr) skip_curdirr r1r r3r4r5rDrs r"rrsl Gxxsbii'[qy23 +!"3 #G  Nc ddl}|jd}|jdddddd|jd td d |jd ddd|jddddd|jdddd|jddddd|jdd d!dd"|jd#d$d%dd&|jd'd(d)dd*|jd+d,d-d./|jd0d1d2d34|jd5d6d7td89tj Dcgc],}|j jjd:d;.}}|jd|jd?d@tdAdBC|jdDdEdFdG/|jdHddIdJ|j}|j}|jr$ddl }|j|j|_ |jdKk(rd|_|j |j }n |j"}|j$dLg|_t'|j$d7k(r|j(r|j+dM|j,)|j. |j0|j+dN|j2rg |j2d;k(rt4j6nt9|j2dOP5}|D]!} |j;| j=# ddd|jFr>|jFjd;d:jI} tj | } nd} dT} |r4|D],} tJjLjO| rtQ| |j,|jR|j|j@|jT| |j.|j0|j$|j|j(U rdS} tW| ||j,|jR|j|j@|jT|jX| |j.|j0|j$|j|j(Vr+dS} /| St[|jT|jR|j@| WScc}w#1swYxYw#t>$r6|j@dQkr$tCdRjE|j2YySwxYw#t\$r|j@dQkr tCdXYySwxYw)YNrz1Utilities to support installing Python libraries.) descriptionz-l store_constr z!don't recurse into subdirectories)actionconstr6desthelpz-r recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)typerrz-f store_truer1z/force rebuild even if timestamps are up to date)rrrz-qcountr zIoutput only error messages; -qq will suppress the error messages as well.)rrr6rz-br3z0use legacy (pre-PEP3147) compiled file locationsz-dDESTDIRr0zdirectory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)metavarrr6rz-sSTRIPDIRr$zpart of path to left-strip from path to source file - for example buildroot. `-d` and `-s` options cannot be specified together.z-p PREPENDDIRr%zpath to add as prefix to path to source file - for example / to make it absolute when some part is removed by `-s` option. `-d` and `-p` options cannot be specified together.z-xREGEXPr2zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iFILEflistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rrr compile_destzFILE|DIR*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rnargsrz-jz --workersr zRun compileall concurrently)r6rr_-z--invalidation-modezset .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)choicesrz-oappend opt_levelszOptimization levels to run compilation with. Default is -1 which uses the optimization level of the Python interpreter itself (see -O).)rrrrz-eDIRr&z+Ignore symlinks pointing outsite of the DIRz--hardlink-dupesr'zHardlink duplicated pyc filesrJzYHardlinking of duplicated bytecode makes sense only for more than one optimization level.z.-d cannot be used in combination with -s or -pzutf-8)rvr zError reading file list {}FT)r5r$r%r4r&r')rBr5r$r%r4r&r')r3r1r r5z [interrupted])/argparseArgumentParser add_argumentrZrnPycInvalidationModer lowerreplacer[ parse_argsrr2reror&rr rr]r'errorr0r$r%rr;stdinrkrstriprr rrr5upperrrrarr1r3rrBrKeyboardInterrupt)rparsermodeinvalidation_modesargs compile_destsrr flineivl_moder5rDrs r"mainr:sl  $ $G%IF ]! $;@B 3[<> \NP W7A;< \OQ ivt,.  j $46  l, $46 hT4HJ f7BD  #AC k1 'DF'1&D&DF&Dd))//+33C=&DF - &'9 :79  XClKM e/JL *<-<>    D%%M ww**TWW% R! ~~!NN NN  $ 4??q T%8%8 C E yy !T__%@ EF zz #zz3#))g67;<D!((67 ))11#s;AAC&::8D G  %77>>$''diiTWW(, DKK:K1537??156:6H6H7;7J7JL#(&tY '+zz477DJJ'+{{DLL9J04 26//04595G5G6:6I6IK#(+&,Nt{{$**&*jj2CE EuF`77 zzA~299$**EF R  ::> # $sV61S56T'S::TB#U 5B U U ,U :T?Trs    7..7