o ?OgO@s ddlZddlZddlZddlZddlZddlZddlmZddl m Z gdZ dddZ  dddddd d d Z  dddddd d dZ  dddZddZedkrgee ZeedSdS)N)partial)Path) compile_dir compile_file compile_pathccs|dkrt|tjrt|}|std|zt|}Wnty6|dkr2td|g}Ynw||D]>}|dkrDq=tj ||}tj |sU|Vq=|dkr{|tj kr{|tj kr{tj |r{tj |s{t||d|dEdHq=dS)NzListing {!r}...zCan't list {!r} __pycache__r) maxlevelsquiet) isinstanceosPathLikefspathprintformatlistdirOSErrorsortpathjoinisdircurdirpardirislink _walk_dir)dirr r namesnamefullnamer 1/opt/alt/python310/lib64/python3.10/compileall.pyrs:       rFr stripdir prependdir limit_sl_desthardlink_dupesc Cs\ d}|dur| dus| durtd|dur|} |} d}|dkr%td|dkrFddlm}z|Wn ty?d}Ynwddlm}|durNt}t|||d}d}|dkr|dur|pbd}||d #}| t t ||||||| | | | | d |}t |dd }Wd|S1swY|S|D]}t |||||||| | | | | d sd }q|S)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 T)Z max_workers) ddirforcerxr legacyoptimizeinvalidation_moder$r%r&r')defaultr#F) ValueErrorZconcurrent.futures.processr)NotImplementedErrorZconcurrent.futuresr*sysgetrecursionlimitrmaprrmin)rr r+r,r-r r.r/workersr0r$r%r&r'r*r)filessuccessZexecutorZresultsfiler r r!r0sj        rc& Csp |dur|dus | durtdd} t|}|dur!t|nd}tj|} d}|dur6tj|| }|dure|tjj}|tjj}t|}t ||D] \}}||kr^| |qQtjj|}| dur||durutj| |}ntj| |}t |t r|g}t t|}| rt|dkrtd|dur||}|r| S| durtj|rt| t|jvr| Si}tj|r6|D].}|r|d||<q|dkr|dkr|nd}tjj||d }|||<qtj|}|||<q| dd | d d}}|d kr6|sYzCt t|j}td tjjd|d @}|D]%}t|d }| d}Wdn 1s|jd?d@tdAdBdC|jdDdEdFdGd/|jdHddIdJd|}|j}|j rddl }| |j |_ |j dKkrd|_ |j dur|j }n|j}|jdurdLg|_t|jd7kr|jr|dM|jdur|jdus|jdur|dN|jrRz0|jdOkrtjnt|jdPdQ}|D] }||qWdn 1s2wYWntyQ|jdRkrNtdS|jYdTSw|j re|j !dOdU"} tj| } nd} dV} z^|r|D]I} t#j$%| rt&| |j|j'|j |j|j(| |j|j|j|j |jdW sdT} qot)| ||j|j'|j |j|j(|j*| |j|j|j|j |jdXsdT} qo| WSt+|j(|j'|j| dYWSt,y|jdRkrtdZYdTSw)[Nrz1Utilities to support installing Python libraries.) descriptionz-lZ store_constr z!don't recurse into subdirectories)actionZconstr1desthelpz-r recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)typer{r|z-f store_truer,z/force rebuild even if timestamps are up to date)rzr{r|z-qcountr zIoutput only error messages; -qq will suppress the error messages as well.)rzr{r1r|z-br.z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr+zdirectory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)metavarr{r1r|z-sZSTRIPDIRr$zpart of path to left-strip from path to source file - for example buildroot. `-d` and `-s` options cannot be specified together.z-pZ 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-xZREGEXPr-zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILEflistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rr{r| compile_destzFILE|DIR*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rnargsr|z-jz --workersr zRun compileall concurrently)r1r~r|cSsg|] }|jddqS)_-)rlowerreplace).0moder r r! iszmain..z--invalidation-modezset .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)choicesr|z-oappend opt_levelszOptimization levels to run compilation with. Default is -1 which uses the optimization level of the Python interpreter itself (see -O).)rzr~r{r|z-eZDIRr&z+Ignore symlinks pointing outsite of the DIRz--hardlink-dupesr'zHardlink duplicated pyc filesr=r"zYHardlinking of duplicated bytecode makes sense only for more than one optimization level.z.-d cannot be used in combination with -s or -przutf-8)rerzError reading file list {}FrT)r0r$r%r/r&r')r8r0r$r%r/r&r')r.r,r r0z [interrupted])-argparseArgumentParser add_argumentrLr^PycInvalidationModerM parse_argsrr-rer_r&r}r rrOr'errorr+r$r%rr4stdinr[rstriprr rrr0rupperr rrRrr,r.rr8rKeyboardInterrupt) rparserZinvalidation_modesargsZ compile_destsrr flineZivl_moder0r:r{r r r!main4s                            r__main__)r) NNFNrFr"r N)NFNrFr"N)r rFrFr"N)r r4importlib.utilrSr^rXr` functoolsrZpathlibr__all__rrrrrrmrLZ exit_statusexitr r r r!sH     M  "