
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,an5  ã                	   @   sœ   d Z ddlZddlZddlZddlZddlZddlmZ dddgZ	ddd	„Z
ddd„Zdd„ Zddd„Zddd„Zdd„ Zedkr˜eeƒ  ƒZe e¡ dS )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  |dk rt | tjƒrt | ¡} |s0td | ¡ƒ zt | ¡}W n. tk
rl   |dk rdtd | ¡ƒ g }Y nX | ¡  |D ]ž}|dkrˆqztj	 
| |¡}|d k	r®tj	 
||¡}nd }tj	 |¡sÊ||fV  qz|dkrz|tjkrz|tjkrztj	 |¡rztj	 |¡szt|||d |d�E d H  qzd S )Né   zListing {!r}...zCan'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/python38/lib64/python3.8/compileall.pyr      s:    


ÿ
ÿ ÿr   Féÿÿÿÿr	   c
                 C   sà   d}
|dk rt dƒ‚|dkrFzddlm}
 W n tk
rD   d}Y nX t| |||d�}d}|dkr´|
dk	r´|ppd}|
|d��0}| tt||||||	d	�|¡}t|dd
�}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)Zmax_workers)ÚforceÚrxr   ÚlegacyÚoptimizeÚinvalidation_mode)ÚdefaultF)
Ú
ValueErrorZconcurrent.futuresr%   ÚImportErrorr   Úmapr   Ú_compile_file_tupleÚminr   )r   r   r
   r&   r'   r   r(   r)   Úworkersr*   r%   Zfiles_and_ddirsÚsuccessZexecutorZresultsÚfiler!   r"   r"   r#   r   2   sF    
ÿ   ýú  ÿc                 K   s   | \}}t ||f|ŽS )z-Needs to be toplevel for ProcessPoolExecutor.)r   )Zfile_and_dfileÚkwargsr3   r!   r"   r"   r#   r/   e   s    r/   c              
   C   s¢  d}|dk r"t | tjƒr"t | ¡} tj | ¡}	|dk	rFtj ||	¡}
nd}
|dk	rd| | ¡}|rd|S tj | ¡�rž|r€| d }nB|dkrª|dkr”|nd}t	j
j| |d�}nt	j
 | ¡}tj |¡}|	dd	… |	d	d…  }}|d
