
    ed                         d Z ddlZddlZddlmZ ddlmZ ddlmZ  G d dej	                  Z
edk    r ej                     dS dS )	z"Tests for distutils.unixccompiler.    N)EnvironmentVarGuard)	sysconfig)UnixCCompilerc                       e Zd Zd Zd Z ej        ej        dk    d          d             Z	 ej
        ej        dk    d          d             Z ej
        ej        dk    d          d	             Zd
S )UnixCCompilerTestCasec                     t           j        | _        t          j        | _        t          t          j                  | _         G d dt                    } |            | _
        d S )Nc                       e Zd Zd ZdS )4UnixCCompilerTestCase.setUp.<locals>.CompilerWrapperc                 ,    |                      d          S )Nz/foo)runtime_library_dir_optionselfs    4  /home/conda/feedstock_root/build_artifacts/python-split_1708115622739/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/distutils/tests/test_unixccompiler.py	rpath_fooz>UnixCCompilerTestCase.setUp.<locals>.CompilerWrapper.rpath_foo   s    66v>>>    N)__name__
__module____qualname__r    r   r   CompilerWrapperr
      s#        ? ? ? ? ?r   r   )sysplatform_backup_platformr   get_config_var_backup_get_config_vardict_config_vars_backup_config_varsr   cc)r   r   s     r   setUpzUnixCCompilerTestCase.setUp   si     #&/&>##'	(>#?#? 	? 	? 	? 	? 	?m 	? 	? 	? "/##r   c                     | j         t          _        | j        t          _        t          j                                         t          j                            | j	                   d S )N)
r   r   r   r   r   r   r   clearupdater   r   s    r   tearDownzUnixCCompilerTestCase.tearDown   sL    ,#'#>	 $$&&&%%d&>?????r   win32zcan't test on Windowsc                    dt           _        |                     | j                                        d           dt           _        t
          j        }d }|t
          _        |                     | j                                        ddg           d }|t
          _        |                     | j                                        ddg           d }|t
          _        |                     | j                                        ddg           |t
          _        d	t           _        d
 }|t
          _        |                     | j                                        d           d	t           _        d }|t
          _        |                     | j                                        d           d	t           _        d }|t
          _        |                     | j                                        d           d	t           _        d }|t
          _        |                     | j                                        d           d	t           _        d }|t
          _        |                     | j                                        d           d S )Ndarwinz-L/foozhp-uxc                     dS )Nxxxr   vs    r   gcvz=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcv(       5r   z+sc                     dS )Ngccr   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcv-   r-   r   z-Wl,+sc                     dS )Nzg++r   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcv2   r-   r   barc                 &    | dk    rdS | dk    rdS d S )NCCr/   GNULDyesr   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcv;   s%    Dyyugu r   z-Wl,--enable-new-dtags,-R/fooc                 &    | dk    rdS | dk    rdS d S )Nr3   r/   r4   nor   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcvE   s%    Dyyugt r   z
-Wl,-R/fooc                 &    | dk    rdS | dk    rdS d S )Nr3   zx86_64-pc-linux-gnu-gcc-4.4.2r4   r5   r   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcvP   s&    Dyy66gu r   c                 &    | dk    rdS | dk    rdS d S )Nr3   r   r4   r5   r   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcvZ   s%    Dyytgu r   z-R/fooc                 &    | dk    rdS | dk    rdS d S )Nr3   r   r4   r7   r   r*   s    r   r,   z=UnixCCompilerTestCase.test_runtime_libdir_option.<locals>.gcvd   s%    Dyytgt r   )r   r   assertEqualr   r   r   r   )r   old_gcvr,   s      r   test_runtime_libdir_optionz0UnixCCompilerTestCase.test_runtime_libdir_option   sn     **,,h777 *	 	 	#&	 **,,tX.>???	 	 	#&	 **,,x.BCCC	 	 	#&	 **,,x.BCCC#*	  	 	 	
 $'	 **,,.MNNN 	 	 	
 $'	 **,,l;;; 	 	 	
 $'	 **,,.MNNN 	 	 	
 $'	 **,,h777 	 	 	
 $'	 **,,h77777r   r'   ztest only relevant for OS Xc                     d }|t           _        t                      5 }d|d<   |d= t          j        | j                   d d d            n# 1 swxY w Y   |                     | j        j        d         d           d S )Nc                     | dk    rdS dS NLDSHAREDz*gcc-4.2 -bundle -undefined dynamic_lookup zgcc-4.2r   r*   s    r   r,   zAUnixCCompilerTestCase.test_osx_cc_overrides_ldshared.<locals>.gcvp       JCC9r   my_ccr3   rA   r   r   r   r   customize_compilerr   r;   	linker_sor   r,   envs      r   test_osx_cc_overrides_ldsharedz4UnixCCompilerTestCase.test_osx_cc_overrides_ldsharedl   s    	 	 	 $'	  "" 	2cCIJ(111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	*1-w77777s   "AAAc                    d }|t           _        t                      5 }d|d<   d|d<   t          j        | j                   d d d            n# 1 swxY w Y   |                     | j        j        d         d           d S )Nc                     | dk    rdS dS r@   r   r*   s    r   r,   z=UnixCCompilerTestCase.test_osx_explicit_ldshared.<locals>.gcv   rB   r   rC   r3   zmy_ld -bundle -dynamicrA   r   my_ldrD   rG   s      r   test_osx_explicit_ldsharedz0UnixCCompilerTestCase.test_osx_explicit_ldshared{   s    
	 	 	 $'	  "" 	2cCI6C
O(111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	*1-w77777s   $AAAN)r   r   r   r    r$   unittestskipIfr   r   r=   
skipUnlessrI   rM   r   r   r   r   r   	   s        $ $ $@ @ @ X_S\W,.EFFO8 O8 GFO8b X13PQQ8 8 RQ8 X13PQQ8 8 RQ8 8 8r   r   __main__)__doc__r   rN   test.support.os_helperr   	distutilsr   distutils.unixccompilerr   TestCaser   r   mainr   r   r   <module>rX      s    ( ( 



  6 6 6 6 6 6       1 1 1 1 1 1@8 @8 @8 @8 @8H- @8 @8 @8F zHMOOOOO r   