
    ?wg                     j    d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	Z	 G d dej                        Zy)z'Tests for distutils.command.build_clib.    N)
build_clib)DistutilsSetupError)missing_compiler_executablesupportc                   f    e Zd Zd Zd Zd Zd Zej                  j                  d      d        Z
y)TestBuildCLibc                     | j                         \  }}t        |      }t        j                  t              5  |j                  d       d d d        t        j                  t              5  |j                  ddg       d d d        t        j                  t              5  |j                  ddg       d d d        t        j                  t              5  |j                  ddg       d d d        t        j                  t              5  |j                  di fd	g       d d d        di fdd
difg}|j                  |       y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   UxY w)Nfoofoo1foo2)   r   )namer   )r   r   )zanother/namer   r   )anotherr   okgood)create_distr   pytestraisesr   check_library_list)selfpkg_dirdistcmdlibss        b/var/www/horilla/myenv/lib/python3.12/site-packages/setuptools/_distutils/tests/test_build_clib.pytest_check_library_distz%TestBuildCLib.test_check_library_dist   sd   ((* ]]./ 	*""5)	* ]]./ 	5""FF#34	5
 ]]./ 	D""K1A#BC	D ]]./ 	""!#;<	 ]]./ 	"""23	 vf~67t$5	* 	*	5 	5
	D 	D	 		 	s;   E+E EE(
E4EEE%(E14E=c                 H   | j                         \  }}t        |      }di fg|_        t        j                  t
              5  |j                          d d d        dddifg|_        t        j                  t
              5  |j                          d d d        ddddgifg|_        |j                         ddgk(  sJ dddifg|_        |j                         ddgk(  sJ dddifdddd	gifg|_        |j                         g d
k(  sJ y # 1 sw Y   xY w# 1 sw Y   xY w)Nr   sourcesr   ab)r   r    name2cd)r   r    r"   r#   )r   r   	librariesr   r   r   get_source_filesr   r   r   r   s       r   test_get_source_filesz#TestBuildCLib.test_get_source_files-   sE   ((* !"]]./ 	#  "	# !9a.12]]./ 	#  "	# !9sCj"9:;##%#s333 9j"9:;##%#s333 i,-y3*-.
 ##%)====#	# 	#	# 	#s   D DDD!c                 x   | j                         \  }}t        |      } G d d      } |       |_        dddifg}t        j                  t
              5  |j                  |       d d d        ddt               ifg}|j                  |       ddt               ifg}|j                  |       y # 1 sw Y   JxY w)Nc                       e Zd Zd ZeZy)8TestBuildCLib.test_build_libraries.<locals>.FakeCompilerc                       y )N )argskws     r   compilez@TestBuildCLib.test_build_libraries.<locals>.FakeCompiler.compileL   s        N)__name__
__module____qualname__r/   create_static_libr,   r0   r   FakeCompilerr*   K   s     !(r0   r5   r   r   notvalid)	r   r   compilerr   r   r   build_librarieslisttuple)r   r   r   r   r5   libs         r   test_build_librariesz"TestBuildCLib.test_build_librariesG   s    ((*	( 	( $~ J/01]]./ 	%$	% DF+,-C EG,-.C 	% 	%s   B00B9c                    | j                         \  }}t        |      }d|_        |j                          |j                  dgk(  sJ d |_        |j                          |j                  g k(  sJ d|j                  _        t        j                  t              5  |j                          d d d        y # 1 sw Y   y xY w)Nzone-dirWONTWORK)	r   r   include_dirsfinalize_optionsdistributionr$   r   r   r   r&   s       r   test_finalize_optionsz#TestBuildCLib.test_finalize_options^   s    ((*$I;...2%%%%/"]]./ 	#  "	# 	# 	#s   B44B=zplatform.system() == "Windows"c                    | j                         \  }}t        |      }t        j                  j	                  |d      }| j                  |d       dd|gifg|_        t        j                  j	                  |d      }t        j                  |       ||_        ||_        t               }|| j                  d|d       |j                          dt        j                  |      v sJ y )	Nzfoo.czint main(void) { return 1;}
r
   r   buildzThe z command is not foundzlibfoo.a)r   r   ospathjoin
write_filer$   mkdir
build_tempr   skipTestrunlistdir)r   r   r   r   foo_crJ   ccmds          r   test_runzTestBuildCLib.test_runn   s    ((*Wg.>?)eW!567WW\\'73

## +,MMD(=>? 		 RZZ
3333r0   N)r1   r2   r3   r   r'   r<   rB   r   markskipifrP   r,   r0   r   r   r      s;    %B>4!.#  [[894 :4r0   r   )__doc__rE   distutils.command.build_clibr   distutils.errorsr   distutils.testsr   r   r   TempdirManagerr   r,   r0   r   <module>rX      s+    - 	 3 0 @ {4G** {4r0   