관리-도구
편집 파일: build_py.cpython-39.opt-1.pyc
a �������f%����������������������@���s����d�dl�m�Z��d�dlmZ�d�dlm��mZ�d�dlZd�dlZd�dl Z d�dl Z d�dlZd�dl Z d�dlZzd�dlmZ�W�n �ey����G�dd��d�ZY�n0�dd��ZG�d d ��d eje�Zddd�Zd d��ZdS�)�����)�glob)�convert_pathN)� Mixin2to3c�������������������@���s���e�Zd�Zddd�ZdS�)r���Tc�����������������C���s���dS�)z do nothingN��)�self�filesZdoctestsr���r����?/usr/lib/python3.9/site-packages/setuptools/command/build_py.py�run_2to3���s����zMixin2to3.run_2to3N)T)�__name__� __module__�__qualname__r ���r���r���r���r���r������s���r���c�����������������C���s���t��|�t��|��jtjB���d�S��N)�os�chmod�stat�st_mode�S_IWRITE)�targetr���r���r���� make_writable���s����r���c�������������������@���s����e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d��Zdd ��Z dd��Z dd��Zdd��Zdd��Z dd��Zdd��Zdd��Zdd��Zedd���Zd S�)!�build_pyaX��Enhanced '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. c�����������������C���sF���t�j�|���|�jj|�_|�jjp i�|�_d|�jv�r6|�jd=�g�|�_g�|�_d�S�)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_optionsc�����������������C���sx���|�j�s|�jsdS�|�j�r|�����|�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 ���r���r���Zbyte_compiler���r���Zget_outputsr���r���r���r����run-���s����zbuild_py.runc�����������������C���s&���|dkr|�����|�_|�jS�tj�|�|�S�)zlazily compute data filesr���)�_get_data_filesr���r���r����__getattr__)r����attrr���r���r���r$���A���s���� zbuild_py.__getattr__c�����������������C���s.���t�j�|�|||�\}}|r&|�j�|��||fS�r ���)r���r����build_moduler����append)r����moduleZmodule_file�packageZoutfile�copiedr���r���r���r&���H���s�����zbuild_py.build_modulec�����������������C���s���|������tt|�j|�jpd��S�)z?Generate list of '(package,src_dir,build_dir,filenames)' tuplesr���)�analyze_manifest�list�map�_get_pkg_data_filesr ���r���r���r���r���r#���O���s����zbuild_py._get_data_filesc��������������������sJ���|���|���tjj|�jg|�d����}��fdd�|��|���D��}|��||fS�)N�.c��������������������s���g�|�]}t�j�|����qS�r���)r����path�relpath)�.0�file��src_dirr���r���� <listcomp>\���s����z0build_py._get_pkg_data_files.<locals>.<listcomp>)�get_package_dirr���r0����joinZ build_lib�split�find_data_files)r���r)���� build_dir� filenamesr���r4���r���r.���T���s���� �zbuild_py._get_pkg_data_filesc�����������������C���sX���|���|�j||�}tt|�}tj�|�}ttj j |�}t�|�j�|g��|�}|�� |||�S�)z6Return filenames for package's data files in 'src_dir')�_get_platform_patternsr���r-���r���� itertools�chain� from_iterable�filterr���r0����isfile�manifest_files�get�exclude_data_files)r���r)���r5����patternsZglobs_expandedZ globs_matchesZ glob_filesr���r���r���r���r:���b���s����� �zbuild_py.find_data_filesc����������� ������C���s����|�j�D�]�\}}}}|D�]r}tj�||�}|��tj�|���tj�||�}|��||�\}} t|��tj�|�}| r||�j j v�r|�j�|��qqdS�)z$Copy data files into build directoryN) r���r���r0���r8���Zmkpath�dirnameZ copy_filer����abspathr���Zconvert_2to3_doctestsr���r'���) r���r)���r5���r;���r<����filenamer���ZsrcfileZoutfr*���r���r���r���r!���s���s���� �zbuild_py.build_package_datac�����������������C���s����i��|�_�}|�jjsd�S�i�}|�jp"dD�]}||t|��|��<�q$|��d��|��d�}|jj D�]�}t j�t|��\}}d�}|} |r�||kr�||vr�|}t j�|�\}} t j� | |�}qx||v�rX|�d�r�|| kr�qX|�||�g���|��qXd�S�)Nr���Zegg_infoz.py)rC���r���Zinclude_package_datar ����assert_relativer7���Zrun_commandZget_finalized_commandZfilelistr���r���r0���r9���r8����endswith� setdefaultr'���)r���ZmfZsrc_dirsr)���Zei_cmdr0����d�f�prevZoldfZdfr���r���r���r+�������s(���� zbuild_py.analyze_manifestc�����������������C���s���d�S�r ���r���r���r���r���r����get_data_files����s����zbuild_py.get_data_filesc�����������������C���s����z|�j�|�W�S��ty���Y�n0�tj�|�||�}||�j�|<�|rF|�jjsJ|S�|�jjD�]}||ksl|�|d��rR�qvqR|S�t� |d��}|� ��}W�d����n1�s�0����Y��d|vr�tj� d|f���|S�)z8Check namespace packages' __init__ for declare_namespacer/����rbNs���declare_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�KeyErrorr���r���� check_packager���Znamespace_packages� startswith�io�open�read� distutils�errorsZDistutilsError)r���r)���Zpackage_dirZinit_py�pkgrN����contentsr���r���r���rT�������s*���� &��zbuild_py.check_packagec�����������������C���s���i�|�_�tj�|���d�S�r ���)rR���r���r����initialize_optionsr���r���r���r���r]�������s����zbuild_py.initialize_optionsc�����������������C���s0���t�j�|�|�}|�jjd�ur,tj�|�jj|�S�|S�r ���)r���r���r7���r���Zsrc_rootr���r0���r8���)r���r)����resr���r���r���r7�������s����zbuild_py.get_package_dirc��������������������s\���t����|��|�j||�}�fdd�|D��}tj�|�}t|�����fdd��D��}t�t|��S�)z6Filter filenames for package's data files in 'src_dir'c�����������������3���s���|�]}t����|�V��qd�S�r ���)�fnmatchrA����r2����pattern)r���r���r���� <genexpr>����s����z.build_py.exclude_data_files.<locals>.<genexpr>c�����������������3���s���|�]}|��vr|V��qd�S�r ���r���)r2����fn)�badr���r���rb�������s����)r,���r=���r���r>���r?���r@����set�_unique_everseen)r���r)���r5���r���rF���Zmatch_groups�matchesZkeepersr���)rd���r���r���rE�������s����� � �zbuild_py.exclude_data_filesc��������������������s.���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. ��c�����������������3���s ���|�]}t�j���t|��V��qd�S�r ���)r���r0���r8���r���r`���r4���r���r���rb�������s����z2build_py._get_platform_patterns.<locals>.<genexpr>)r>���r?���rD���)�specr)���r5���Zraw_patternsr���r4���r���r=�������s���� � �zbuild_py._get_platform_patternsN)r ���r���r����__doc__r���r"���r$���r&���r#���r.���r:���r!���r+���rP���rT���r]���r7���rE����staticmethodr=���r���r���r���r���r������s"��� r���c�����������������c���sd���t���}|j}|du�r8t�|j|��D�]}||��|V��q"n(|�D�]"}||�}||vr<||��|V��q<dS�)zHList unique elements, preserving order. Remember all elements ever seen.N)re����addr>����filterfalse�__contains__)�iterable�key�seenZseen_add�element�kr���r���r���rf�������s���� rf���c�����������������C���s:���t�j�|��s|�S�ddlm}�t�d����|��}||��d�S�)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���r0����isabs�distutils.errorsrt����textwrap�dedent�lstrip)r0���rt����msgr���r���r���rJ�����s�����rJ���)N)r���Zdistutils.utilr���Zdistutils.command.build_pyZcommandr���r���r���r_���rw���rV���rv���rY���r>���r���Zsetuptools.lib2to3_exr���� Exceptionr���rf���rJ���r���r���r���r����<module>���s$����W