Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/distutils/command/__pycache__/build_py.cpython-37.opt-2.pyc

B

YI~dC�@szddlZddlZddlZddlmZddlmZddlTddlm	Z	m
Z
ddlmZGdd�de�Z
Gd	d
�d
e
e
�ZdS)�N)�glob)�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)z
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
z
no-compilecCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr)�	build_lib�
py_modules�package�package_data�package_dirr
�optimizer
)�self�r�?/opt/alt/python37/lib64/python3.7/distutils/command/build_py.py�initialize_options szbuild_py.initialize_optionsc	Cs�|�ddd�|jj|_|jj|_|jj|_i|_|jjrbx&|jj��D]\}}t|�|j|<qHW|��|_	t
|jt�s�yt|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_outputs)rrrr�runCszbuild_py.runcs�g}|js|Sxr|jD]h}|�|�}tjj|jg|�d��}d�|rRt|�d��fdd�|�||�D�}|�	||||f�qW|S)N�.r�csg|]}|�d��qS)Nr)�.0�file)�plenrr�
<listcomp>tsz+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�	filenamesr)r0rras
zbuild_py.get_data_filescs`|j�dg�|j�|g�}g�x:|D]2}ttj�|t|���}���fdd�|D��q&W�S)N�cs$g|]}|�krtj�|�r|�qSr)r3r#�isfile)r.�fn)�filesrrr1�s
z,build_py.find_data_files.<locals>.<listcomp>)r�getrr3r#r4r�extend)rrr:Zglobs�patternZfilelistr)r@rr7ys
zbuild_py.find_data_filescCshd}x^|jD]T\}}}}xF|D]>}tj�||�}|�tj�|��|jtj�||�|dd�qWqWdS)NF)�
preserve_mode)rr3r#r4�mkpath�dirname�	copy_file)rZlastdirrr:r;r<�filename�targetrrrr(�s
zbuild_py.build_package_datacCs�|�d�}|js&|r tjj|�SdSn�g}x�|r�y|jd�|�}Wn*tk
rn|�d|d�|d=Yq,X|�d|�tjj|�Sq,W|j�d�}|dk	r�|�d|�|r�tjj|�SdSdS)Nr,r=r���)r5rr3r#r4�KeyError�insertrA)rrr#�tailZpdirrrrr2�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))	r3r#�existsZDistutilsFileError�isdirr4r>r�warn)rrr�init_pyrrr�
check_package�s
zbuild_py.check_packagecCs&tj�|�st�d||�dSdSdS)Nz!file %s (for module %s) not foundFT)r3r#r>rrP)r�module�module_filerrr�check_module�szbuild_py.check_modulec	Cs�|�||�ttj�|d��}g}tj�|jj�}xX|D]P}tj�|�}||krztj�tj�	|��d}|�
|||f�q8|�d|�q8W|S)Nz*.pyrzexcluding %s)rRrr3r#r4�abspathrZscript_name�splitext�basenamer8Zdebug_print)	rrrZmodule_files�modulesZsetup_scriptrZabs_frSrrr�find_package_modules�s
zbuild_py.find_package_modulesc	Cs�i}g}x�|jD]�}|�d�}d�|dd��}|d}y||\}}Wn"tk
rj|�|�}d}YnX|s�|�||�}	|df||<|	r�|�|d|	f�tj�||d�}
|�	||
�s�q|�|||
f�qW|S)Nr,rrJr-�__init__z.py)
rr5r4rKr2rRr8r3r#rU)rrrYrSr#rZmodule_baser�checkedrQrTrrr�find_modules�s*


zbuild_py.find_modulescCsRg}|jr|�|���|jrNx.|jD]$}|�|�}|�||�}|�|�q&W|S)N)rrBr]rr2rZ)rrYrr�mrrr�find_all_moduless
zbuild_py.find_all_modulescCsdd�|��D�S)NcSsg|]}|d�qS)rJr)r.rSrrrr1-sz-build_py.get_source_files.<locals>.<listcomp>)r_)rrrr�get_source_files,szbuild_py.get_source_filescCs$|gt|�|dg}tjj|�S)Nz.py)�listr3r#r4)rr;rrSZoutfile_pathrrr�get_module_outfile/szbuild_py.get_module_outfiler-cCs�|��}g}xx|D]p\}}}|�d�}|�|j||�}|�|�|r|jr`|�tjj|dd��|j	dkr|�tjj||j	d��qW|dd�|j
D�7}|S)Nr,r=)�optimizationrcSs,g|]$\}}}}|D]}tj�||��qqSr)r3r#r4)r.rr:r;r<rHrrrr1Cs
z(build_py.get_outputs.<locals>.<listcomp>)r_r5rbrr8r
�	importlib�util�cache_from_sourcerr)rr%rYZoutputsrrSrTrHrrrr*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 tupler)rD)
r�strr5ra�tuple�	TypeErrorrbrr3r#rFrErG)rrSrTrZoutfile�dirrrr�build_moduleJs

zbuild_py.build_modulecCs.|��}x |D]\}}}|�|||�qWdS)N)r]rk)rrYrrSrTrrrr&Yszbuild_py.build_modulescCsLxF|jD]<}|�|�}|�||�}x |D]\}}}|�|||�q(WqWdS)N)rr2rZrk)rrrrYZpackage_rSrTrrrr'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)rJ)rr
�prefix�dry_run)�sys�dont_write_bytecoderP�distutils.utilr)rr3�sepr
r
rmr)rr@r)rlrrrr)vs


zbuild_py.byte_compileN)r-)�__name__�
__module__�__qualname__�descriptionZuser_optionsZboolean_optionsZnegative_optrr$r+rr7r(r2rRrUrZr]r_r`rbr*rkr&r'r)rrrrrs6


'4
	rc@seZdZdd�Zdd�ZdS)�
build_py_2to3cCsLg|_|jr|��|jr*|��|��|�|j�|�|jdd��dS)Nr)r%)	�
updated_filesrr&rr'r(Zrun_2to3r)r*)rrrrr+�szbuild_py_2to3.runcCs,t�||||�}|dr(|j�|d�|S)Nr-r)rrkrwr8)rrSrTrZresrrrrk�szbuild_py_2to3.build_moduleN)rrrsrtr+rkrrrrrv�srv)r3�importlib.utilrdrnrZdistutils.corerZdistutils.errorsrprrZ	distutilsrrrvrrrr�<module>s}

Hacked By AnonymousFox1.0, Coded By AnonymousFox