
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \]/  ã               @   s�   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d„Zddd„Zdd„ ZedkrŒeeƒ  ƒZejeƒ dS )é    N)ÚpartialÚcompile_dirÚcompile_fileÚcompile_pathé
   c             c   s   |dk rt | tjƒrtj| ƒ} |s0tdj| ƒƒ ytj| ƒ}W n. tk
rl   |dk rdtdj| ƒƒ g }Y nX |jƒ  x¤|D ]œ}|dkrŠq|tj	j
| |ƒ}|d k	r°tj	j
||ƒ}nd }tj	j|ƒsÈ|V  q||dkr||tjkr||tjkr|tj	j|ƒr|tj	j|ƒ r|t|||d |d�E d H  q|W d 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"   ú"/usr/lib64/python3.6/compileall.pyr      s0    


r   Fr	   c	             C   sð   d }	|d k	rP|dk rt dƒ‚n2|dkrPyddlm}	 W n tk
rN   d}Y nX t| |||d�}
d}|d k	rÆ|dkrÆ|	d k	rÆ|p‚d }|	|d��0}|jtt||||||d�|
ƒ}t|dd	�}W d Q R X n&x$|
D ]}t|||||||ƒsÌd
}qÌW |S )Nr   z%workers must be greater or equal to 0r	   )ÚProcessPoolExecutor)r   r   r
   T)Zmax_workers)r
   ÚforceÚrxr   ÚlegacyÚoptimize)ÚdefaultF)	Ú
ValueErrorZconcurrent.futuresr$   ÚImportErrorr   Úmapr   r   Úmin)r   r   r
   r%   r&   r   r'   r(   Úworkersr$   ÚfilesÚsuccessZexecutorZresultsÚfiler"   r"   r#   r   2   s6    


c             C   sŠ  d}|dk r"t | tjƒr"tj| ƒ} tjj| ƒ}|d k	rFtjj||ƒ}	nd }	|d k	rd|j| ƒ}
|
rd|S tjj| ƒ�r†|r€| d }nB|dkrª|dkr”|nd}t	j
j| |d�}nt	j
j| ƒ}tjj|ƒ}|d d… |dd …  }}|d	k�r†|�sXyTttj| ƒjƒ}tjd
t	j
j|ƒ}t|dƒ�}|jdƒ}W d Q R X ||k�r>|S W n tk
�rV   Y nX |�sltdj| ƒƒ ytj| ||	d|d�}W nò tjk
�r } zdd}|dk�r¬|S |�rÂtdj| ƒƒ ntddd� |jjtjjdd�}|j tjjƒ}t|ƒ W Y d d }~X n~ t!t"tfk
�rv } zLd}|dk�r2|S |�rHtdj| ƒƒ ntddd� t|j#j$d |ƒ W Y d d }~X nX |dk�r†d}|S )NTr   Úcr   r	   Ú )Úoptimizationé   z.pyz<4slÚrbé   zCompiling {!r}...)r(   Fz*** Error compiling {!r}...z*** )ÚendÚbackslashreplace)Úerrorsú:éýÿÿÿr<   )%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(   r0   r   r!   ZmoÚcfileÚoptZ	cache_dirÚheadÚtailÚmtimeZexpectZchandleZactualÚokÚerrrN   Úer"   r"   r#   r   b   sx    






$
c          
   C   sX   d}xNt jD ]D}| s |tjkr6| r6|dk rPtdƒ q|oNt||d ||||d�}qW |S )NTr   zSkipping current directory)r   r'   r(   )rP   r   r   r   r   r   )Zskip_curdirr   r%   r   r'   r(   r0   r   r"   r"   r#   r   µ   s    
c        
      C   sz  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.d/d0td1d2� |jƒ }|j}|jrþdd l}|j|jƒ|_|j	d k	�r|j	}n|j
}|j�ržyJ|jd3k�r4tjnt|jƒ�$}x|D ]}|j|jƒ ƒ �qFW W d Q R X W n2 tk
�rœ   |jd4k �r˜td5j|jƒƒ d6S X |jd k	�r¸|j�p´d |_d7}yŽ|�r4xj|D ]b}	tjj|	ƒ�r t|	|j|j|j|j|jƒ�s*d6}n*t|	||j|j|j|j|j|jd8��sÊd6}�qÊW |S t|j|j|jd9�S W n* tk
�rt   |jd4k �rptd:ƒ d6S X d7S );Nr   z1Utilities 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.)Útypera   rb   z-fÚ
store_truer%   z/force rebuild even if timestamps are up to date)r`   ra   rb   z-qÚcountr   zIoutput only error messages; -qq will suppress the error messages as well.)r`   ra   r)   rb   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)Úmetavarra   r)   rb   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)rg   ra   rb   Ú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)rg   Únargsrb   z-jz	--workersr	   zRun compileall concurrently)r)   rd   rb   ú-r   zError reading file list {}FT)r.   )r'   r%   r   z
[interrupted]) ÚargparseÚArgumentParserÚadd_argumentrD   Ú
parse_argsri   r&   ÚrerL   rc   r   rh   rP   ÚstdinrI   ÚappendÚstripr   r   r   r   r.   r   r   r?   r   r
   r%   r'   r   r   ÚKeyboardInterrupt)
rm   ÚparserÚargsZcompile_destsrq   r   ÚfÚliner0   ra   r"   r"   r#   ÚmainÎ   s~    








"



rz   Ú__main__)Nr   r   éÿÿÿÿ)r   NFNr   Fr|   r	   r|   )NFNr   Fr|   r|   )r	   r   Fr   Fr|   )r   rP   Úimportlib.utilr@   rK   rG   Ú	functoolsr   Ú__all__r   r   r   r   rz   rW   rD   Zexit_statusÚexitr"   r"   r"   r#   Ú<module>   s"   

 
/ 
R 
[