U e5dn5ã @s˜ddlZddlZddlZddlZddlZddlmZdddgZddd„Z dd d„Z d d„Z ddd„Z ddd„Z dd„Zedkr”eeƒ ƒZe e¡dS)éN)ÚpartialÚ compile_dirÚ compile_fileÚ compile_pathé ccs|dkrt|tjƒrt |¡}|s0td |¡ƒzt |¡}Wn.tk rl|dkrdtd |¡ƒg}YnX| ¡|D]ž}|dkrˆqztj   ||¡}|dk r®tj   ||¡}nd}tj   |¡sÊ||fVqz|dkrz|tj krz|tj krztj   |¡rztj  |¡szt|||d|d�EdHqzdS)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"ú"/usr/lib64/python3.8/compileall.pyrs:     ÿ ÿÿrFéÿÿÿÿr c  Csàd} |dkrtdƒ‚|dkrFzddlm} Wntk rDd}YnXt||||d�} d} |dkr´| dk r´|ppd}| |d��0} |  tt|||||| d�| ¡}t|dd �} W5QRXn(| D]"\}}t |||||||| ƒs¸d } q¸| S) 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#r2sF ÿ ýú  ÿcKs|\}}t||f|ŽS)N)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…| dd…}}|d k�rž|�s\zXt t |¡jƒ}t d t j jd|¡}t| d ƒ�}| d ¡}W5QRX||k�rB|WSWntk �rZYnX|�sptd  |¡ƒztj|| | d||d�}W�ntjk �r}zjd}|dk�r¼|WY¢RS|�rÒtd |¡ƒn tddd�|jjtjjdd�}|  tjj¡}t|ƒW5d}~XYn†t!t"tfk �rŽ}zRd}|dk�rJ|WY¢:S|�r`td |¡ƒn tddd�t|j#j$d|ƒW5d}~XYnX|dk�ržd}|S)NTrÚ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ÚcfileÚoptZ cache_dirÚheadÚtailÚmtimeZexpectZchandleZactualÚokÚerrrPÚer"r"r#rjs†    ÿ    ÿ    þ     ÿ   $ c CsTd}tjD]D}|r|tjkr2|r2|dkrNtdƒq |oLt||d|||||d�}q |S)NTrzSkipping current directory)r r(r)r*)rRrrrrr) Z skip_curdirr r&r r(r)r*r2rr"r"r#rÀs   ø c Cs¸ddl}|jdd�}|jddddddd �|jd td d d �|jddddd�|jdddddd�|jddddd�|jdddddd�|jd d!d"dd#d�|jd$d%d&d'd(�|jd)d*d+d,d-�|jd.d/d0td1d2�d3d4„tjDƒ}|jd5t|ƒd6d7�| ¡}|j}|j �r$ddl }|  |j ¡|_ |j dk �r8|j }n|j }|j�rÂzF|jd8k�rZtjnt|jƒ� }|D]}| | ¡¡�qjW5QRXWn4tk �rÀ|jd9k�rºtd: |j¡ƒYd;SX|j�rè|j d8d<¡ ¡} tj| } nd} d=} z–|�rl|D]h} tj | ¡�r6t| |j|j |j |j|j!| d>��sbd;} n,t"| ||j|j |j |j|j!|j#| d?� �süd;} �qü| WSt$|j!|j |j| d@�WSWn,t%k �r²|jd9k�r¬tdAƒYd;SXd=S)BNrz1Utilities 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.)Útypercrdz-fÚ store_truer&z/force rebuild even if timestamps are up to date)rbrcrdz-qÚcountr zIoutput only error messages; -qq will suppress the error messages as well.)rbrcr+rdz-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)Úmetavarrcr+rdz-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)rircrdÚ compile_destzFILE|DIRÚ*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)riÚnargsrdz-jz --workersr zRun compileall concurrently)r+rfrdcSsg|]}|j ¡ dd¡‘qS)Ú_ú-)rÚlowerÚreplace)Ú.0Úmoder"r"r#Ú sÿzmain..z--invalidation-modez‡set .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)ÚchoicesrdrorzError reading file list {}FrnT)r*)r1r*)r(r&r r*z [interrupted])&ÚargparseÚArgumentParserÚ add_argumentrFrMÚPycInvalidationModeÚsortedÚ parse_argsrkr'ÚrerNrer rjrRÚstdinrKÚappendÚstriprr rrr*rqÚupperrrrArr r&r(rr1rÚKeyboardInterrupt) rvÚparserZinvalidation_modesÚargsZ compile_destsr|r ÚfÚlineZivl_moder*r2rcr"r"r#Úmainâs¾ÿ þ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿÿþ    þ ý þ  r†Ú__main__)Nrr) rNFNrFr$r N)NFNrFr$N)r rFrFr$N)rrRÚimportlib.utilrBrMrIÚ functoolsrÚ__all__rrr/rrr†rYrFZ exit_statusÚexitr"r"r"r#Ú s:   þ 3þ Vþ "i