관리-도구
편집 파일: setuptools_ext.cpython-39.pyc
a �����`�"����������������������@���sl���d�dl�Z�d�dlZze�W�n�ey.���eZY�n0�dd��Zdd��Zdd��Zdd ��Zd d��Z dd ��Z dd��ZdS�)�����Nc�����������������C���s���ddl�m}�||���d�S�)Nr���)�DistutilsSetupError)Zdistutils.errorsr���)�msgr�����r����9/usr/lib64/python3.9/site-packages/cffi/setuptools_ext.py�error ���s����r���c�����������������C���sT���t�|���}|���}W�d�����n1�s&0����Y��|d7�}t||�d�}t|||��d�S�)N� �exec)�open�read�compiler���)�filename�glob�f�src�coder���r���r����execfile���s ���� &r���c����������� ������C���s���ddl�m}�t|t�s*tdt|�jf���t|�}z|�d�\}}W�n �t yd���td|f���Y�n0�t j�|�s�d}|� dd�d �}t j�|�r�d |d�|�f�}td||f���d|d �}t||��z||�}W�n"�ty����td||f���Y�n0�t||��s |��}t||��s,td|t|�jf���t|d��sFtd|f���|j\} } }}|j�rn|���}|�|��| d�u��r�t|�|| ��nt|�|| | ||��d�S�)Nr���)�FFIzEargument to 'cffi_modules=...' must be a str or a list of str, not %r�:z3%r must be of the form 'path/build.py:ffi_variable'���.�/�.pyz (rewrite cffi_modules to [%r])z#%r does not name an existing file%sZ__cffi__)�__name__�__file__z!%r: object %r not found in modulez"%r is not an FFI instance (got %r)�_assigned_sourcez*%r: the set_source() method was not called)Zcffi.apir���� isinstance� basestringr����typer����str�split� ValueError�os�path�exists�replacer����KeyError�hasattrr���Z_windows_unicode�copyZ_apply_windows_unicode�_add_py_module� _add_c_module) �dist�mod_specr���Zbuild_file_nameZffi_var_name�extZ rewrittenZmod_vars�ffi�module_name�source�source_extension�kwdsr���r���r����add_cffi_module���sV���� �� � �� r2���c�����������������C���st���ddl�m}�d|vrpttd�sp|jrpddl}z(t|j�d�d��}|dkrRd|d<�W�n�t yn���d|d<�Y�n0�|S�) a7�� Add py_limited_api to kwds if setuptools >= 26 is in use. Do not alter the setting if it already exists. Setuptools takes care of ignoring the flag on Python 2 and PyPy. CPython itself should ignore the flag in a debugging version (by not listing .abi3.so in the extensions it supports), but it doesn't so far, creating troubles. That's why we check for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401) On Windows, with CPython <= 3.4, it's better not to use py_limited_api because virtualenv *still* doesn't copy PYTHON3.DLL on these versions. Recently (2020) we started shipping only >= 3.5 wheels, though. So we'll give it another try and set py_limited_api on Windows >= 3.5. r����� recompilerZpy_limited_apiZgettotalrefcountNr�������T) �cffir4���r&����sysZUSE_LIMITED_API� setuptools�int�__version__� partitionr ���)� Extensionr1���r4���r8���Zsetuptools_major_versionr���r���r����_set_py_limited_apiI���s�����r=���c����������� ��� ������s����ddl�m}�ddlm}�ddlm��ddlm��ddlm ��dg}|� |�dg����t||�}|f��|d �|���d�������� fd d� �|�j d�u�r�g�|�_ |�j ����|�j�d|���G�����fd d�d���} | |�jd<�d�S�)Nr���)r<����� build_ext��mkpath��logr3����$PLACEHOLDER�sources)�namerE���c��������������������s\���t�j�|�����}��d|����|���|d�ur:|����������|�}|sX��d��|S��Nzgenerating cffi module %rzalready up-to-date)r!���r"����join�infoZ make_c_source)Ztmpdir�pre_runZc_file�updated)r,���r-���rC���rA���r.���r4���r/���r0���r���r����make_modw���s���� z_add_c_module.<locals>.make_modr?���c�����������������������s���e�Zd�Z����fdd�ZdS�)z)_add_c_module.<locals>.build_ext_make_modc��������������������s:����j�d�dkr,t|�dd��}�|�j|��j�d<����|���d�S�)Nr���rD���rJ���)rE����getattrZ build_temp�run)�selfrJ����� base_classr,���rL���r���r���rN�������s����z-_add_c_module.<locals>.build_ext_make_mod.runN�r���� __module__�__qualname__rN���r���rP���r���r����build_ext_make_mod����s���rU���)N)Zdistutils.corer<����setuptools.command.build_extr?����distutils.dir_utilrA���� distutilsrC���r6���r4����extend�popr=���Zext_modules�append�cmdclass�get) r*���r-���r.���r/���r0���r1���r<���r?���Z allsourcesrU���r���) rQ���r,���r-���rC���rL���rA���r.���r4���r/���r0���r���r)���j���s ���� r)���c��������������������s����ddl�m��ddlm}�ddlm}�ddlm��ddlm �������fdd��|�j �d |���G�����fd d�d���}||�j d <�|�jd�u�r�g�|�_|�j� ���|�j �d|��G����fd d�d��}||�j d<�d�S�)Nr���r@���)�build_pyr>���rB���r3���c��������������������s>������d|�����tj�|���������|��}|s:���d��d�S�rG���)rI���r!���r"����dirnameZmake_py_source)Zpy_filerK���)r-���rC���rA���r.���r4���r���r����generate_mod����s ����z$_add_py_module.<locals>.generate_modr^���c�����������������������s*���e�Zd�Z����fdd�Z���fdd�ZdS�)z)_add_py_module.<locals>.build_py_make_modc��������������������sB�������|�����d�}|d��d7��<��tjj|�jg|�R�����d�S�)Nr������r���)rN���r���r!���r"���rH���Z build_lib)rO����module_path�rQ���r`���r.���r���r���rN�������s���� z-_add_py_module.<locals>.build_py_make_mod.runc��������������������s>���|�j�}z*|r �fdd�|D��|�_����|��W�||�_�S�||�_�0�d�S�)Nc��������������������s���g�|�]}|��kr|�qS�r���r���)�.0�m)r.���r���r���� <listcomp>����s����zN_add_py_module.<locals>.build_py_make_mod.get_source_files.<locals>.<listcomp>)� py_modules�get_source_files)rO���Zsaved_py_modules)rQ���r.���r���r���rh�������s���� �z:_add_py_module.<locals>.build_py_make_mod.get_source_filesN)r���rS���rT���rN���rh���r���rc���r���r����build_py_make_mod����s���ri���r?���c�����������������������s���e�Zd�Z����fdd�ZdS�)z*_add_py_module.<locals>.build_ext_make_modc��������������������sb�������|���|�jr^��d�}d�|d�d���}|��d�}|�|�}|d�d�}�tj�||���d�S�)Nr���ra���r^���r���)rN���Zinplacer���rH���Zget_finalized_commandZget_package_dirr!���r"���)rO���rb����packager^���Zpackage_dir� file_name��base_class_2r`���r.���r���r���rN�������s���� z._add_py_module.<locals>.build_ext_make_mod.runNrR���r���rl���r���r���rU�������s���rU���)rW���rA���Zsetuptools.command.build_pyr^���rV���r?���rX���rC���r6���r4���r\���r]���rg���r[���)r*���r-���r.���r^���r?���ri���rU���r���)rQ���rm���r-���r`���rC���rA���r.���r4���r���r(�������s���� r(���c�����������������C���s4���|dksJ��t�|t�r|g}|D�]}t|�|��q d�S�)N�cffi_modules)r���r���r2���)r*����attr�valueZcffi_moduler���r���r���rn�������s ���� rn���)r!���r7���r���� NameErrorr���r���r���r2���r=���r)���r(���rn���r���r���r���r����<module>���s��� -!.=