Your IP : 3.15.34.105


Current Path : /opt/alt/python38/lib64/python3.8/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/distutils/command/__pycache__/build_py.cpython-38.opt-2.pyc

U

i�f&C�@svddlZddlZddlZddlZddlmZddlTddlm	Z	m
Z
ddlmZGdd�de�Z
Gdd	�d	e
e
�ZdS)
�N)�Command)�*)�convert_path�	Mixin2to3)�logc@s�eZdZdZdddddgZddgZd	diZd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd2d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1S)3�build_pyz5"build" pure Python modules (copy to build directory))z
build-lib=�dzdirectory to "build" (copy) to)�compile�czcompile .py to .pyc)�
no-compileNz!don't compile .py files [default])z	optimize=�Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])�force�fz2forcibly build everything (ignore file timestamps)r	r
rcCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr)�	build_lib�
py_modules�package�package_data�package_dirr	�optimizer
��self�r�?/opt/alt/python38/lib64/python3.8/distutils/command/build_py.py�initialize_options szbuild_py.initialize_optionsc	Cs�|�ddd�|jj|_|jj|_|jj|_i|_|jjr^|jj��D]\}}t|�|j|<qF|��|_	t
|jt�s�zt|j�|_Wn t
tfk
r�td��YnXdS)NZbuild)rr)r
r
zoptimize must be 0, 1, or 2)Zset_undefined_options�distribution�packagesrrr�itemsr�get_data_files�
data_files�
isinstancer�int�
ValueError�AssertionErrorZDistutilsOptionError)r�name�pathrrr�finalize_options*s$�



zbuild_py.finalize_optionscCs:|jr|��|jr$|��|��|�|jdd��dS�Nr)�include_bytecode)r�
build_modulesr�build_packages�build_package_data�byte_compile�get_outputsrrrr�runCszbuild_py.runcs�g}|js|S|jD]h}|�|�}tjj|jg|�d��}d�|rPt|�d��fdd�|�||�D�}|�	||||f�q|S)N�.r�csg|]}|�d��qS�Nr)�.0�file�Zplenrr�
<listcomp>ssz+build_py.get_data_files.<locals>.<listcomp>)
r�get_package_dir�osr$�joinr�split�len�find_data_files�append)r�datar�src_dir�	build_dir�	filenamesrr3rras



�zbuild_py.get_data_filescsd|j�dg�|j�|g�}g�|D]:}t�tj�t�|�t|���}���fdd�|D��q$�S)N�cs$g|]}|�krtj�|�r|�qSr)r6r$�isfile)r1�fn��filesrrr4�s�z,build_py.find_data_files.<locals>.<listcomp>)	r�get�globr6r$r7�escaper�extend)rrr=Zglobs�patternZfilelistrrCrr:ys�zbuild_py.find_data_filescCs`d}|jD]P\}}}}|D]>}tj�||�}|�tj�|��|jtj�||�|dd�qq
dS)NF�Z
preserve_mode)rr6r$r7�mkpath�dirname�	copy_file)rZlastdirrr=r>r?�filename�targetrrrr*�s�zbuild_py.build_package_datacCs�|�d�}|js&|r tjj|�SdSn�g}|r�z|jd�|�}Wn*tk
rl|�d|d�|d=Yq*X|�d|�tjj|�Sq*|j�d�}|dk	r�|�d|�|r�tjj|�SdSdS)Nr.r@r���)r8rr6r$r7�KeyError�insertrE)rrr$�tailZpdirrrrr5�s(
	zbuild_py.get_package_dircCsj|dkr8tj�|�s td|��tj�|�s8td|��|rftj�|d�}tj�|�rZ|St�d|�dS)Nr@z%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz__init__.pyz8package init file '%s' not found (or not a regular file))	r6r$�existsZDistutilsFileError�isdirr7rAr�warn)rrr�init_pyrrr�
check_package�s&����zbuild_py.check_packagecCs&tj�|�st�d||�dSdSdS)Nz!file %s (for module %s) not foundFT)r6r$rArrV)r�module�module_filerrr�check_module�szbuild_py.check_modulec	Cs�|�||�t�tj�t�|�d��}g}tj�|jj�}|D]P}tj�|�}||kr�tj�	tj�
|��d}|�|||f�q>|�d|�q>|S)Nz*.pyrzexcluding %s)
rXrFr6r$r7rG�abspathrZscript_name�splitext�basenamer;Zdebug_print)	rrrZmodule_files�modulesZsetup_scriptrZabs_frYrrr�find_package_modules�szbuild_py.find_package_modulesc	Cs�i}g}|jD]�}|�d�}d�|dd��}|d}z||\}}Wn"tk
rh|�|�}d}YnX|s�|�||�}	|df||<|	r�|�|d|	f�tj�||d�}
|�	||
�s�q|�|||
f�q|S)Nr.rrPr/�__init__�.py)
rr8r7rQr5rXr;r6r$r[)rrr_rYr$rZmodule_baser�checkedrWrZrrr�find_modules�s*



zbuild_py.find_modulescCsNg}|jr|�|���|jrJ|jD]$}|�|�}|�||�}|�|�q$|Sr0)rrHrdrr5r`)rr_rr�mrrr�find_all_moduless

