Your IP : 3.129.210.35


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/compileall.cpython-34.pyc

�
e f�%�	@s�dZddlZddlZddlZddlZddlZdddgZdddddddd	d�Zddddddd
d�Z	dddddddd�Z
dd
�Zedkr�e
e��Zeje�ndS)a�Module/script to byte-compile all .py files to .pyc (or .pyo) 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�compile_dir�compile_file�compile_path�
F�c
Cs�|stdj|��nytj|�}Wn+tk
r\tdj|��g}YnX|j�d}	x|D]}
|
dkr�qtntjj||
�}|dk	r�tjj||
�}nd}tjj|�st	|||||||�s�d}	q�qt|dkrt|
tj
krt|
tjkrttjj|�rttjj|�rtt
||d||||||�s�d}	q�qtqtW|	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:     if True, be quiet during compilation
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    zListing {!r}...zCan't list {!r}r�__pycache__Nr)�print�format�os�listdir�OSError�sort�path�join�isdirr�curdir�pardir�islinkr)
�dir�	maxlevels�ddir�force�rx�quiet�legacy�optimize�names�success�name�fullname�dfile�r!�//opt/alt/python34/lib64/python3.4/compileall.pyrs4


*%cCs
d}tjj|�}|dk	r<tjj||�}	nd}	|dk	rj|j|�}
|
rj|Sntjj|�r	|r�|tr�dnd}nL|dkr�tjj	|d|�}ntjj	|�}tjj
|�}|dd�|dd�}
}|dkr	|s�ynttj|�j
�}tjd	tjj|�}t|d
��}|jd�}WdQX||kr�|SWq�tk
r�Yq�Xn|s�tdj|��ny"tj|||	d
d|�}Wn
tjk
rw}zt|rtdj|��ntddd�|jjtjjdd�}|jtjj�}t|�d}WYdd}~Xqtt tfk
r�}zN|r�tdj|��ntddd�t|j!j"d|�d}WYdd}~XqX|dkrd}qq	n|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:     if True, be quiet during compilation
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    rN�c�or�debug_override�z.pyz<4sl�rb�zCompiling {!r}...Trz*** Error compiling {!r}...z*** �end��errors�backslashreplace�:���r.)#r
r�basenamer�search�isfile�	__debug__�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr	�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)rrrrrrrrrr Zmo�cfileZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrA�er!r!r"r@sj	!	

	
cCstd}xgtjD]\}|s,|tjkr?|r?td�q|oit||d|d|d|d|�}qW|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 False)
    legacy: as for compile_dir() (default False)
    optimize: as for compile_dir() (default -1)
    rzSkipping current directoryNrrr)rCrr
rrr)Zskip_curdirrrrrrrrr!r!r"r�s

c	Cs�ddl}|jdd�}|jdddddd	d
ddd
d�|jdddddd
d�|jdddddd
d�|jdddddd
d�|jdddddd	dd
d�|jddddd d	dd
d!�|jd"dd#dd$d
d%�|jd&dd'd(d)d
d*�|j�}|j}|jrpddl}|j|j�|_n|jryX|jd+kr�t	j
nt|j��+}x!|D]}|j|j
��q�WWdQXWqtk
r�td,j|j��d-SYqXnd.}y�|r�x�|D]�}tjj|�rgt||j|j|j|j|j�s�d-}q�qt||j|j|j|j|j|j�sd-}qqW|Std|jd|jd|j�SWn tk
r�td/�d-SYnXd.S)0zScript main program.rNZdescriptionz1Utilities to support installing Python libraries.z-l�actionZstore_constZconst�defaultr�destr�helpz!don't recurse into subdirectoriesz-f�
store_truerz/force rebuild even if timestamps are up to datez-qrzoutput only error messagesz-brz0use legacy (pre-PEP3147) compiled file locationsz-d�metavarZDESTDIRrz�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailablez-xZREGEXPrzskip 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.path�-zError reading file list {}FTz
[interrupted])�argparse�ArgumentParser�add_argument�
parse_argsrYr�rer?rXrC�stdinr<�append�striprrr	r
rr1rrrrrrrr�KeyboardInterrupt)	r]�parser�argsZ
compile_destsra�f�linerrTr!r!r"�main�sh					*
!




	rj�__main__���rlrl)�__doc__r
rC�importlib.utilr3r>r:�__all__rrrrjrJr7Zexit_status�exitr!r!r!r"�<module>s *JI

?>