
    -Ph                       U d dl m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lmZ ddlmZ ej        rdd	lmZ dd
lmZ ddlmZ ddlmZ g g g dgdgdgdgdZded<    G d dee          Z G d de          Z G d de          ZdS )    )annotationsN   )EnvironmentException)RSPFileSyntax   )Compiler)BasicLinkerIsCompilerMixin)
Dependency)MachineInfo)Environment)MachineChoicez
-optimize+)plain0g123szT.Dict[str, T.List[str]]cs_optimization_argsc                       e Zd ZdZ	 d-d. fdZed/d            Zd0dZd0dZd1dZ	d1dZ
d0dZd0dZd2dZd3dZd4dZd5d!Zd6d&Zd7d(Zd8d*Zd9d,Z xZS ):
CsCompilercsNexelistT.List[str]versionstrfor_machiner   info'MachineInfo'runnerT.Optional[str]c                `    t                                          g ||||           || _        d S N)super__init__r    )selfr   r   r   r   r    	__class__s         W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/compilers/cs.pyr%   zCsCompiler.__init__%   s.    Wg{DAAA    returnc                    dS )NzC sharp )clss    r(   get_display_languagezCsCompiler.get_display_language*   s    yr)   c                    dgS Nz/nologor,   r&   s    r(   get_always_argszCsCompiler.get_always_args.   
    {r)   c                    dgS r0   r,   r1   s    r(   get_linker_always_argsz!CsCompiler.get_linker_always_args1   r3   r)   fnamec                    d|z   gS )Nz-out:r,   r&   r6   s     r(   get_output_argszCsCompiler.get_output_args4   s    %  r)   c                    d|z   gS )Nz-r:r,   r8   s     r(   get_link_argszCsCompiler.get_link_args7   s    r)   c                    dgS )Nz-warnaserrorr,   r1   s    r(   get_werror_argszCsCompiler.get_werror_args:   s    r)   c                    g S r#   r,   r1   s    r(   get_pic_argszCsCompiler.get_pic_args=       	r)   depr
   c                >    d |                                 D             S )Nc                <    g | ]}|                     d           |S )z-I)
startswith).0as     r(   
<listcomp>z:CsCompiler.get_dependency_compile_args.<locals>.<listcomp>D   s)    LLLad9K9KLLLLr)   )get_compile_args)r&   rA   s     r(   get_dependency_compile_argsz&CsCompiler.get_dependency_compile_args@   s%     ML3//11LLLLr)   parameter_list	build_dirc           
        t          |          D ]\  }}|d d         dk    rS|d d         t          j                            t          j                            ||dd                              z   ||<   |d d         dk    rS|d d         t          j                            t          j                            ||dd                              z   ||<   |S )Nr   z-L   z-lib:)	enumerateospathnormpathjoin)r&   rJ   rK   idxis        r(   &compute_parameters_with_absolute_pathsz1CsCompiler.compute_parameters_with_absolute_pathsF   s    // 	_ 	_FC!u}}&'ebg.>.>rw||IWXYZY[Y[W\?]?].^.^&^s#!u&'ebg.>.>rw||IWXYZY[Y[W\?]?].^.^&^s#r)   pch_dirheaderc                    g S r#   r,   )r&   rV   rW   s      r(   get_pch_use_argszCsCompiler.get_pch_use_argsP   r@   r)   header_namec                    dS )N r,   )r&   rZ   s     r(   get_pch_namezCsCompiler.get_pch_nameS   s    rr)   work_direnvironment'Environment'Nonec                   d}d}t           j                            ||          }t          |dd          5 }|                    t          j        d                     d d d            n# 1 swxY w Y   t          j        | j	        | 
                                z   |gz   |          }|                                 |j        dk    r$t          d	|                                 z            | j        r
| j        |g}n!t           j                            ||          g}t          j        ||          }	|	                                 |	j        dk    r$t          d
|                                 z            d S )Nz	sanity.csz
sanity.exewzutf-8)encodingz
                public class Sanity {
                    static public void Main () {
                    }
                }
                )cwdr   z'C# compiler %s cannot compile programs.z9Executables created by Mono compiler %s are not runnable.)rO   rP   rR   openwritetextwrapdedent
subprocessPopenr   r2   wait
returncoder   name_stringr    )
r&   r^   r_   srcobjsource_nameofilepccmdlistpes
             r(   sanity_checkzCsCompiler.sanity_checkV   s   gll8S11+sW555 	KK )     	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dlT-A-A-C-CCseKQYZZZ
			=A&'PSWScScSeSe'efff; 	4{C(GGw||Hc223Gg8444
			=A&'beieueuewew'wxxx s   (A++A/2A/boolc                    dS )NFr,   r1   s    r(   needs_static_linkerzCsCompiler.needs_static_linkern   s    ur)   is_debugc                    |rdgng S )N-debugr,   r&   rz   s     r(   get_debug_argszCsCompiler.get_debug_argsq   s    %-zz2-r)   optimization_levelc                    t           |         S r#   )r   )r&   r   s     r(   get_optimization_argsz CsCompiler.get_optimization_argst   s    #$677r)   r#   )
r   r   r   r   r   r   r   r   r    r!   )r*   r   )r*   r   )r6   r   r*   r   )rA   r
   r*   r   )rJ   r   rK   r   r*   r   )rV   r   rW   r   r*   r   )rZ   r   r*   r   )r^   r   r_   r`   r*   ra   )r*   rw   rz   rw   r*   r   )r   r   r*   r   )__name__
