관리-도구
편집 파일: compileall.cpython-39.opt-1.pyc
a �����DOg�N������������������� ���@���s����d�Z�ddlZddlZddlZddlZddlZddlZddlm Z �ddl mZ�g�d�Zddd�Z dddddd�dd �Zdddddd�dd�Zddd�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)�Path)�compile_dir�compile_file�compile_pathc�����������������c���s����|dk�rt�|�tj�rt�|��}�|s0td�|����zt�|��}W�n,�tyj���|dk�rbtd�|����g�}Y�n0�|����|D�]|}|dkr�qxtj � |�|�}tj �|�s�|V��qx|dkrx|tjkrx|tj krxtj �|�rxtj �|�sxt||d�|d�E�d�H��qxd�S�)N����zListing {!r}...zCan't list {!r}�__pycache__r�������)� maxlevels�quiet)� isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink� _walk_dir)�dirr ���r����names�name�fullname��r ����"/usr/lib64/python3.9/compileall.pyr������s2���� � � �r���F���r �����stripdir� prependdir� limit_sl_dest�hardlink_dupesc ����������������C���sN��d}|dur$| dus|dur$t�d��|dur8|�} |}d}|dk�rHt�d��|dkrxzddlm}�W�n�tyv���d}Y�n0�|du�r�t���}t|�||d�}d}|dk�r|du�r|p�d}||d ��D}|�tt ||||||| | ||| d �|�}t |dd�}W�d����n1��s0����Y��n2|D�],}t |||||||| | ||| d��sd }�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 `sys.getrecursionlimit()`) 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: int or list of optimization levels or -1 for level of the interpreter. Multiple levels leads to multiple compiled files each with one optimization level. workers: maximum number of parallel workers invalidation_mode: how the up-to-dateness of the pyc will be checked stripdir: part of path to left-strip from source file path prependdir: path to prepend to beginning of original file path, applied after stripdir limit_sl_dest: ignore symlinks if they are pointing outside of the defined path hardlink_dupes: hardlink duplicated pyc files N�PDestination dir (ddir) cannot be used in combination with stripdir or prependdirr���z%workers must be greater or equal to 0r ���)�ProcessPoolExecutor)r���r ���T)�max_workers)�ddir�force�rxr����legacy�optimize�invalidation_moder$���r%���r&���r'���)�defaultr#���F)� ValueError�concurrent.futuresr)����ImportError�sys�getrecursionlimitr����mapr���r����min)r���r ���r+���r,���r-���r���r.���r/����workersr0���r$���r%���r&���r'���r)����files�success�executor�results�filer ���r ���r!���r���0���sX���� � �.�r���c����������&��� ���C���s���|dur |dus| dur t�d��d}|dk�rBt|�tj�rBt�|��}�tj�|��} d}|durhtj�|| �}|dur�|��tjj �}|�tjj �}t |�}t||�D�]\}}||kr�|�|��q�tjj|��}| dur�|du�r�tj�| |��}ntj�| |�}t|t ��r|g}tt|��}|�r.t|�dk��r.t�d��|du�rL|�|��}|�rL|S�| du�r�tj�|���r�t| ����t|�����jv�r�|S�i�}tj�|���r�|D�]d}|�r�|�d�||<�nJ|dk�r�|dk�r�|nd }tjj|�|d �}|||<�ntj�|��}|||<��q�| dd��| dd���}}|dk�r�|�s�z�t t�|��j�}t�d tjjd|d@��}|���D�]L}t |d��}|�!d�}W�d����n1��s�0����Y��||k�r\��q��q\|W�S�W�n�t"�y����Y�n0�|�s�t#d�$|����z�t%|�D�]p\}}||�}t&j'|�||d||d�} |dk�r�|�r�|||d���}!t(j)||!dd��r�t�*|��t�+|!|���q�W��n�t&j,�y��}"�z|d}|dk�r�|W��Y�d}"~"S�|�r�t#d�$|����nt#dd d��t-j.j/�p�t-�0��}#|"j1j2|#dd��3|#�}$t#|$��W�Y�d}"~"n�d}"~"0��t4t5t"f�yp�}%�z^d}|dk�r(|W��Y�d}%~%S�|�r>t#d�$|����nt#dd d��t#|%j6j7d�|%��W�Y�d}%~%nd}%~%0�0�| dk�r�d}|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: 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: int or list of optimization levels or -1 for level of the interpreter. Multiple levels leads to multiple compiled files each with one optimization level. invalidation_mode: how the up-to-dateness of the pyc will be checked stripdir: part of path to left-strip from source file path prependdir: path to prepend to beginning of original file path, applied after stripdir limit_sl_dest: ignore symlinks if they are pointing outside of the defined path. hardlink_dupes: hardlink duplicated pyc files Nr(���Tr���zXHardlinking of duplicated bytecode makes sense only for more than one optimization level�cr���r �����)�optimization���z.pyz<4sLLl�������rb����zCompiling {!r}...)r/���r0���F)�shallowz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:)8r2���r���r ���r���r���r����basenamer����split�sep�list�zip�remove�int�sorted�set�len�searchr���r����resolve�parents�isfile� importlib�util�cache_from_source�stat�st_mtime�struct�pack�MAGIC_NUMBER�values�open�readr���r���r���� enumerate� py_compile�compile�filecmp�cmp�unlink�link�PyCompileErrorr5����stdout�encoding�getdefaultencoding�msg�encode�decode�SyntaxError�UnicodeError� __class__�__name__)&r���r+���r,���r-���r���r.���r/���r0���r$���r%���r&���r'���r;���r����dfile�fullname_parts�stripdir_parts� ddir_parts�spart�opart�mo� opt_cfiles� opt_level�opt�cfile�head�tail�mtime�expect�chandle�actual�index�ok�previous_cfile�errrl���rn����er ���r ���r!���r���{���s����� � �* � ( r���c����������� ������C���sT���d}t�jD�]D}|r|tjkr2|�r2|dk�rNtd��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���zSkipping current directoryN)r���r.���r/���r0���)r5���r���r ���r���r���r���) �skip_curdirr ���r,���r���r.���r/���r0���r;���r���r ���r ���r!���r�����s ���� � r���c������������ ������C���s���ddl�}�|�jdd�}|jddddddd ��|jd tddd ��|jddddd��|jdddddd��|jddddd��|jdddddd��|jd d!d"dd#d��|jd$d%d&dd'd��|jd(d)d*dd+d��|jd,d-d.d/d0��|jd1d2d3d4d5��|jd6d7d8td9d:��d;d<��tjD��}|jd=t|�d>d?��|jd@dAtdBdCdD��|jdEdFdGdHd0��|jdIddJdKd��|���}|j}|j �r�ddl }|�|j �|_ |jdLk�r�d|_|j du�r�|j }n|j}|jdu��r�dMg|_t|j�d8k�r�|j�r�|�dN��|jdu�r|jdu�s |jdu�r|�dO��|j�r�z\|jdPk�r0tjnt|j��*}|D�]}|�|������q@W�d����n1��sl0����Y��W�n2�t�y����|jdQk��r�tdR�|j���Y�dSS�0�|j �r�|j �!dPdT��"��} tj| �} nd} dU}z�|�r~|D�]�}t#j$�%|��r4t&||j|j'|j |j|j(| |j|j|j|j|jdV��stdS}n@t)|||j|j'|j |j|j(|j*| |j|j|j|j|jdW��s�dS}�q�|W�S�t+|j(|j'|j| dX�W�S�W�n*�t,�y����|jdQk��r�tdY��Y�dSS�0�dUS�)ZzScript main program.r���Nz1Utilities to support installing Python libraries.)�descriptionz-l�store_constr ���z!don't recurse into subdirectories)�action�constr1����dest�helpz-r� recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typer����r����z-f� store_truer,���z/force rebuild even if timestamps are up to date)r����r����r����z-q�countr���zIoutput only error messages; -qq will suppress the error messages as well.)r����r����r1���r����z-br.���z0use legacy (pre-PEP3147) compiled file locationsz-d�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)�metavarr����r1���r����z-s�STRIPDIRr$���z�part of path to left-strip from path to source file - for example buildroot. `-d` and `-s` options cannot be specified together.z-p� PREPENDDIRr%���z�path to add as prefix to path to source file - for example / to make it absolute when some part is removed by `-s` option. `-d` and `-p` options cannot be specified together.z-x�REGEXPr-���zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-i�FILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)r����r����r�����compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)r�����nargsr����z-jz --workersr ���zRun compileall concurrently)r1���r����r����c�����������������S���s���g�|�]}|j�����d�d��qS�)�_�-)r����lower�replace)�.0�moder ���r ���r!���� <listcomp>g��s����zmain.<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.)�choicesr����z-o�append� opt_levelsz�Optimization levels to run compilation with. Default is -1 which uses the optimization level of the Python interpreter itself (see -O).)r����r����r����r����z-e�DIRr&���z+Ignore symlinks pointing outsite of the DIRz--hardlink-dupesr'���zHardlink duplicated pyc filesr@���r"���zYHardlinking of duplicated bytecode makes sense only for more than one optimization level.z.-d cannot be used in combination with -s or -pr����r���zError reading file list {}Fr����T)r0���r$���r%���r/���r&���r'���)r9���r0���r$���r%���r/���r&���r'���)r.���r,���r���r0���z [interrupted])-�argparse�ArgumentParser�add_argumentrP���rd����PycInvalidationModerQ���� parse_argsr����r-����rere���r&���r����r ���r����rS���r'����errorr+���r$���r%���r����r5����stdinra���r�����stripr���r���r���r���r0���r�����upperr ���r���rW���r���r,���r.���r���r9���r����KeyboardInterrupt) r�����parser�invalidation_modes�args� compile_destsr����r ����f�line�ivl_moder0���r;���r����r ���r ���r!����main2��s���� � � �� �� � �� � � ���� �� �� 6� � �r�����__main__)r���) NNFNr���Fr"���r ���N)NFNr���Fr"���N)r ���r���Fr���Fr"���N)�__doc__r ���r5����importlib.utilrX���rd���r]���rf���� functoolsr����pathlibr����__all__r���r���r���r���r����rt���rP����exit_status�exitr ���r ���r ���r!����<module>���sD��� �����K���������� "