ok

Mini Shell

Direktori : /usr/lib64/python3.6/distutils/command/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/distutils/command/__pycache__/build_py.cpython-36.pyc

3


 \C�@s~dZddlZddlZddlZddlmZddlmZddlTddl	m
Z
mZddlm
Z
Gdd	�d	e�ZGd
d�dee�ZdS)zHdistutils.command.build_py

Implements the Distutils 'build_py' command.�N)�glob)�Command)�*)�convert_path�	Mixin2to3)�logc@s�eZdZdZd8d9d:d;d<gZddgZddiZdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd=d.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd	S)>�build_pyz5"build" pure Python modules (copy to build directory)�
build-lib=�d�directory to "build" (copy) to�compile�c�compile .py to .pyc�
no-compileN�!don't compile .py files [default]�	optimize=�O�lalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]�force�f�2forcibly build everything (ignore file timestamps)cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr)�	build_lib�
py_modules�package�package_data�package_dirr�optimizer)�self�r�2/usr/lib64/python3.6/distutils/command/build_py.py�initialize_options szbuild_py.initialize_optionscCs�|jddd�|jj|_|jj|_|jj|_i|_|jjrbx&|jjj�D]\}}t|�|j|<qHW|j�|_	t
|jt�s�y.t|j�|_d|jko�dkns�t
�Wn tt
fk
r�td��YnXdS)	NZbuildrrr�zoptimize must be 0, 1, or 2)rr)rr)Zset_undefined_options�distribution�packagesrrr�itemsr�get_data_files�
data_files�
isinstancer�int�AssertionError�
ValueErrorZDistutilsOptionError)r�name�pathrrr�finalize_options*s"



"zbuild_py.finalize_optionscCs:|jr|j�|jr$|j�|j�|j|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}|j|�}tjj|jg|jd��}d�|rRt|�d��fdd�|j||�D�}|j	||||f�qW|S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples�.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)r9rr%as
zbuild_py.get_data_filescs`|jjdg�|jj|g�}g�x:|D]2}ttjj|t|���}�j�fdd�|D��q&W�S)z6Return filenames for package's data files in 'src_dir'�cs$g|]}|�krtjj|�r|�qSr)r<r,�isfile)r7�fn)�filesrrr:�s
z,build_py.find_data_files.<locals>.<listcomp>)r�getrr<r,r=r�extend)rrrCZglobs�patternZfilelistr)rIrr@ys
zbuild_py.find_data_filescCshd}x^|jD]T\}}}}xF|D]>}tjj||�}|jtjj|��|jtjj||�|dd�qWqWdS)z$Copy data files into build directoryNF)�
preserve_mode)r&r<r,r=�mkpath�dirname�	copy_file)rZlastdirrrCrDrE�filename�targetrrrr1�s
zbuild_py.build_package_datacCs�|jd�}|js&|r tjj|�SdSn�g}x�|r�y|jdj|�}Wn*tk
rn|jd|d�|d=Yq,X|jd|�tjj|�Sq,W|jjd�}|dk	r�|jd|�|r�tjj|�SdSdS)z�Return the directory, relative to the top of the source
           distribution, where package 'package' should be found
           (at least according to the 'package_dir' option, if any).r5rFrr6N���rS)r>rr<r,r=�KeyError�insertrJ)rrr,�tailZpdirrrrr;�s(
	zbuild_py.get_package_dircCsj|dkr8tjj|�s td|��tjj|�s8td|��|rftjj|d�}tjj|�rZ|Stjd|�dS)NrFz%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz__init__.pyz!package init file '%s' not found z(or not a regular file)z8package init file '%s' not found (or not a regular file))	r<r,�existsZDistutilsFileError�isdirr=rGr�warn)rrr�init_pyrrr�
check_package�s
zbuild_py.check_packagecCs&tjj|�stjd||�dSdSdS)Nz!file %s (for module %s) not foundFT)r<r,rGrrY)r�module�module_filerrr�check_module�szbuild_py.check_modulec	Cs�|j||�ttjj|d��}g}tjj|jj�}xX|D]P}tjj|�}||krztjjtjj	|��d}|j
|||f�q8|jd|�q8W|S)Nz*.pyrzexcluding %s)r[rr<r,r=�abspathr"Zscript_name�splitext�basenamerAZdebug_print)	rrrZmodule_files�modulesZsetup_scriptrZabs_fr\rrr�find_package_modules�s
zbuild_py.find_package_modulesc
Cs�i}g}x�|jD]�}|jd�}dj|dd��}|d}y||\}}Wn"tk
rj|j|�}d}YnX|s�|j||�}	|df||<|	r�|j|d|	f�tjj||d�}
|j	||
�s�q|j|||
f�qW|S)a�Finds individually-specified Python modules, ie. those listed by
        module name in 'self.py_modules'.  Returns a list of tuples (package,
        module_base, filename): 'package' is a tuple of the path through
        package-space to the module; 'module_base' is the bare (no
        packages, no dots) module name, and 'filename' is the path to the
        ".py" file (relative to the distribution root) that implements the
        module.
        r5rr6�__init__z.pyrSrS)
rr>r=rTr;r[rAr<r,r^)rr#rbr\r,rZmodule_baserZcheckedrZr]rrr�find_modules�s*


zbuild_py.find_modulescCsRg}|jr|j|j��|jrNx.|jD]$}|j|�}|j||�}|j|�q&W|S)a4Compute the list of all modules that will be built, whether
        they are specified one-module-at-a-time ('self.py_modules') or
        by whole packages ('self.packages').  Return a list of tuples
        (package, module, module_file), just like 'find_modules()' and
        'find_package_modules()' do.)rrKrer#r;rc)rrbrr�mrrr�find_all_moduless
zbuild_py.find_all_modulescCsdd�|j�D�S)NcSsg|]}|d�qS)r6rSr)r7r\rrrr:-sz-build_py.get_source_files.<locals>.<listcomp>)rg)rrrr�get_source_files,szbuild_py.get_source_filescCs$|gt|�|dg}tjj|�S)Nz.py)�listr<r,r=)rrDrr\Zoutfile_pathrrr�get_module_outfile/szbuild_py.get_module_outfiler6cCs�|j�}g}xx|D]p\}}}|jd�}|j|j||�}|j|�|r|jr`|jtjj|dd��|j	dkr|jtjj||j	d��qW|dd�|j
D�7}|S)Nr5rF)�optimizationrcSs,g|]$\}}}}|D]}tjj||��qqSr)r<r,r=)r7rrCrDrErQrrrr:Cs
z(build_py.get_outputs.<locals>.<listcomp>)rgr>rjrrAr�	importlib�util�cache_from_sourcerr&)rr.rbZoutputsrr\r]rQrrrr33s"




