Your IP : 3.133.136.95


Current Path : /lib/python3.8/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/command/__pycache__/build_py.cpython-38.pyc

U

�Qab|%�@s�ddlmZddlmZddlmmZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlmZddlmZmZmZzddlmZWn"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.8/site-packages/setuptools/command/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.
    cCsFtj�|�|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_optionscCsx|js|jsdS|jr|��|jr4|��|��|�|jd�|�|jd�|�|jd�|�t	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_outputsrr	r	r�run+szbuild_py.runcCs&|dkr|��|_|jStj�||�S)zlazily compute data filesr)�_get_data_filesrrr�__getattr__)r
�attrr	r	rr ?s
zbuild_py.__getattr__cCsJtjrt|tj�r|�d�}tj�||||�\}}|rB|j�	|�||fS)N�.)
rZPY2�
isinstanceZstring_types�splitrr�build_moduler�append)r
�moduleZmodule_file�packageZoutfile�copiedr	r	rr%Fs
�zbuild_py.build_modulecCs|��tt|j|jpd��S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuplesr	)�analyze_manifest�listr�_get_pkg_data_filesrrr	r	rrPszbuild_py._get_data_filescsJ|�|��tjj|jg|�d��}�fdd�|�|��D�}|�||fS)Nr"csg|]}tj�|���qSr	)�os�path�relpath)�.0�file��src_dirr	r�
<listcomp>]s�z0build_py._get_pkg_data_files.<locals>.<listcomp>)�get_package_dirr-r.�joinZ	build_libr$�find_data_files)r
r(�	build_dir�	filenamesr	r2rr,Us


�zbuild_py._get_pkg_data_filescCsX|�|j||�}tt|�}tj�|�}ttj	j
|�}t�|j�|g�|�}|�
|||�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(r3�patternsZglobs_expandedZ
globs_matchesZ
glob_filesrr	r	rr7cs�
�zbuild_py.find_data_filesc
Cs�|jD]|\}}}}|D]j}tj�||�}|�tj�|��tj�||�}|�||�\}}	tj�|�}|	r||jj	kr|j
�|�qqdS)z$Copy data files into build directoryN)rr-r.r6Zmkpath�dirnameZ	copy_file�abspathrZconvert_2to3_doctestsrr&)
r
r(r3r8r9�filename�targetZsrcfileZoutfr)r	r	rrts
�zbuild_py.build_package_datacCs�i|_}|jjsdSi}|jp"dD]}||t|�|��<q$|�d�|�d�}|jj	D]�}t
j�t|��\}}d}|}	|r�||kr�||kr�|}t
j�|�\}}
t
j�
|
|�}qx||krX|�d�r�||	kr�qX|�||g��|�qXdS)Nr	Zegg_infoz.py)r?rZinclude_package_datar�assert_relativer5Zrun_commandZget_finalized_commandZfilelistrr-r.r$r6�endswith�
setdefaultr&)r
ZmfZsrc_dirsr(Zei_cmdr.�d�f�prevZoldfZdfr	r	rr*�s(


zbuild_py.analyze_manifestcCsdS�Nr	rr	r	r�get_data_files�szbuild_py.get_data_filesc	Cs�z|j|WStk
r YnXtj�|||�}||j|<|rH|jjsL|S|jjD]}||ksn|�|d�rTqxqT|St�	|d��}|�
�}W5QRXd|kr�tj�
d|f��|S)z8Check namespace packages' __init__ for declare_namespacer"�rbsdeclare_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_pyZpkgrK�contentsr	r	rrR�s*
��zbuild_py.check_packagecCsi|_tj�|�dSrM)rPrr�initialize_optionsrr	r	rrZ�szbuild_py.initialize_optionscCs0tj�||�}|jjdk	r,tj�|jj|�S|SrM)rrr5rZsrc_rootr-r.r6)r
r(�resr	r	rr5�szbuild_py.get_package_dircs\t���|�|j||�}�fdd�|D�}tj�|�}t|���fdd��D�}tt|��S)z6Filter filenames for package's data files in 'src_dir'c3s|]}t��|�VqdSrM)�fnmatchr�r0�pattern)rr	r�	<genexpr>�s�z.build_py.exclude_data_files.<locals>.<genexpr>c3s|]}|�kr|VqdSrMr	)r0�fn)�badr	rr_�s�)r+r:rr;r<r=�set�_unique_everseen)r
r(r3rrBZmatch_groupsZmatchesZkeepersr	)rarrrA�s�
�
�zbuild_py.exclude_data_filescs.t�|�dg�|�|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 |]}tj��t|��VqdSrM)r-r.r6rr]r2r	rr_�s�z2build_py._get_platform_patterns.<locals>.<genexpr>)r;r<r@)�specr(r3Zraw_patternsr	r2rr:�s

�
�zbuild_py._get_platform_patternsN)rrr�__doc__rrr r%rr,r7rr*rNrRrZr5rA�staticmethodr:r	r	r	rrs"	


rccsbt�}|j}|dkr6t|j|�D]}||�|Vq n(|D]"}||�}||kr:||�|Vq:dS)zHList unique elements, preserving order. Remember all elements ever seen.N)rb�addr�__contains__)�iterable�key�seenZseen_addZelement�kr	r	rrc�s
rccCs:tj�|�s|Sddlm}t�d���|}||��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.errorsrn�textwrap�dedent�lstrip)r.rn�msgr	r	rrGs�rG)N)rZdistutils.utilrZdistutils.command.build_pyZcommandrrr-r\rqrTrprWr;Zsetuptools.externrZsetuptools.extern.six.movesrrrZsetuptools.lib2to3_exr�ImportErrorrcrGr	r	r	r�<module>s$Y


?>