AlkantarClanX12

Your IP : 18.117.70.64


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/compileall.cpython-35.pyc



��Yf�-�@s>dZddlZddlZddlZddlZddlZyddlmZWne	k
rpdZYnXddl
mZdddgZdddd	d
�Z
ddddddddd
d�Zdddddddd�Zdddddddd�Zdd�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)�ProcessPoolExecutor)�partial�compile_dir�compile_file�compile_path�
ccsa|stdj|��ytj|�}Wn7tk
re|dkr[tdj|��g}YnX|j�x�|D]�}|dkr�qwtjj||�}|dk	r�tjj||�}nd}tjj|�s�|Vqw|dkrw|tj	krw|tj
krwtjj|�rwtjj|�rwt|d|d|dd	|�EdHqwWdS)
NzListing {!r}...�zCan't list {!r}�__pycache__r�ddir�	maxlevels��quiet)
�print�format�os�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr
�names�name�fullname�dfile�r �//opt/alt/python35/lib64/python3.5/compileall.pyrs,


*%rFrc	Cs|dk	r$|dkr$td��t|d|d|d|�}	d}
|dk	r�|dkr�tdk	r�|pud}td|��U}|jttd|d	|d
|d|d|d|�|	�}t|d
d�}
WdQRXn5x2|	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
rr
rZmax_workers�force�rx�legacy�optimize�default)�
ValueErrorrr�maprr�min)rrr
r"r#r
r$r%�workers�files�successZexecutorZresults�filer r r!r4s(	$	

cCs'd}tjj|�}|dk	r<tjj||�}	nd}	|dk	rg|j|�}
|
rg|Stjj|�r#|r�|d}nc|dkr�|dkr�|nd}tjj|d|�}ntjj|�}tjj	|�}
|dd�|dd�}}|dkr#|s�yot
tj|�j�}t
jd	tjj|�}t|d
��}|jd�}WdQRX||kr�|SWntk
r�YnX|s�tdj|��y"tj|||	d
d|�}Wn-tjk
r�}z�d}|dkr|S|r+tdj|��ntddd�|jjtjjdd�}|jtjj�}t|�WYdd}~Xn�tttfk
r}z^d}|dkr�|S|r�tdj|��ntddd�t|j j!d|�WYdd}~XnX|dkr#d}|S)aByte-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
    rN�cr��optimization�z.pyz<4sl�rb�zCompiling {!r}...Tr%rz*** Error compiling {!r}...z*** �end�errors�backslashreplace�:���r8)"rr�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__)rr
r"r#r
r$r%r,rrZmo�cfileZoptZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrJ�er r r!r\st
	!	

	*cCs�d}xstjD]h}|s,|tjkrK|rK|dkrxtd�q|out||d|d|d|d|�}qW|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)
    rrzSkipping current directoryNr
r$r%)rLrrrrr)Zskip_curdirrr"r
r$r%r,rr r r!r�s

c
Cs�ddl}|jdd�}|jdddddd	d
ddd
d�|jddtddd
d�|jdddddd
d�|jdddddd	dd
d�|jdddddd
d�|jddd dd!d	dd
d"�|jd#dd$dd%d	dd
d&�|jd'dd(dd)d
d*�|jd+dd,d-d.d
d/�|jd0d1d	d2dtd
d3�|j�}|j}|jr�ddl}|j|j�|_|j	dk	r�|j	}n	|j
}|jrxyY|jd4kr�tj
nt|j��+}x!|D]}|j|j��qWWdQRXWn;tk
rw|jd5krotd6j|j��d7SYnX|jdk	r�|jp�d|_d8}y�|r>x�|D]�}	tjj|	�r�t|	|j|j|j|j|j�s6d7}q�t|	||j|j|j|j|jd9|j�s�d7}q�W|Std|jd|jd|j�SWn/tk
r�|jd5kr�td:�d7SYnXd8S);zScript main program.rNZdescriptionz1Utilities to support installing Python libraries.z-l�actionZstore_constZconstr&r�destr�helpz!don't recurse into subdirectoriesz-r�type�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.z-f�
store_truer"z/force rebuild even if timestamps are up to datez-q�countr
zIoutput only error messages; -qq will suppress the error messages as well.z-br$z0use legacy (pre-PEP3147) compiled file locationsz-d�metavarZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailablez-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�compile_destzFILE|DIR�nargs�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.pathz-jz	--workersrzRun compileall concurrently�-rzError reading file list {}FTr*z
[interrupted]) �argparse�ArgumentParser�add_argumentr@�
parse_argsrdr#�rerHr_rrcrL�stdinrE�append�striprr
rrr*rrr;rr
r"r$rr�KeyboardInterrupt)
rh�parser�argsZ
compile_destsrlr�f�liner,r\r r r!�main�s~		
				*
"
	
	


	ru�__main__���rwrw)�__doc__rrL�importlib.utilr<rGrCZconcurrent.futuresr�ImportError�	functoolsr�__all__rrrrrurSr@Zexit_status�exitr r r r!�<module>s,
'P[