zbuild_py.find_all_modulescCsdd�|��D�S)NcSsg|]}|d�qS)rPr)r1rYrrrr4-sz-build_py.get_source_files.<locals>.<listcomp>)rfrrrr�get_source_files,szbuild_py.get_source_filescCs$|gt|�|dg}tjj|�S)Nrb)�listr6r$r7)rr>rrYZoutfile_pathrrr�get_module_outfile/szbuild_py.get_module_outfiler/cCs�|��}g}|D]p\}}}|�d�}|�|j||�}|�|�|r|jr^|�tjj|dd��|j	dkr|�tjj||j	d��q|dd�|j
D�7}|S)Nr.r@)�optimizationrcSs,g|]$\}}}}|D]}tj�||��qqSr)r6r$r7)r1rr=r>r?rNrrrr4Bs
�z(build_py.get_outputs.<locals>.<listcomp>)rfr8rirr;r	�	importlib�util�cache_from_sourcerr)rr'r_ZoutputsrrYrZrNrrrr,3s*


�

�
�zbuild_py.get_outputscCsbt|t�r|�d�}nt|ttf�s,td��|�|j||�}tj	�
|�}|�|�|j||dd�S)Nr.z:'package' must be a string (dot-separated), list, or tuplerrJ)
r�strr8rh�tuple�	TypeErrorrirr6r$rLrKrM)rrYrZrZoutfile�dirrrr�build_moduleJs
�
zbuild_py.build_modulecCs*|��}|D]\}}}|�|||�qdSr0)rdrr)rr_rrYrZrrrr(Yszbuild_py.build_modulescCsD|jD]8}|�|�}|�||�}|D]\}}}|�|||�q$qdSr0)rr5r`rr)rrrr_Zpackage_rYrZrrrr)bs



zbuild_py.build_packagescCs�tjr|�d�dSddlm}|j}|dtjkr>|tj}|jrZ||d|j	||j
d�|jdkr||||j|j	||j
d�dS)Nz%byte-compiling is disabled, skipping.r)r+rP)rr
�prefix�dry_run)�sys�dont_write_bytecoderV�distutils.utilr+rr6�sepr	r
rtr)rrDr+rsrrrr+vs&

�
�zbuild_py.byte_compileN)r/)�__name__�
__module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optrr%r-rr:r*r5rXr[r`rdrfrgrir,rrr(r)r+rrrrrs8�



'4
	rc@seZdZdd�Zdd�ZdS)�
build_py_2to3cCsLg|_|jr|��|jr*|��|��|�|j�|�|jdd��dSr&)	�
updated_filesrr(rr)r*Zrun_2to3r+r,rrrrr-�szbuild_py_2to3.runcCs,t�||||�}|dr(|j�|d�|S)Nr/r)rrrr}r;)rrYrZr�resrrrrr�szbuild_py_2to3.build_moduleN)ryrzr{r-rrrrrrr|�sr|)r6�importlib.utilrkrurFZdistutils.corerZdistutils.errorsrwrrZ	distutilsrrr|rrrr�<module>s}

?>