Your IP : 3.135.241.191


Current Path : /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/setuptools/command/__pycache__/build_py.cpython-36.pyc

3

9��f|%�
@s�ddlmZddlmZddljjZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlmZddlmZmZmZyddlmZWn"ek
r�Gdd�d�ZYnXGd	d
�d
eje�Zddd�Zd
d�ZdS)�)�glob)�convert_pathN)�six)�map�filter�filterfalse)�	Mixin2to3c@seZdZddd�ZdS)rTcCsdS)z
do nothingN�)�self�filesZdoctestsr	r	�/usr/lib/python3.6/build_py.py�run_2to3szMixin2to3.run_2to3N)T)�__name__�
__module__�__qualname__r
r	r	r	rrsrc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zedd��Zd S)!�build_pyaXEnhanced 'build_py' command that includes data files with packages

    The data files are specified via a 'package_data' argument to 'setup()'.
    See 'setuptools.dist.Distribution' for more details.

    Also, this version of the 'build_py' command allows you to specify both
    'py_modules' and 'packages' in the same setup operation.
    cCsFtjj|�|jj|_|jjp i|_d|jkr6|jd=g|_g|_dS)N�
data_files)	�origr�finalize_options�distribution�package_data�exclude_package_data�__dict__�_build_py__updated_files�_build_py__doctests_2to3)r
r	r	rr!s

zbuild_py.finalize_optionscCs||jr|jrdS|jr"|j�|jr8|j�|j�|j|jd�|j|jd�|j|jd�|jt	j
j|dd��dS)z?Build modules, packages, and copy data files to build directoryNFTr)Zinclude_bytecode)Z
py_modules�packagesZ
build_modulesZbuild_packages�build_package_datar
rrZbyte_compilerrZget_outputs)r
r	r	r�run+szbuild_py.runcCs&|dkr|j�|_|jStjj||�S)zlazily compute data filesr)�_get_data_filesrrr�__getattr__)r
�attrr	r	rr?s
zbuild_py.__getattr__cCsJtjrt|tj�r|jd�}tjj||||�\}}|rB|jj	|�||fS)N�.)
rZPY2�
isinstanceZstring_types�splitrr�build_moduler�append)r
�moduleZmodule_file�packageZoutfile�copiedr	r	rr$Fs

zbuild_py.build_modulecCs|j�tt|j|jpf��S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples)�analyze_manifest�listr�_get_pkg_data_filesr)r
r	r	rrPszbuild_py._get_data_filescsJ|j|��tjj|jg|jd��}�fdd�|j|��D�}|�||fS)Nr!csg|]}tjj|���qSr	)�os�path�relpath)�.0�file)�src_dirr	r�
<listcomp>^sz0build_py._get_pkg_data_files.<locals>.<listcomp>)�get_package_dirr,r-�joinZ	build_libr#�find_data_files)r
r'�	build_dir�	filenamesr	)r1rr+Us


zbuild_py._get_pkg_data_filescCsX|j|j||�}tt|�}tjj|�}ttj	j
|�}tj|jj|g�|�}|j
|||�S)z6Return filenames for package's data files in 'src_dir')�_get_platform_patternsrrr�	itertools�chain�
from_iterablerr,r-�isfile�manifest_files�get�exclude_data_files)r
r'r1�patternsZglobs_expandedZ
globs_matchesZ
glob_filesrr	r	rr5cs
zbuild_py.find_data_filesc
Cs�x�|jD]�\}}}}xr|D]j}tjj||�}|jtjj|��tjj||�}|j||�\}}	tjj|�}|	r||jj	kr|j
j|�qWqWdS)z$Copy data files into build directoryN)rr,r-r4Zmkpath�dirnameZ	copy_file�abspathrZconvert_2to3_doctestsrr%)
r
r'r1r6r7�filename�targetZsrcfileZoutfr(r	r	rrts
zbuild_py.build_package_datacCs�i|_}|jjsdSi}x$|jp$fD]}||t|j|��<q&W|jd�|jd�}x�|jj	D]�}t
jjt|��\}}d}|}	x:|r�||kr�||kr�|}t
jj|�\}}
t
jj
|
|�}q�W||kr^|jd�r�||	kr�q^|j||g�j|�q^WdS)NZegg_infoz.py)r=rZinclude_package_datar�assert_relativer3Zrun_commandZget_finalized_commandZfilelistrr,r-r#r4�endswith�
setdefaultr%)r
ZmfZsrc_dirsr'Zei_cmdr-�d�f�prevZoldfZdfr	r	rr)�s(


