
    pf                         d Z ddlZddlZddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZ ddlZ ej                  d      d        Z G d	 d
ej                         Zy)z$Tests for distutils.cygwinccompiler.    N)	sysconfig)CONFIG_H_NOTOKCONFIG_H_OKCONFIG_H_UNCERTAINcheck_config_h	get_msvcr)supportT)autousec                    | j                   }t        j                  j                  |j	                         d      |_        |j                  t        d|j                         |j                  t        dt        j                         y )Nzpython.hget_config_h_filenameversion)instanceospathjoinmkdtemppython_hsetattrr   _get_config_h_filenamesysr   )requestmonkeypatchdistutils_managed_tempdirselfs       h/home/Script/Script_env/lib/python3.12/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.pystuffr      sX    DGGLL<DM	#:D<W<WXY4    c                       e Zd Zd Zej
                  j                  d      ej
                  j                  d      d               Zej
                  j                  d      d        Zd Z	d Z
ej
                  j                  d      d        Zy	)
TestCygwinCCompilerc                     | j                   S )N)r   r   s    r   r   z*TestCygwinCCompiler._get_config_h_filename   s    }}r   zsys.platform != "cygwin"z,not os.path.exists("/usr/lib/libbash.dll.a")c                     ddl m}  |       }d}|j                  dg|      }|J t        j                  j                  |      sJ |d|ddk(  sJ y )Nr   CygwinCCompilerbashz/usr/libz/usr/lib/libsz.dll.a)distutils.cygwinccompilerr$   find_library_filer   r   exists)r   r$   compiler	link_namelinkable_files        r   test_find_library_filez*TestCygwinCCompiler.test_find_library_file   sc     	>"$	 22J<K(((ww~~m,,,,ym6 BBBBr   c                 J    ddl m}  |       }|j                  d      g k(  sJ y )Nr   r#   z/foo)r'   r$   runtime_library_dir_optionr   r$   r*   s      r   test_runtime_library_dir_optionz3TestCygwinCCompiler.test_runtime_library_dir_option*   s&    ="$226:b@@@r   c                 P   dt         _        t               d   t        k(  sJ dt         _        t               d   t        k(  sJ | j                  | j                  d       t               d   t        k(  sJ | j                  | j                  d       t               d   t        k(  sJ y )NX2.6.1 (r261:67515, Dec  6 2008, 16:42:21) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)]r   zsomething without the *CC wordxxxzxxx __GNUC__ xxx)r   r   r   r   r   
write_filer   r   r!   s    r   test_check_config_hz'TestCygwinCCompiler.test_check_config_h1   s    7 	
 "k111 7 "&8888 	u-"n444 	'9:"k111r   c                    dt         _        t               g k(  sJ dt         _        t               dgk(  sJ dt         _        t               dgk(  sJ dt         _        t               dgk(  sJ dt         _        t               d	gk(  sJ d
t         _        t               dgk(  sJ dt         _        t        j                  t
              5  t                d d d        y # 1 sw Y   y xY w)Nr3   zF2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1300 32 bits (Intel)]msvcr70zF2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bits (Intel)]msvcr71zF2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1400 32 bits (Intel)]msvcr80zF2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1500 32 bits (Intel)]msvcr90zP3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 18:46:30) [MSC v.1929 32 bit (Intel)]vcruntime140zF2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.2000 32 bits (Intel)])r   r   r   pytestraises
ValueErrorr!   s    r   test_get_msvcrz"TestCygwinCCompiler.test_get_msvcrI   s    > 	 {b    U 	 {yk))) U 	 {yk))) U 	 {yk))) U 	 {yk)))* 	 {~.... U 	 ]]:& 	K	 	 	s   CC#c                 :    ddl m}  |       }|j                  J y )Nr   r#   )r'   r$   dll_librariesr0   s      r   test_dll_libraries_not_nonez/TestCygwinCCompiler.test_dll_libraries_not_nonev   s    ="$%%111r   N)__name__
__module____qualname__r   r=   markskipifr-   r1   r6   r@   rC    r   r   r   r      s     [[23[[FGC H 4C [[23A 4A20+Z [[232 42r   r   )__doc__r   r   	distutilsr   r'   r   r   r   r   r   distutils.testsr	   r=   fixturer   TempdirManagerr   rI   r   r   <module>rO      sV    * 	 
   $  5 5a2'00 a2r   