k�rž|�s\zXtt | ¡jƒ}t dt	j
jd|¡}t|dƒ�}| d¡}W 5 Q R X ||k�rB|W S W n tk
�rZ   Y nX |�sptd | ¡ƒ ztj| ||
d||d�}W �n tjk
�r } zjd}|dk�r¼| W Y ¢RS |�rÒtd | ¡ƒ ntddd� |jjtjjdd�}|  tjj¡}t|ƒ W 5 d}~X Y n† t!t"tfk
�rŽ } zRd}|dk�rJ| W Y ¢:S |�r`td | ¡ƒ ntddd� t|j#j$d |ƒ W 5 d}~X Y nX |dk�ržd}|S )aT  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
    invalidation_mode: how the up-to-dateness of the pyc will be checked
    Tr   NÚcr   r	   Ú )Úoptimizationéýÿÿÿz.pyz<4sllÚrbé   zCompiling {!r}...)r)   r*   Fz*** Error compiling {!r}...z*** )ÚendÚbackslashreplace)Úerrorsú:)%r   r   r   r   r   Úbasenamer   ÚsearchÚisfileÚ	importlibÚutilÚcache_from_sourceÚdirnameÚintÚstatÚst_mtimeÚstructZpackÚMAGIC_NUMBERÚopenÚreadr   r   r   Ú
py_compileÚcompileÚPyCompileErrorÚmsgÚencodeÚsysÚstdoutÚencodingÚdecodeÚSyntaxErrorÚUnicodeErrorÚ	__class__Ú__name__)r    r
   r&   r'   r   r(   r)   r*   r2   r   r!   ZmoÚcfileÚoptZ	cache_dirÚheadÚtailÚmtimeZexpectZchandleZactualÚokÚerrrP   Úer"   r"   r#   r   j   s†    


 ÿ
 ÿ

þ
ÿ
$
c           	      C   sT   d}t jD ]D}|r|tjkr2| r2|dk rNtdƒ q
|oLt||d|||||d�}q
|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()
    Tr   zSkipping current directoryN)r   r(   r)   r*   )rR   r   r   r   r   r   )	Zskip_curdirr   r&   r   r(   r)   r*   r2   r   r"   r"   r#   r   À   s     

ø
c                  C   s¸  ddl } | jdd�}|jdddddd	d
� |jdtddd� |jddddd� |jdddddd� |jddddd� |jdddddd � |jd!d"d#dd$d � |jd%d&d'd(d)� |jd*d+d,d-d.� |jd/d0d1td2d3� d4d5„ tjD ƒ}|jd6t|ƒd7d8� | ¡ }|j}|j	�r$ddl
}| |j	¡|_	|jdk	�r8|j}n|j}|j�rÂzF|jd9k�rZtjnt|jƒ� }|D ]}| | ¡ ¡ �qjW 5 Q R X W n4 tk
�rÀ   |jd:k �rºtd; |j¡ƒ Y d<S X |j�rè|j d9d=¡ ¡ }	tj|	 }
nd}
d>}z–|�rl|D ]h}tj |¡�r6t||j|j |j	|j|j!|
d?��sbd<}n,t"|||j|j |j	|j|j!|j#|
d@�	�süd<}�qü|W S t$|j!|j |j|
dA�W S W n, t%k
�r²   |jd:k �r¬tdBƒ Y d<S X d>S )CzScript main program.r   Nz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constr   r   z!don't recurse into subdirectories)ÚactionZconstr+   ÚdestÚhelpz-rÚ	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)Útyperc   rd   z-fÚ
store_truer&   z/force rebuild even if timestamps are up to date)rb   rc   rd   z-qÚcountr   zIoutput only error messages; -qq will suppress the error messages as well.)rb   rc   r+   rd   z-br(   z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
   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)Úmetavarrc   r+   rd   z-xZREGEXPr'   zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILEÚflistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)ri   rc   rd   Úcompile_destzFILE|DIRÚ*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)ri   Únargsrd   z-jz	--workersr	   zRun compileall concurrently)r+   rf   rd   c                 S   s   g | ]}|j  ¡  d d¡‘qS )Ú_ú-)r   ÚlowerÚreplace)Ú.0Úmoder"   r"   r#   Ú
<listcomp>	  s   ÿzmain.<locals>.<listcomp>z--invalidation-modez‡set .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)Úchoicesrd   ro   r   zError reading file list {}Frn   T)r*   )r1   r*   )r(   r&   r   r*   z
[interrupted])&ÚargparseÚArgumentParserÚadd_argumentrF   rM   ÚPycInvalidationModeÚsortedÚ
parse_argsrk   r'   ÚrerN   re   r   rj   rR   ÚstdinrK   ÚappendÚstripr   r   r   r   r*   rq   Úupperr   r   rA   r   r
   r&   r(   r   r1   r   ÚKeyboardInterrupt)rv   ÚparserZinvalidation_modesÚargsZcompile_destsr|   r   ÚfÚlineZivl_moder*   r2   rc   r"   r"   r#   Úmainâ   s¾    ÿ
 þ
ÿ
ÿÿ
ÿÿÿ
ÿ
ÿ
 ÿÿþ  þ
   ý
þr†   Ú__main__)Nr   r   )	r   NFNr   Fr$   r	   N)NFNr   Fr$   N)r	   r   Fr   Fr$   N)Ú__doc__r   rR   Úimportlib.utilrB   rM   rI   Ú	functoolsr   Ú__all__r   r   r/   r   r   r†   rY   rF   Zexit_statusÚexitr"   r"   r"   r#   Ú<module>   s<   

         þ
3     þ
V     þ
"i