zbuild_py.analyze_manifestcCsdS)Nr	)r
r	r	r�get_data_files�szbuild_py.get_data_filescCs�y
|j|Stk
rYnXtjj|||�}||j|<|sJ|jjrN|Sx,|jjD]}||ksr|j|d�rXPqXW|Stj	|d��}|j
�}WdQRXd|kr�tjj
d|f��|S)z8Check namespace packages' __init__ for declare_namespacer!�rbNsdeclare_namespacez�Namespace package problem: %s is a namespace package, but its
__init__.py does not call declare_namespace()! Please fix it.
(See the setuptools manual under "Namespace Packages" for details.)
")�packages_checked�KeyErrorrr�
check_packagerZnamespace_packages�
startswith�io�open�read�	distutils�errorsZDistutilsError)r
r'Zpackage_dirZinit_pyZpkgrI�contentsr	r	rrO�s&


zbuild_py.check_packagecCsi|_tjj|�dS)N)rMrr�initialize_options)r
r	r	rrW�szbuild_py.initialize_optionscCs0tjj||�}|jjdk	r,tjj|jj|�S|S)N)rrr3rZsrc_rootr,r-r4)r
r'�resr	r	rr3�szbuild_py.get_package_dircs\t���|j|j||�}�fdd�|D�}tjj|�}t|���fdd��D�}tt|��S)z6Filter filenames for package's data files in 'src_dir'c3s|]}tj�|�VqdS)N)�fnmatchr)r/�pattern)rr	r�	<genexpr>�sz.build_py.exclude_data_files.<locals>.<genexpr>c3s|]}|�kr|VqdS)Nr	)r/�fn)�badr	rr[�s)r*r8rr9r:r;�set�_unique_everseen)r
r'r1rr@Zmatch_groupsZmatchesZkeepersr	)r]rrr?�s

zbuild_py.exclude_data_filescs.tj|jdg�|j|g��}�fdd�|D�S)z�
        yield platform-specific path patterns (suitable for glob
        or fn_match) from a glob-based spec (such as
        self.package_data or self.exclude_package_data)
        matching package in src_dir.
        �c3s |]}tjj�t|��VqdS)N)r,r-r4r)r/rZ)r1r	rr[�sz2build_py._get_platform_patterns.<locals>.<genexpr>)r9r:r>)�specr'r1Zraw_patternsr	)r1rr8�s


zbuild_py._get_platform_patternsN)rrr�__doc__rrrr$rr+r5rr)rKrOrWr3r?�staticmethodr8r	r	r	rrs 


rccsjt�}|j}|dkr:xPt|j|�D]}||�|Vq"Wn,x*|D]"}||�}||kr@||�|Vq@WdS)zHList unique elements, preserving order. Remember all elements ever seen.N)r^�addr�__contains__)�iterable�key�seenZseen_add�element�kr	r	rr_�s
r_cCs:tjj|�s|Sddlm}tjd�j�|}||��dS)Nr)�DistutilsSetupErrorz�
        Error: setup script specifies an absolute path:

            %s

        setup() arguments must *always* be /-separated paths relative to the
        setup.py directory, *never* absolute paths.
        )r,r-�isabs�distutils.errorsrk�textwrap�dedent�lstrip)r-rk�msgr	r	rrEsrE)N)rZdistutils.utilrZdistutils.command.build_pyZcommandrrr,rYrnrQrmrTr9Zsetuptools.externrZsetuptools.extern.six.movesrrrZsetuptools.lib2to3_exr�ImportErrorr_rEr	r	r	r�<module>s$Y


?>