grthtrhthjhtyjytjytkergtrhtrjytjerhrfh3 \]/ã@s”dZddlZddlZddlZddlZddlZddlmZdddgZ ddd „Z dd d„Z dd d„Z ddd„Z dd„Zedkr�eeƒ ƒZejeƒ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ƒrtj|ƒ}|s0tdj|ƒƒytj|ƒ}Wn.tk rl|dkrdtdj|ƒƒg}YnX|jƒx¤|D]œ}|dkrŠq|tj j ||ƒ}|dk r°tj j ||ƒ}nd}tj j |ƒsÈ|Vq||dkr||tj kr||tj kr|tj j |ƒr|tj j|ƒ r|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"ú"/usr/lib64/python3.6/compileall.pyrs0    rFr c Csðd} |dk rP|dkrtdƒ‚n2|dkrPyddlm} Wntk rNd}YnXt||||d�} d} |dk rÆ|dkrÆ| dk rÆ|p‚d}| |d��0} | jtt||||||d �| ƒ} t| dd �} WdQRXn&x$| D]}t|||||||ƒsÌd } qÌW| S) a¹Byte-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 Nrz%workers must be greater or equal to 0r )ÚProcessPoolExecutor)r r r T)Z max_workers)r ÚforceÚrxr ÚlegacyÚoptimize)ÚdefaultF) Ú ValueErrorZconcurrent.futuresr$Ú ImportErrorrÚmaprrÚmin)rr r r%r&r r'r(Úworkersr$ÚfilesÚsuccessZexecutorZresultsÚfiler"r"r#r2s6     cCsŠd}|dkr"t|tjƒr"tj|ƒ}tjj|ƒ}|dk rFtjj||ƒ} nd} |dk rd|j|ƒ} | rd|Stjj|ƒ�r†|r€|d} nB|dkrª|dkr”|nd} t j j || d�} n t j j |ƒ} tjj | ƒ} |dd…|dd…}}|d k�r†|�sXyTt tj|ƒjƒ}tjd t j j|ƒ}t| d ƒ�}|jd ƒ}WdQRX||k�r>|SWntk �rVYnX|�sltdj|ƒƒytj|| | d|d�}Wnòtjk �r}zdd}|dk�r¬|S|�rÂtdj|ƒƒn tddd�|jjtjjdd�}|j tjjƒ}t|ƒWYdd}~Xn~t!t"tfk �rv}zLd}|dk�r2|S|�rHtdj|ƒƒn tddd�t|j#j$d|ƒWYdd}~XnX|dk�r†d}|S)a Byte-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 TrNÚcrr Ú)Ú optimizationéz.pyz<4slÚrbézCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )ÚendÚbackslashreplace)Úerrorsú:éýÿÿÿr<)%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(r0rr!ZmoÚcfileÚoptZ cache_dirÚheadÚtailÚmtimeZexpectZchandleZactualÚokÚerrrNÚer"r"r#rbsx                  $ c CsXd}xNtjD]D}| s |tjkr6|r6|dkrPtdƒq |oNt||d||||d�}q W|S)awByte-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) TrzSkipping current directoryN)r r'r()rPrrrrr)Z skip_curdirr r%r r'r(r0rr"r"r#rµs    c Cszddl}|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�|jƒ}|j}|jrþddl}|j|jƒ|_|j dk �r|j }n|j }|j �ržyJ|j d4k�r4t j nt|j ƒ�$}x|D]}|j|jƒƒ�qFWWdQRXWn2tk �rœ|jd5k�r˜td6j|j ƒƒd7SX|jdk �r¸|j�p´d|_d8}yŽ|�r4xj|D]b} tjj| ƒ�rt| |j|j|j|j|jƒ�s*d7}n*t| ||j|j|j|j|j|jd9��sÊd7}�qÊW|St|j|j|jd:�SWn*tk �rt|jd5k�rptd;ƒd7SXd8S) s$    / R [