zbuild_py.get_outputscCsbt|t�r|jd�}nt|ttf�s,td��|j|j||�}tj	j
|�}|j|�|j||dd�S)Nr5z:'package' must be a string (dot-separated), list, or tupler)rM)
r'�strr>ri�tuple�	TypeErrorrjrr<r,rOrNrP)rr\r]rZoutfile�dirrrr�build_moduleJs

zbuild_py.build_modulecCs.|j�}x |D]\}}}|j|||�qWdS)N)rers)rrbrr\r]rrrr/Yszbuild_py.build_modulescCsXxR|jD]H}|j|�}|j||�}x,|D]$\}}}||ks>t�|j|||�q(WqWdS)N)r#r;rcr)rs)rrrrbZpackage_r\r]rrrr0bs

zbuild_py.build_packagescCs�tjr|jd�dSddlm}|j}|dtjkr>|tj}|jrZ||d|j	||j
d�|jdkr||||j|j	||j
d�dS)Nz%byte-compiling is disabled, skipping.r)r2r6)rr�prefix�dry_runrS)�sys�dont_write_bytecoderY�distutils.utilr2rr<�seprrrur)rrIr2rtrrrr2vs


zbuild_py.byte_compile)r	r
r)rr
r)rNr)rrr)rrr)r6)�__name__�
__module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optr r-r4r%r@r1r;r[r^rcrergrhrjr3rsr/r0r2rrrrrs8


'4
	rc@seZdZdd�Zdd�ZdS)�
build_py_2to3cCsLg|_|jr|j�|jr*|j�|j�|j|j�|j|jdd��dS)Nr)r.)	�
updated_filesrr/r#r0r1Zrun_2to3r2r3)rrrrr4�szbuild_py_2to3.runcCs,tj||||�}|dr(|jj|d�|S)Nr6r)rrsr~rA)rr\r]r�resrrrrs�szbuild_py_2to3.build_moduleN)rzr{r|r4rsrrrrr}�sr})�__doc__r<�importlib.utilrlrvrZdistutils.corerZdistutils.errorsrxrrZ	distutilsrrr}rrrr�<module>s}

Zerion Mini Shell 1.0