+
    h:.                        R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIt^RIHt ]P(                  ! R	R
7      R 4       t]P(                  ! R	R
7      R 4       t ! R R]P.                  4      tR# )z"Tests for distutils.unixccompiler.N)	sysconfig)consolidate_linker_args)DistutilsPlatformError)support)EnvironmentVarGuard)_clear_cached_macosx_ver)unixT)autousec                     V P                  \        R \        P                  4       V P                  \        R\        P                  4       V P                  \        R\        P
                  4       R# )platformget_config_varget_config_varsN)setattrsysr   r   r   r   )monkeypatchs   &S/usr/lib/python3/dist-packages/setuptools/_distutils/compilers/C/tests/test_unix.pysave_valuesr      sJ    Z6	#3Y5M5MN	#4i6O6OP    c                 d     ! R  R\         P                  4      pV! 4       V P                  n        R# )c                   &   a  ] tR t^t o R tRtV tR# ))compiler_wrapper.<locals>.CompilerWrapperc                $    V P                  R 4      # )z/foo)runtime_library_dir_optionselfs   &r   	rpath_foo3compiler_wrapper.<locals>.CompilerWrapper.rpath_foo   s    226::r    N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r   CompilerWrapperr      s     	; 	;r   r&   N)r   Compilerinstancecc)requestr&   s   & r   compiler_wrapperr+      s%    ;$-- ; *+Gr   c                   p  a  ] tR t^"t o ]P
                  P                  R4      R 4       t]P
                  P                  R4      R 4       t]P
                  P                  R4      ]P
                  P                  R4      R 4       4       t
]P
                  P                  R4      R 4       tR tR tR	tV tR
# )TestUnixCCompilerzplatform.system == "Windows"c                  a aa R \         n        RoRpRpRV3RV3RV3RV3RV3RV3RV3RV3RV3R V3R!V3R".pV3R loVVV 3R lpV FC  w  rVVw  rxV! WxV4       Vf
   V! RW4       Vf   V! VRV4       Ve   K3  Ve   K9  V! RRV4       KE  	  \        P                  p	R\         n        R	 p
V
\        n        S P                  P                  4       R
R.8X  g   Q hR p
V
\        n        S P                  P                  4       RR.8X  g   Q hR p
V
\        n        S P                  P                  4       RR.8X  g   Q hV	\        n        R\         n        R p
V
\        n        S P                  P                  4       \        RR.4      8X  g   Q hR p
V
\        n        S P                  P                  4       \        RR.4      8X  g   Q hR\         n        R p
V
\        n        S P                  P                  4       R8X  g   Q hR\         n        R p
V
\        n        S P                  P                  4       \        RR.4      8X  g   Q hR\         n        R p
V
\        n        S P                  P                  4       \        RR.4      8X  g   Q hR\         n        R p
V
\        n        S P                  P                  4       R8X  g   Q hR# )#darwinMACOSX_DEPLOYMENT_TARGETz-Wl,-rpath,/fooz-L/fooNc                    <a  VV 3R  lpV# )c                    < V S8X  d   S# R # xxxr   )vardarwin_ver_varsyscfg_macosx_vers   &r   gcvRTestUnixCCompiler.test_runtime_libdir_option.<locals>.make_darwin_gcv.<locals>.gcvC   s    .(,,r   r   )r7   r8   r6   s   f r   make_darwin_gcvETestUnixCCompiler.test_runtime_libdir_option.<locals>.make_darwin_gcvB   s    
 Jr   c                 |  < \         P                  pR V : RV: R2p\        P                  pVP	                  S4      p\        4        S! V 4      \        n        Ve   WS&   MSV9   d   VP                  S4       Ve(   S	P                  P                  4       V8X  g   Q V4       hMN\        P                  ! \        SR,           R7      ;_uu_ 4        S	P                  P                  4        RRR4       Ve   WcS&   MSV9   d   VP                  S4       V\        n        \        4        R#   + '       g   i     LH; i)zmacOS version = (sysconfig=z, env=)Nz	 mismatch)match)osenvironr   r   getr   popr)   r   pytestraisesr   )
r7   env_macosx_verexpected_flagenvmsgold_gcvold_env_macosx_verr6   r:   r   s
   &&&    r   do_darwin_testDTestUnixCCompiler.test_runtime_libdir_option.<locals>.do_darwin_testJ   s   **C/0A/DF>J\\]^C  ..G!$!8 %&'67H'II$)&4N#3&' (ww((*m;@S@;]]*.<2O  GG%%' "-&8N#3&''.I$$& s   D++D;	 zhp-uxc                     R # r3   r   vs   &r   r8   9TestUnixCCompiler.test_runtime_libdir_option.<locals>.gcv{       r   z+sc                     R # )gccr   rO   s   &r   r8   rQ      rR   r   z-Wl,+sc                     R # )zg++r   rO   s   &r   r8   rQ      rR   r   barc                 *    V R 8X  d   R# V R8X  d   R# R# )CCrT   GNULDyesNr   rO   s   &r   r8   rQ      s    Dyg r   z-Wl,--enable-new-dtagsc                 *    V R 8X  d   R# V R8X  d   R# R# )rX   zgcc -pthread -B /barrY   rZ   Nr   rO   s   &r   r8   rQ      s    Dy-g r   c                 *    V R 8X  d   R# V R8X  d   R# R# )rX   rT   rY   noNr   rO   s   &r   r8   rQ      s    Dyg r   z
