grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026B ¬5 $Dàõã @sœdZddlZddlZddlZddlZddlZddlmZdddgZ ddd „Z dd d„Z dd„Z ddd„Z ddd„Zdd„Zedkr˜eeƒ ƒZe e¡dS)aæModule/script to byte-compile all .py files to .pyc files. When called as a script with arguments, this compiles the directories given as arguments recursively; the -l option prevents it from recursing into directories. Without arguments, if compiles all modules on sys.path, without recursing into subdirectories. (Even though it should do so for packages -- for now, you'll have to deal with packages separately.) See module py_compile for details of the actual byte-compilation. éN)ÚpartialÚ compile_dirÚ compile_fileÚ compile_pathé ccs"|dkrt|tjƒrt |¡}|s0td |¡ƒyt |¡}Wn.tk rl|dkrdtd |¡ƒg}YnX| ¡x¦|D]ž}|dkrŠq|tj   ||¡}|dk r°tj   ||¡}nd}tj   |¡sÌ||fVq||dkr||tj kr||tj kr|tj   |¡r|tj  |¡s|t|||d|d�EdHq|WdS)NézListing {!r}...zCan't list {!r}Ú __pycache__ré)ÚddirÚ maxlevelsÚquiet)Ú isinstanceÚosÚPathLikeÚfspathÚprintÚformatÚlistdirÚOSErrorÚsortÚpathÚjoinÚisdirÚcurdirÚpardirÚislinkÚ _walk_dir)Údirr r r ÚnamesÚnameÚfullnameÚdfile©r"ú//opt/alt/python37/lib64/python3.7/compileall.pyrs0     rFéÿÿÿÿr c  Csöd} |dk rP|dkrtdƒ‚n2|dkrPyddlm} Wntk rNd}YnXt||||d�} d} |dk rÆ|dkrÆ| dk rÆ|p‚d}| |d��0} |  tt|||||| d �| ¡}t|dd �} WdQRXn,x*| D]"\}}t |||||||| ƒsÌd } qÌW| S) aByte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: the directory that will be prepended to the path to the file as it is compiled into each byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: optimization level or -1 for level of the interpreter workers: maximum number of parallel workers invalidation_mode: how the up-to-dateness of the pyc will be checked Nrz%workers must be greater or equal to 0r )ÚProcessPoolExecutor)r r r T)Z max_workers)ÚforceÚrxr ÚlegacyÚoptimizeÚinvalidation_mode)ÚdefaultF) Ú ValueErrorZconcurrent.futuresr%Ú ImportErrorrÚmaprÚ_compile_file_tupleÚminr)rr r r&r'r r(r)Úworkersr*r%Zfiles_and_ddirsÚsuccessZexecutorZresultsÚfiler!r"r"r#r2s6     cKs|\}}t||f|ŽS)z-Needs to be toplevel for ProcessPoolExecutor.)r)Zfile_and_dfileÚkwargsr3r!r"r"r#r/esr/c CsŽd}|dkr"t|tjƒr"t |¡}tj |¡} |dk rFtj || ¡} nd} |dk rd| |¡} | rd|Stj |¡�rŠ|r€|d} nB|dkrª|dkr”|nd} t j j || d�} n t j   |¡} tj  | ¡}| dd …| d d…}}|d k�rŠ|�sZyVt t |¡jƒ}t d t j jd|¡}t| d ƒ�}| d ¡}WdQRX||k�r@|SWntk �rXYnX|�sntd |¡ƒytj|| | d||d�}Wnòtjk �r }zbd}|dk�r°|S|�rÆtd |¡ƒn tddd�|jjtjjdd�}|  tjj¡}t|ƒWdd}~XYn~t!t"tfk �rz}zJd}|dk�r6|S|�rLtd |¡ƒn tddd�t|j#j$d|ƒWdd}~XYnX|dk�rŠd}|S)aTByte-compile one file. Arguments (only fullname is required): fullname: the file to byte-compile ddir: if given, the directory name compiled in to the byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: optimization level or -1 for level of the interpreter invalidation_mode: how the up-to-dateness of the pyc will be checked TrNÚcrr Ú)Ú optimizationéýÿÿÿz.pyz<4sllÚrbé zCompiling {!r}...)r)r*Fz*** Error compiling {!r}...z*** )ÚendÚbackslashreplace)Úerrorsú:)%r rrrrÚbasenamerÚsearchÚisfileÚ importlibÚutilÚcache_from_sourceÚdirnameÚintÚstatÚst_mtimeÚstructZpackÚ MAGIC_NUMBERÚopenÚreadrrrÚ py_compileÚcompileÚPyCompileErrorÚmsgÚencodeÚsysÚstdoutÚencodingÚdecodeÚ SyntaxErrorÚ UnicodeErrorÚ __class__Ú__name__)r r r&r'r r(r)r*r2rr!ZmoÚcfileZoptZ cache_dirÚheadÚtailÚmtimeZexpectZchandleZactualÚokÚerrrPÚer"r"r#rjsz                  $ c CsXd}xNtjD]D}|r|tjkr4|r4|dkrPtdƒq |oNt||d|||||d�}q W|S)a¤Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default True) maxlevels: max recursion level (default 0) force: as for compile_dir() (default False) quiet: as for compile_dir() (default 0) legacy: as for compile_dir() (default False) optimize: as for compile_dir() (default -1) invalidation_mode: as for compiler_dir() TrzSkipping current directoryN)r r(r)r*)rRrrrrr) Z skip_curdirr r&r r(r)r*r2rr"r"r#rÀs   c CsÒddl}|jdd�}|jdddddd d �|jd td d d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�d4d5„tjDƒ}|jd6t|ƒd7d8�| ¡}|j}|j �r$ddl }|  |j ¡|_ |j dk �r8|j }n|j }|j�rÄyJ|jd9k�rZtjnt|jƒ�$}x|D]}| | ¡¡�qlWWdQRXWn2tk �rÂ|jd:k�r¾td; |j¡ƒd} y–|�rŠxp|D]h} tj | ¡�rTt| |j |j!|j |j|j"| d?��s€d<} n,t#| ||j |j!|j |j|j"|j| d@� �sd<} �qW| St$|j"|j!|j| dA�SWn*t%k �rÌ|jd:k�rÈtdBƒdS)CzScript main program.rNz1Utilities to support installing Python libraries.)Z descriptionz-lZ store_constrr z!don't recurse into subdirectories)ÚactionZconstr+ÚdestÚhelpz-rÚ recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)Útyperbrcz-fÚ store_truer&z/force rebuild even if timestamps are up to date)rarbrcz-qÚcountr zIoutput only error messages; -qq will suppress the error messages as well.)rarbr+rcz-br(z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)Úmetavarrbr+rcz-xZREGEXPr'zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILEÚflistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rhrbrcÚ compile_destzFILE|DIRÚ*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rhÚnargsrcz-jz --workersr zRun compileall concurrently)r+rerccSsg|]}|j ¡ dd¡‘qS)Ú_ú-)rÚlowerÚreplace)Ú.0Úmoder"r"r#ú szmain..z--invalidation-modez‡set .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)ÚchoicesrcrnrzError reading file list {}FrmT)r*)r1r*)r(r&r r*z [interrupted])&ÚargparseÚArgumentParserÚ add_argumentrFrMÚPycInvalidationModeÚsortedÚ parse_argsrjr'ÚrerNrdr rirRÚstdinrKÚappendÚstriprr rrr1r*rpÚupperrrrArr r&r(rrÚKeyboardInterrupt) ruÚparserZinvalidation_modesÚargsZ compile_destsr{r ÚfÚlineZivl_moder*r2rbr"r"r#Úmainâs–              "            r…Ú__main__)Nrr) rNFNrFr$r N)NFNrFr$N)r rFrFr$N)Ú__doc__rrRÚimportlib.utilrBrMrIÚ functoolsrÚ__all__rrr/rrr…rYrFZ exit_statusÚexitr"r"r"r#Ú s,    1 T l