o
     JAf                     @   s   	 d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZg dZ	G dd de
ZG dd de jZdd Z	
	 dddZdd ZedkrNe  dS dS )    N)compilemainPyCompileErrorPycInvalidationModec                   @   s    e Zd Z	 dddZdd ZdS )r    c                 C   st   |j }|tu rdt||}|dd| }nd||f }t| |p%|||| || _|| _	|| _
|p6|| _d S )Nr   zFile "<string>"z	File "%s"zSorry: %s: %s)__name__SyntaxErrorjoin	tracebackformat_exception_onlyreplace	Exception__init__exc_type_name	exc_valuefilemsg)selfexc_typer   r   r   r   tbtexterrmsg r   !/usr/lib/python3.10/py_compile.pyr   .   s   zPyCompileError.__init__c                 C   s   | j S )N)r   )r   r   r   r   __str__>   s   zPyCompileError.__str__N)r   )r   
__module____qualname__r   r   r   r   r   r   r      s    
r   c                   @   s   e Zd ZdZdZdZdS )r            N)r   r   r   	TIMESTAMPCHECKED_HASHUNCHECKED_HASHr   r   r   r   r   B   s    r   c                   C   s   t jdr	tjS tjS )NSOURCE_DATE_EPOCH)osenvirongetr   r    r   r   r   r   r   _get_default_invalidation_modeH   s   r&   Fc              
   C   s  	 |d u rt  }|d u r'|dkr!|dkr|nd}tjj| |d}ntj| }tj|r6d}t||tj	|rKtj
|sKd}t||tjd| }	|	| }
z|	j|
|p^| |d}W n- ty } z!t|j||pr| }|d	k r|r||tj|jd
  W Y d }~d S d }~ww ztj|}|rt| W n	 ty   Y nw |tjkr|	| }tj||d |d }ntj|
}tj|||tjk}tj | }tj!||| |S )Nr   r   r   )optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz<py_compile>)	_optimizer   
mtimesize)"r&   	importlibutilcache_from_sourcer#   pathislinkFileExistsErrorformatexistsisfile	machinerySourceFileLoaderget_datasource_to_coder   r   	__class__sysstderrwriter   dirnamemakedirsr   r   
path_stats_bootstrap_external_code_to_timestamp_pycsource_hash_code_to_hash_pycr    
_calc_mode_write_atomic)r   cfiledfiledoraiseoptimizeinvalidation_modequietr(   r   loadersource_bytescodeerrpy_excr>   source_statsbytecoderC   moder   r   r   r   O   sj   +




r   c                  C   s  dd l } d}| j|d}|jddddd |jd	d
dd | }|jdgkr2dd tj D }n|j}|D ]N}zt|dd W q7 t	yc } z|j
rR|d n|d|j W Y d }~q7d }~w ty } z|j
rs|d n|dt| W Y d }~q7d }~ww d S )Nr   z6A simple command-line interface for py_compile module.)descriptionz-qz--quiet
store_truezSuppress error output)actionhelp	filenames+zFiles to compile)nargsrX   -c                 S   s   g | ]}| d qS )r*   )rstrip).0filenamer   r   r   
<listcomp>   s    zmain.<locals>.<listcomp>T)rI   r   )argparseArgumentParseradd_argument
parse_argsrY   r;   stdin	readlinesr   r   rL   exitr   OSErrorstr)ra   rU   parserargsrY   r_   errorr   r   r   r      s@   r   __main__)NNFr'   Nr   )enumZimportlib._bootstrap_externalr-   importlib.machineryimportlib.utilr#   Zos.pathr;   r
   __all__r   r   Enumr   r&   r   r   r   r   r   r   r   <module>   s(    0
a#
