a  zeã@s„ddlZddlZddlZddlmZmZddlmZddlm Z ddl m Z Gdd„de j e j ejƒZdd „Zed kr€eeƒƒdS) éN)Ú run_unittestÚmissing_compiler_executable)Ú build_clib)ÚDistutilsSetupError)Úsupportc@sFeZdZdd„Zdd„Zdd„Zdd„Ze e j d kd ¡d d „ƒZ d S)ÚBuildCLibTestCasecCsš| ¡\}}t|ƒ}| t|jd¡| t|jddg¡| t|jddg¡| t|jddg¡| t|jdifd g¡difdd d ifg}| |¡dS) NÚfooÚfoo1Úfoo2)ér )Únamer )r r )z another/namer r )Zanotherr ÚokZgood)Ú create_distrÚ assertRaisesrZcheck_library_list)ÚselfÚpkg_dirÚdistÚcmdZlibs©rúS/opt/bitninja-python-dojo/embedded/lib/python3.9/distutils/tests/test_build_clib.pyÚtest_check_library_dists*  ÿ ÿ ÿÿ ÿÿz)BuildCLibTestCase.test_check_library_distcCsÎ| ¡\}}t|ƒ}difg|_| t|j¡dddifg|_| t|j¡ddddgifg|_| | ¡ddg¡dddifg|_| | ¡ddg¡dddifdddd gifg|_| | ¡gd ¢¡dS) Nr Úsourcesr ÚaÚb)rrZname2ÚcÚd)rrrr)rrÚ librariesrrZget_source_filesÚ assertEqual©rrrrrrrÚtest_get_source_files.s   ÿz'BuildCLibTestCase.test_get_source_filescCs€| ¡\}}t|ƒ}Gdd„dƒ}|ƒ|_dddifg}| t|j|¡ddtƒifg}| |¡ddtƒifg}| |¡dS)Nc@seZdZdd„ZeZdS)z.FakeCompilerc_sdS©Nr)ÚargsÚkwrrrÚcompileIszDBuildCLibTestCase.test_build_libraries..FakeCompiler.compileN)Ú__name__Ú __module__Ú __qualname__r#Zcreate_static_librrrrÚ FakeCompilerHsr'r rZnotvalid)rrZcompilerrrZbuild_librariesÚlistÚtuple)rrrrr'ÚlibrrrÚtest_build_librariesDs  z&BuildCLibTestCase.test_build_librariescCsh| ¡\}}t|ƒ}d|_| ¡| |jdg¡d|_| ¡| |jg¡d|j_| t|j¡dS)Nzone-dirZWONTWORK) rrZ include_dirsZfinalize_optionsrZ distributionrrrrrrrÚtest_finalize_optionsYs z'BuildCLibTestCase.test_finalize_optionsÚwin32zcan't test on WindowscCsž| ¡\}}t|ƒ}tj |d¡}| |d¡dd|gifg|_tj |d¡}t |¡||_||_t ƒ}|dur€|  d|¡|  ¡|  dt  |¡¡dS)Nzfoo.czint main(void) { return 1;} rrZbuildzThe %r command is not foundzlibfoo.a)rrÚosÚpathÚjoinZ write_filerÚmkdirÚ build_temprZskipTestÚrunZassertInÚlistdir)rrrrZfoo_cr2ZccmdrrrÚtest_runhs   zBuildCLibTestCase.test_runN) r$r%r&rrr+r,ÚunittestZskipIfÚsysÚplatformr5rrrrr s rcCs t t¡Sr )r6Z makeSuiterrrrrÚ test_suite‚sr9Ú__main__)r6r.r7Z test.supportrrZdistutils.command.build_clibrZdistutils.errorsrZdistutils.testsrZTempdirManagerZLoggingSilencerZTestCaserr9r$rrrrÚs   þv