__module____qualname__languager%   classmethodr.   r2   r5   r9   r;   r=   r?   rI   rU   rY   r]   rv   ry   r~   r   __classcell__r'   s   @r(   r   r   !   s       H AE      
    [      ! ! ! !             M M M M         y y y y0   . . . .8 8 8 8 8 8 8 8r)   r   c                  ,     e Zd ZdZd fd
ZddZ xZS )MonoCompilermonor   r   r   r   r   r   r   r   c                T    t                                          ||||d           d S )Nr   )r    )r$   r%   )r&   r   r   r   r   r'   s        r(   r%   zMonoCompiler.__init__|   s,    ';VLLLLLr)   r*   'RSPFileSyntax'c                    t           j        S r#   )r   GCCr1   s    r(   rsp_file_syntaxzMonoCompiler.rsp_file_syntax   s      r)   )r   r   r   r   r   r   r   r   r*   r   )r   r   r   idr%   r   r   r   s   @r(   r   r   x   s\        	BM M M M M M! ! ! ! ! ! ! !r)   r   c                  "    e Zd ZdZd
dZddZd	S )VisualStudioCsCompilercscrz   rw   r*   r   c                H    |r| j                                         rdgndgS g S )Nr|   z-debug:portable)r   
is_windowsr}   s     r(   r~   z%VisualStudioCsCompiler.get_debug_args   s2     	!%!5!5!7!7PH::>O=PPIr)   r   c                    t           j        S r#   )r   MSVCr1   s    r(   r   z&VisualStudioCsCompiler.rsp_file_syntax   s    !!r)   Nr   r   )r   r   r   r   r~   r   r,   r)   r(   r   r      sA        	B   " " " " " "r)   r   )
__future__r   os.pathrO   rj   rh   typingTmesonlibr   linkersr   	compilersr   mixins.islinkerr	   TYPE_CHECKINGdependenciesr
   	envconfigr   r_   r   r   r   __annotations__r   r   r   r,   r)   r(   <module>r      s   # " " " " " "              + + + + + + # # # # # #       7 7 7 7 7 7? )))))))''''''))))))(((((( "$*^*^*^*^2 2     T8 T8 T8 T8 T8+X T8 T8 T8n	! 	! 	! 	! 	!: 	! 	! 	!" " " " "Z " " " " "r)   