U e5dn5 ã @ sœ d Z ddlZddlZddlZddlZddlZddlmZ dddgZ ddd „Z dd d„Zdd„ Zddd„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é c c s |dk rt | tjƒrt | ¡} |s0td | ¡ƒ zt | ¡}W n. tk rl |dk rdtd | ¡ƒ g }Y nX | ¡ |D ]ž}|dkrˆqztj | |¡}|d k r®tj ||¡}nd }tj |¡sÊ||fV qz|dkrz|tjkrz|tj krztj |¡rztj |¡szt|||d |d�E d H qzd S )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.pyr s: ÿ ÿ ÿr Féÿÿÿÿr c C sà d} |dk rt dƒ‚|dkrFzddlm} W n tk rD d}Y nX t| |||d�}d}|dkr´| dk r´|ppd}| |d��0} | tt|||||| d �|¡}t|dd �}W 5 Q R X n(|D ]"\}}t |||||||| ƒs¸d}q¸|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 invalidation_mode: how the up-to-dateness of the pyc will be checked Nr z%workers must be greater or equal to 0r )ÚProcessPoolExecutor)r r r T)Zmax_workers)ÚforceÚrxr ÚlegacyÚoptimizeÚinvalidation_mode)ÚdefaultF) Ú ValueErrorZconcurrent.futuresr% ÚImportErrorr Úmapr Ú_compile_file_tupleÚminr )r r r r&