U
    ªÃT_Á  ã                   @   s|   d dl Z d dlZd dlZd dlZd dlZd dlmZ ddlm	Z	 dd„ Z
e
Ze	ejjƒZG dd„ deƒZG d	d
„ d
eƒZdS )é    N)Úmapé   )Úget_unpatchedc                  C   s4   d} zt | dgd�j W dS  tk
r.   Y nX dS )z0
    Return True if Cython can be imported.
    zCython.Distutils.build_extÚ	build_ext)ÚfromlistTF)Ú
__import__r   Ú	Exception)Zcython_impl© r	   ú8/tmp/pip-unpacked-wheel-sr6cxcdi/setuptools/extension.pyÚ_have_cython   s    r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )Ú	Extensionz7Extension that uses '.c' files in place of '.pyx' filesc                 O   s(   |  dd¡| _tj| ||f|ž|Ž d S )NÚpy_limited_apiF)Úpopr   Ú
_ExtensionÚ__init__)ÚselfÚnameÚsourcesÚargsÚkwr	   r	   r
   r   #   s    zExtension.__init__c                 C   sN   t ƒ r
dS | jpd}| ¡ dkr$dnd}t tjd|¡}tt|| j	ƒƒ| _	dS )zÜ
        Replace sources with .pyx extensions to sources with the target
        language extension. This mechanism allows language authors to supply
        pre-converted sources but to prefer the .pyx sources.
        NÚ zc++z.cppz.cz.pyx$)
r   ÚlanguageÚlowerÚ	functoolsÚpartialÚreÚsubÚlistr   r   )r   ÚlangZ
target_extr   r	   r	   r
   Ú_convert_pyx_sources_to_lang)   s    
z&Extension._convert_pyx_sources_to_langN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r	   r	   r	   r
   r       s   r   c                   @   s   e Zd ZdZdS )ÚLibraryz=Just like a regular Extension, but built as a library insteadN)r    r!   r"   r#   r	   r	   r	   r
   r$   8   s   r$   )r   r   Údistutils.coreÚ	distutilsÚdistutils.errorsÚdistutils.extensionZsetuptools.extern.six.movesr   Zmonkeyr   r   Z
have_pyrexÚcorer   r   r$   r	   r	   r	   r
   Ú<module>   s   