ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/__pycache__/compileall.cpython-37.pyc

B

� f�5�	@s�dZddlZddlZddlZddlZddlZddlmZdddgZ	ddd	�Z
dd
d�Zdd�Zddd�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�
ccs"|dkrt|tj�rt�|�}|s0td�|��yt�|�}Wn.tk
rl|dkrdtd�|��g}YnX|��x�|D]�}|dkr�q|tj	�
||�}|dk	r�tj	�
||�}nd}tj	�|�s�||fVq||dkr||tjkr||tj
kr|tj	�|�r|tj	�|�s|t|||d|d�EdHq|WdS)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
rr�names�name�fullname�dfile�r"�//opt/alt/python37/lib64/python3.7/compileall.pyrs0


rF���r	c
Cs�d}
|dk	rP|dkrtd��n2|dkrPyddlm}
Wntk
rNd}YnXt||||d�}d}|dk	r�|dkr�|
dk	r�|p�d}|
|d��0}
|
�tt||||||	d	�|�}t|dd
�}WdQRXn,x*|D]"\}}t	||||||||	�s�d}q�W|S)aByte-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
    Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)�force�rxr�legacy�optimize�invalidation_mode)�defaultF)
�
ValueErrorZconcurrent.futuresr%�ImportErrorr�mapr�_compile_file_tuple�minr)rrr
r&r'rr(r)�workersr*r%Zfiles_and_ddirs�successZexecutorZresults�filer!r"r"r#r2s6


cKs|\}}t||f|�S)z-Needs to be toplevel for ProcessPoolExecutor.)r)Zfile_and_dfile�kwargsr3r!r"r"r#r/esr/c
Cs�d}|dkr"t|tj�r"t�|�}tj�|�}	|dk	rFtj�||	�}
nd}
|dk	rd|�|�}|rd|Stj�|��r�|r�|d}nB|dkr�|dkr�|nd}
t	j
j||
d�}nt	j
�|�}tj�|�}|	dd	�|	d	d�}}|d
k�r�|�sZyVt
t�|�j�}t�dt	j
jd|�}t|d��}|�d
�}WdQRX||k�r@|SWntk
�rXYnX|�sntd�|��ytj|||
d||d�}Wn�tjk
�r}zbd}|dk�r�|S|�r�td�|��ntddd�|jjtjjdd�}|� tjj�}t|�Wdd}~XYn~t!t"tfk
�rz}zJd}|dk�r6|S|�rLtd�|��ntddd�t|j#j$d|�Wdd}~XYnX|dk�r�d}|S)aTByte-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
    TrN�crr	�)�optimization���z.pyz<4sll�rb�zCompiling {!r}...)r)r*Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:)%r
rrrr�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__)r r
r&r'rr(r)r*r2rr!Zmo�cfileZoptZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrP�er"r"r#rjsz






$
c	CsXd}xNtjD]D}|r|tjkr4|r4|dkrPtd�q|oNt||d|||||d�}qW|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()
    TrzSkipping current directoryN)rr(r)r*)rRrrrrr)	Zskip_curdirrr&rr(r)r*r2rr"r"r#r�s
c
Cs�ddl}|jdd�}|jdddddd	d
�|jdtdd
d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�d4d5�tjD�}|jd6t|�d7d8�|��}|j}|j	�r$ddl
}|�|j	�|_	|jdk	�r8|j}n|j
}|j�r�yJ|jd9k�rZtjnt|j��$}x|D]}|�|����qlWWdQRXWn2tk
�r�|jd:k�r�td;�|j��d<SX|jdk	�r�|j�p�d|_|j�r|j�d9d=���}	tj|	}
nd}
d>}y�|�r�xp|D]h}tj�|��rTt||j |j!|j	|j|j"|
d?��s�d<}n,t#|||j |j!|j	|j|j"|j|
d@�	�sd<}�qW|St$|j"|j!|j|
dA�SWn*t%k
�r�|jd:k�r�tdB�d<SXd>S)CzScript main program.rNz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr+�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typerbrcz-f�
store_truer&z/force rebuild even if timestamps are up to date)rarbrcz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)rarbr+rcz-br(z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
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)�metavarrbr+rcz-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)rhrbrc�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rh�nargsrcz-jz	--workersr	zRun compileall concurrently)r+rerccSsg|]}|j���dd��qS)�_�-)r�lower�replace)�.0�moder"r"r#�
<listcomp>	szmain.<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.)�choicesrcrnrzError reading file list {}FrmT)r*)r1r*)r(r&rr*z
[interrupted])&�argparse�ArgumentParser�add_argumentrFrM�PycInvalidationMode�sorted�
parse_argsrjr'�rerNrdrrirR�stdinrK�append�striprrrrr1r*rp�upperrrrArr
r&r(rr�KeyboardInterrupt)
ru�parserZinvalidation_modes�argsZ
compile_destsr{r�f�lineZivl_moder*r2rbr"r"r#�main�s�









"





r��__main__)Nrr)	rNFNrFr$r	N)NFNrFr$N)r	rFrFr$N)�__doc__rrR�importlib.utilrBrMrI�	functoolsr�__all__rrr/rrr�rYrFZexit_status�exitr"r"r"r#�<module>s,


1
T
 l

Zerion Mini Shell 1.0