§
    ƒnócš  ã                  óŽ   — d dl mZ 	 d dlZddlmZ ddlmZmZm	Z	 ddl
mZ ej        rddlmZmZ dd	lmZ  G d
„ de¦  «        ZdS )é    )ÚannotationsNé   )Úcoredata)ÚEnvironmentExceptionÚ	OptionKeyÚversion_compareé   )ÚCompiler)ÚMutableKeyedOptionDictTypeÚKeyedOptionDictType)ÚEnvironmentc                  óŒ   ‡ — e Zd ZdZdZdZd"d„Zd#d„Zd#d„Zd$d„Z	d%d„Z
d&d„Zd'd„Zd(d„Zd)d„Zd#d„Zd*d„Zd+ˆ fd„Zd,d!„Zˆ xZS )-ÚCythonCompilerzCython Compiler.ÚcythonÚreturnÚboolc                ó   — dS )NF© ©Úselfs    ú=/usr/lib/python3/dist-packages/mesonbuild/compilers/cython.pyÚneeds_static_linkerz"CythonCompiler.needs_static_linker   s   € àˆuó    úT.List[str]c                ó   — dgS )Nz--fast-failr   r   s    r   Úget_always_argszCythonCompiler.get_always_args   s
   € ØˆÐr   c                ó   — dgS )Nz-Werrorr   r   s    r   Úget_werror_argszCythonCompiler.get_werror_args    s
   € Øˆ{Ðr   Ú
outputnameÚstrc                ó
   — d|gS )Nz-or   )r   r   s     r   Úget_output_argszCythonCompiler.get_output_args#   s   € Ø�jÐ!Ð!r   Úoptimization_levelc                ó   — g S ©Nr   )r   r#   s     r   Úget_optimization_argsz$CythonCompiler.get_optimization_args&   s	   € ð ˆ	r   Ú	outtargetÚoutfilec                ó6   — t          | j        d¦  «        rdgS g S )Nz	>=0.29.33z-M)r   Úversion)r   r'   r(   s      r   Úget_dependency_gen_argsz&CythonCompiler.get_dependency_gen_args+   s"   € Ý˜4œ<¨Ñ5Ô5ð 	Ø�6ˆMØˆ	r   c                ó   — dS )NÚdepr   r   s    r   Úget_depfile_suffixz!CythonCompiler.get_depfile_suffix0   s   € Øˆur   Úwork_dirÚenvironmentú'Environment'ÚNonec                óº   — d}|                       ||j        ¦  «        5 }|j        dk    rt          d| j        ›d�¦  «        ‚	 d d d ¦  «         d S # 1 swxY w Y   d S )Nzprint("hello world")r   zCython compiler z cannot compile programs)Úcached_compiler   Ú
returncoder   Úid)r   r/   r0   ÚcodeÚps        r   Úsanity_checkzCythonCompiler.sanity_check3   sÂ   € Ø%ˆØ× Ò   {Ô';Ñ<Ô<ð 	cÀØŒ|˜qÒ Ð Ý*Ð+a¸d¼gÐ+aÐ+aÐ+aÑbÔbÐbð !ð	cð 	cð 	cñ 	cô 	cð 	cð 	cð 	cð 	cð 	cð 	cð 	cøøøð 	cð 	cð 	cð 	cð 	cð 	cs   ž$AÁAÁAÚ	buildtypec                ó   — g S r%   r   )r   r:   s     r   Úget_buildtype_argsz!CythonCompiler.get_buildtype_args9   ó   € àˆ	r   c                ó   — g S r%   r   r   s    r   Úget_pic_argszCythonCompiler.get_pic_args=   r=   r   Úparameter_listÚ	build_dirc                ó>   — g }|D ]}|                      |¦  «         Œ|S r%   )Úappend)r   r@   rA   ÚnewÚis        r   Ú&compute_parameters_with_absolute_pathsz5CythonCompiler.compute_parameters_with_absolute_pathsA   s,   € àˆØð 	ð 	ˆAØ�JŠJ�q‰MŒMˆMˆMàˆ
r   ú'MutableKeyedOptionDictType'c           
     ó:  •— t          ¦   «                              ¦   «         }|                     t          d| j        | j        ¬¦  «        t          j        dddgd¦  «        t          d| j        | j        ¬¦  «        t          j        ddd	gd¦  «        i¦  «         |S )
Nr*   ©ÚmachineÚlangzPython version to targetÚ2Ú3ÚlanguagezOutput C or C++ filesÚcÚcpp)ÚsuperÚget_optionsÚupdater   Úfor_machinerN   r   ÚUserComboOption)r   ÚoptsÚ	__class__s     €r   rR   zCythonCompiler.get_optionsI   s¨   ø€ Ý‰wŒw×"Ò"Ñ$Ô$ˆØ�ŠÝ�i¨Ô)9ÀÄÐNÑNÔNÕPXÔPhØ*Ø�c�
ØñQô Qõ
 �j¨$Ô*:ÀÄÐOÑOÔOÕQYÔQiØ'Ø�e�ØñRô Rð
ñ 	ô 	ð 	ð ˆr   Úoptionsú'KeyedOptionDictType'c                ó  — g }|t          d| j        | j        ¬¦  «                 }|                     d|j        › �¦  «         |t          d| j        | j        ¬¦  «                 }|j        dk    r|                     d¦  «         |S )Nr*   rI   ú-rN   rP   z--cplus)r   rT   rN   rC   Úvalue)r   rX   ÚargsÚkeyrK   s        r   Úget_option_compile_argsz&CythonCompiler.get_option_compile_argsY   s�   € ØˆØ•i 	°4Ô3CÈ$Ì-ÐXÑXÔXÔYˆØ�Š�O˜œ	�O�OÑ$Ô$Ð$Ø•y °TÔ5EÈDÌMÐZÑZÔZÔ[ˆØŒ:˜ÒÐØ�KŠK˜	Ñ"Ô"Ð"Øˆr   )r   r   )r   r   )r   r    r   r   )r#   r    r   r   )r'   r    r(   r    r   r   )r   r    )r/   r    r0   r1   r   r2   )r:   r    r   r   )r@   r   rA   r    r   r   )r   rG   )rX   rY   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rN   r6   r   r   r   r"   r&   r+   r.   r9   r<   r?   rF   rR   r_   Ú__classcell__)rW   s   @r   r   r      sA  ø€ € € € € àÐà€HØ	€Bðð ð ð ðð ð ð ðð ð ð ð"ð "ð "ð "ðð ð ð ð
ð ð ð ð
ð ð ð ðcð cð cð cðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ð ð ð ð ð ð ð ð ð r   r   )Ú
__future__r   ÚtypingÚTÚ r   Úmesonlibr   r   r   Ú	compilersr
   ÚTYPE_CHECKINGr   r   r0   r   r   r   r   r   ú<module>rl      sÜ   ðð #Ð "Ð "Ð "Ð "Ð "à 0à Ð Ð Ð à Ð Ð Ð Ð Ð Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ Ð Ð Ð Ð Ð à„?ð *ØJÐJÐJÐJÐJÐJÐJÐJØ)Ð)Ð)Ð)Ð)Ð)ðNð Nð Nð Nð N�Xñ Nô Nð Nð Nð Nr   