-Wl,-R/fooc                 *    V R 8X  d   R# V R8X  d   R# R# )rX   zx86_64-pc-linux-gnu-gcc-4.4.2rY   rZ   Nr   rO   s   &r   r8   rQ      s    Dy6g r   c                 *    V R 8X  d   R# V R8X  d   R# R# )rX   r)   rY   rZ   Nr   rO   s   &r   r8   rQ      s    Dyg r   c                 *    V R 8X  d   R# V R8X  d   R# R# )rX   r)   rY   r]   Nr   rO   s   &r   r8   rQ      s    Dyg r   )NN)N11)10N)10.3N)z10.3.1N)10.5N)z10.5.1N)rc   rc   )rc   rd   )rd   rc   )rd   ra   ))z10.4rb   N)r   r   r   r   r)   r   r   )r   darwin_rpath_flagdarwin_lib_flagdarwin_test_casesrK   macosx_versrF   r7   rE   rI   r8   r6   r:   s   f          @@r   test_runtime_libdir_option,TestUnixCCompiler.test_runtime_libdir_option#   s     3-" ?+,-?+_-/./01/01/./"
		'B +<&K0;-,mL (r>A%0"mD (^-Cr2}5 +< ** 	 $'	 ww  "tX&6666	 $'	 ww  "x&::::	 $'	 ww  "x&::::#*	  	 $'	 ww  "&=$?
 '  	 
	 $'	 ww  "&=$?
 '  	  	 $'	 ww  "l222 	 $'	 ww  "&=$?
 '  	  	 $'	 ww  "&=$?
 '  	  	 $'	 ww  "l222r   c                V   R  pR\         P                  /R lpV\         n        V\         n        \        4       ;_uu_ 4       pRVR&   VR \         P                  ! V P
                  4       RRR4       V P
                  P                  ^ ,          R8X  g   Q hR#   + '       g   i     L6; i)c                     V R 8X  d   R# R# LDSHARED*gcc-4.2 -bundle -undefined dynamic_lookup gcc-4.2r   rO   s   &r   r8   9TestUnixCCompiler.test_cc_overrides_ldshared.<locals>.gcv       JCr   _origc                 f    V'       d$   \        \        \        P                  V4      4      # V ! 4       # Nlistmapr   r   rs   argss   $*r   gcvs:TestUnixCCompiler.test_cc_overrides_ldshared.<locals>.gcvs   $    C	 8 8$?@@7Nr   my_ccrX   rn   Nr   r   r   r   customize_compilerr)   	linker_sor   r8   r{   rG   s   &   r   test_cc_overrides_ldshared,TestUnixCCompiler.test_cc_overrides_ldshared   s    	
	i77 	
 $'	 $(	! ""cCIJ((1 # ww  #w...	 #"s   )BB(	disable_macos_customizationc                   R pR\         P                  /R lpV\         n        V\         n        \        P                  P                  V P                  RRR7      ;_uu_ 4       p\        P                  P                  V P                  RRR7      ;_uu_ 4        \        P                  P                  V P                  R	RR7      ;_uu_ 4        \        4       ;_uu_ 4       pR
VR&   RVR&   VR \         P                  ! V P                  4       V P                  P                  R,          RR.8X  g   Q hV P                  P                  R. RRR7       VP                  ^ ,          ^ ,          p. ROpVR,          V8X  g   Q h RRR4       RRR4       RRR4       RRR4       R#   + '       g   i     L*; i  + '       g   i     L5; i  + '       g   i     L@; i  + '       g   i     R# ; i)z}
Ensure that setting CC env variable also changes default linker
correctly when building C++ extensions.

