\bg('ddlZddlZddlmZddlZddlmZddlm Z m Z ddl m Z ddl mZddlmZdd lmZdd lmZddlmcm Zdd lmZd ejvZGd dZGddZdZdS)N)cache_from_source)path) build_extget_abi3_suffix) Distribution) CompileError) Extension) environment)DALS)get_config_var__pypy__c2eZdZdZdZdZdZdZdZdS) TestBuildExtct}t|}d|jd<|d}tj|d}||ksJdS)z Setuptools needs to give back the same result as distutils, even if the fullname is not in ext_map. zfoo/barfooN)rrext_mapget_ext_filenameorig)selfdistcmdreswanteds p/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/tests/test_build_ext.pytest_get_ext_filenamez"TestBuildExt.test_get_ext_filenames_ ~~oo!# I""5))00e<<f}}}}}}ctttddgd}tt |g}t |}|d|jvsJ|d}ts&| tdsJd Stj dkr| dsJd Sd |vsJd S) z} Filename needs to be loadable by several versions of Python 3 if 'is_abi3' is truthy on Extension() spam.eggseggs.cTpy_limited_api ext_modules EXT_SUFFIXwin32zeggs.pydabi3N) printrr rdictrfinalize_optionsrrendswithr sysplatform)r extensionrrrs rtest_abi3_filenamezTestBuildExt.test_abi3_filename$s o   kH:dKKK Di[999::oo ck))))"";//   !<<| < <== = == = = \W $ $<< ++ + ++ + +S======rct}t|}tddgdx|jd<}d|_t s|d}nd} dtjd<|d }d |ksJ|d}||ksJ tjd=d S#tjd=wxYw) zd SETUPTOOLS_EXT_SUFFIX variable always overrides default extension options. for_abi3zs.cTr"Fzfor_abi3.test-suffixz .test-suffixSETUPTOOLS_EXT_SUFFIXnormalznormal.test-suffixN) rrr r_links_to_dynamicIS_PYPYrosenviron)rrrextexpectrs rtest_ext_suffix_overridez%TestBuildExt.test_ext_suffix_override9s ~~oo(1  G ) ) )   J#!& ,))*55FF,F 42@BJ. /&&x00C'3....&&z22CS===== 2333 23 3 3 3 3s "A B;;C cddddiiidddiid}tdd g}td d g}td d g}tj|td|||gddidS)Nmypkgsubpkgzext2.crext1zmain.c)srcz c-extensionsz mypkg.ext1zc-extensions/ext1/main.czmypkg.subpkg.ext2zsrc/mypkg/subpkg/ext2.cext3zc-extension/ext3.cz%test%r@) script_namer% package_dir)r rbuildr)rfilesr?ext2rAs rdist_with_examplezTestBuildExt.dist_with_exampleYsh278#h^4   (B'CDD,/H.IJJ"6!788 5# $-;     rc|dd|dd|}|d}d|_|j|jtj d}d|j D}||d|d |d gksJ|j iksJ| dd |_|jd |j D}||dd |d d|d diksJdS)Nr3.mp3&setuptools.command.build_ext.use_stubsFr/cNg|]"}|tjd#SrKreplacer7sep).0xs r z1TestBuildExt.test_get_outputs..ts(KKKa199RVS))KKKr /ext3.mp3/mypkg/ext1.mp3/mypkg/subpkg/ext2.mp3Tci|]D\}}|tjd|tjdESrMrNrQkvs r z1TestBuildExt.test_get_outputs..N   1 IIbfc " "AIIbfc$:$:   r src/ext3.mp3src/mypkg/ext1.mp3src/mypkg/subpkg/ext2.mp3)setenvsetattrrGget_command_obj editable_modeensure_finalized build_librOr7rP get_outputsget_output_mappingreinitialize_commanditems)r tmpdir_cwd monkeypatchrrreoutputsmappings rtest_get_outputszTestBuildExt.test_get_outputsjs2F;;;DeLLL%%''((55 "' " "$$$'//<< KK3H93H3J3JKKK # # # ) ) ) 0 0 0     ,y+--3333 !!+..."& " "$$$  4 466<<>>    # # #^ ) ) )+? 0 0 02M       rc *|dd|dd|}|d}d|_|j|jD]}||dd|jtj d}d|j D}d }|||d |d |d d ||d|d|dd||d|d|ddiksJ|d|vsJ|d|vsJ||d} | |vsJ| |dsJ| dsJdS)Nr3rIrJTr _needs_stubrKci|]D\}}|tjd|tjdESrMrNrXs rr[zBTestBuildExt.test_get_output_mapping_with_stub..r\rc\t|tjdS)zDMake it possible to do comparisons and tests in a OS-independent wayrK)_compiled_file_namerOr7rP)files rCz9TestBuildExt.test_get_output_mapping_with_stub..Cs"&t,,44RVSAA Arz/ext3.pyz src/ext3.pyrTr]z/mypkg/ext1.pyzsrc/mypkg/ext1.pyrUr^z/mypkg/subpkg/ext2.pyzsrc/mypkg/subpkg/ext2.pyrVr_z/mypkg/__pycache__/ext1z.pyc)r`rarGrbrcrd extensionsrerOr7rPrgri startswithr,) rrjrkrrr9rermru example_stubs r!test_get_output_mapping_with_stubz.TestBuildExt.test_get_output_mapping_with_stubsS2F;;;DdKKK%%''((55 "& " "$$$' : :C   ]D 9 9 9 9'//<<   4 466<<>>     B B B A$$$ % %qq'7'7 # # #^ A*** + +QQ/B-C-C ) ) )+? A111 2 2AA6P4Q4Q 0 0 02M      +++7::::222'AAAAqI55566 w&&&&&&)'L'L'LMMMMM$$V,,,,,,,rN) __name__ __module__ __qualname__rr0r;rGrnryrrrrsp   !!!*444@   "   @'-'-'-'-'-rrc0eZdZdedefdZdZdZdZdS)TestBuildExtInplaceoptionalreturnc .diidd}tj|tddg|}tt |g}d|_t |}t|jd d d d || |S) Nz#include missingheader.h )libtmp)r!z.buildr r!)rr$setup.pyz .build/libz .build/tmp)re build_tempr}) rrDr rr*rBrvarsupdaterd)rroptsrEr/rrs rget_build_ext_cmdz%TestBuildExtInplace.get_build_ext_cmds2 ,,   5kH:III Di[999::%ooS Qz4TestBuildExtInplace.test_optional..s6   ?      rN)rrunanyr)rrjrrrs r test_optionalz!TestBuildExtInplace.test_optionals{ $$dD$AA    ,,VV<<          rc|dd}tjt5|ddddS#1swxYwYdS)NFTr)rpytestraisesrr)rrjrs rtest_non_optionalz%TestBuildExtInplace.test_non_optionals$$eT$BB ]< ( (   GGIII                  sAAAN) rzr{r|boolrrrrrr}rrrrsf $ 9    MMM    rrctdtdtdd}tj|tjdgd\}}|dks Jd |zdS) Nz from setuptools import Extension, setup setup( name='foo', version='0.0.0', ext_modules=[Extension('foo', ['foo.c'])], ) a #include "Python.h" #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "foo", NULL, 0, NULL, NULL, NULL, NULL, NULL }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_foo(void) #else #define INITERROR return void initfoo(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&moduledef); #else PyObject *module = Py_InitModule("extension", NULL); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } zD [build] build_base = foo_build )rzfoo.cz setup.cfgrD)r)r data_streamrz STDOUT: %s STDERR: %s)r rrDr run_setup_py)rjrEcodeoutputs rtest_build_ext_config_handlingrs    ( * * V   m< < Ez Ju+ ILD& 19992V;99999r)r7r-importlib.utilrrsrjaracorsetuptools.command.build_extrrsetuptools.distrsetuptools.errorsrsetuptools.extensionr rr textwrapr distutils.command.build_extcommandrdistutils.sysconfigr builtin_module_namesr6rrrr}rrrsh CCCCCC CCCCCCCC((((((*********************...... 0 0[-[-[-[-[-[-[-[-|))))))))XC<C<C<C<C