pypa/distutils#126
c                 N    V R 8X  d   R# V R8X  d   R# V R8X  d   R# V R8X  d   R# R# )	rn   ro   LDCXXSHAREDz*g++-4.2 -bundle -undefined dynamic_lookup CXXzg++-4.2rX   rp   rM   r   rO   s   &r   r8   KTestUnixCCompiler.test_cc_overrides_ldshared_for_cxx_correctly.<locals>.gcv  s.    JCm#Ce d r   rs   c                 f    V'       d$   \        \        \        P                  V4      4      # V ! 4       # ru   rv   ry   s   $*r   r{   LTestUnixCCompiler.test_cc_overrides_ldshared_for_cxx_correctly.<locals>.gcvs  r}   r   spawnN)return_value
_need_linkTmkpathzccache my_ccrX   my_cxxr   rn   :       Nccacher~   za.outzc++)target_lang:N   N)r   z-bundlez
-undefineddynamic_lookup)r   r   r   mockpatchobjectr)   r   r   r   link	call_args)r   r8   r{   
mock_spawnrG   r   expecteds   &      r   ,test_cc_overrides_ldshared_for_cxx_correctly>TestUnixCCompiler.test_cc_overrides_ldshared_for_cxx_correctly   sm   			i77 	
 $'	 $(	!JJdggwTBBjJJdgg|$GGJJdggxdCC!!S&CI!CJJ((177$$S)h-@@@@GGLLr7L>",,Q/2ILHR=H,,, " D H CB "! DC HG CBBsU   #5G5G
	F7 B!F$F7
G
	G$F4/F77GG
	
GGG.	c                Z   R  pR\         P                  /R lpV\         n        V\         n        \        4       ;_uu_ 4       pRVR&   RVR&   \         P                  ! V P
                  4       RRR4       V P
                  P                  ^ ,          R8X  g   Q hR#   + '       g   i     L6; i)	c                     V R 8X  d   R# R# rm   r   rO   s   &r   r8   5TestUnixCCompiler.test_explicit_ldshared.<locals>.gcv(  rr   r   rs   c                 f    V'       d$   \        \        \        P                  V4      4      # V ! 4       # ru   rv   ry   s   $*r   r{   6TestUnixCCompiler.test_explicit_ldshared.<locals>.gcvs-  r}   r   r~   rX   zmy_ld -bundle -dynamicrn   Nmy_ldr   r   s   &   r   test_explicit_ldshared(TestUnixCCompiler.test_explicit_ldshared#  s    
	
	i77 	
 $'	 $(	! ""cCI6C
O((1 # ww  #w...	 #"s   +BB*	c                    R V P                   n        \        P                  ! V P	                  4       4       V P                   P                  R4       R# )scratchabortN)r)   
output_dirr?   chdirmkdtemphas_functionr   s   &r   test_has_function#TestUnixCCompiler.test_has_function:  s4     '
 W%r   c                v   \         P                  ! 4       pR  Vn        VP                  \        P
                  RR 4       \        P                  R8w  d   RMRpRpVP                  VR4      P                  RR4      R	V 28X  g   Q hVP                  \        V4      R4      P                  RR4      R	V 28X  g   Q hVP                  \        P
                  RR
 4       VP                  VR4      P                  RR4      R8X  g   Q hVP                  \        V4      R4      P                  RR4      R8X  g   Q hR# )c                     V # ru   r   )dirs   &r   <lambda>:TestUnixCCompiler.test_find_library_file.<locals>.<lambda>D  s    Sr   existsc                     R V 9   # )existingr   ds   &r   r   r   E  s    qr   cygwinzlibabc.dylibz
cygabc.dllabc\/z/foo/bar/existing/c                 @    R V 9   ;'       d    RV 9   ;'       d    RV 9  # )r   z.az.dll.ar   r   s   &r   r   r   U  s$    jAoII$!)II8IIr   z/foo/bar/existing/libabc.aN)z/foo/bar/missingz/foo/bar/existing)r   r'   _library_rootr   r?   pathr   r   find_library_filereplacereversed)r   r   compilerlibnamedirss   &&   r   test_find_library_file(TestUnixCCompiler.test_find_library_fileB  s8   ==?!0BGGX/HI$'LLH$<.,8&&tU3;;D#F#G9-.	
. &&x~u=EEdCP#G9-.	
. 	GGI	
 &&tU3;;D#F+,	
, &&x~u=EEdCP+,	
,r   r   N)r   r   r    r!   rC   markskipifri   r   usefixturesr   r   r   r   r"   r#   r$   s   @r   r-   r-   "   s     [[67{3 8{3z [[67/ 8/* [[67[[:;(- < 8(-T [[67/ 8/,&
 
r   r-   )__doc__r?   r   unittest.mockr   	distutilsr   distutils.compatr   distutils.errorsr   distutils.testsr   distutils.tests.compat.py39r   distutils.utilr   rC   rM   r   fixturer   r+   TempdirManagerr-   r   r   r   <module>r      sy    ( 	 
   4 3 # ; 3   Q Q , ,|
.. |
r   