V*Ca ddlmZddlZddlZddlmZddlZddlm Z ddl m Z m Z ddl mZddlmZddlmZd d lmZd d lmZddlmcm Zdd lmZd ejvZGddZGddZdZ dS)) annotationsN)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 q/builddir/build/BUILD/cloudlinux-venv-1.0.10/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_optionsrrendswithrsysplatform)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_override;s ~~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%rA) script_namer& package_dir)r rbuildr)rfilesr@ext2rBs rdist_with_examplezTestBuildExt.dist_with_example[sh278#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)Nr4.mp3&setuptools.command.build_ext.use_stubsFr/cNg|]"}|tjd#SrLreplacer8sep).0xs r z1TestBuildExt.test_get_outputs..vs(KKKa199RVS))KKKr /ext3.mp3/mypkg/ext1.mp3/mypkg/subpkg/ext2.mp3Tci|]D\}}|tjd|tjdESrNrOrRkvs r z1TestBuildExt.test_get_outputs..N   1 IIbfc " "AIIbfc$:$:   r src/ext3.mp3src/mypkg/ext1.mp3src/mypkg/subpkg/ext2.mp3)setenvsetattrrHget_command_obj editable_modeensure_finalized build_librPr8rQ get_outputsget_output_mappingreinitialize_commanditems)r tmpdir_cwd monkeypatchrrrfoutputsmappings rtest_get_outputszTestBuildExt.test_get_outputsls2F;;;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)Nr4rJrKTr _needs_stubrLci|]D\}}|tjd|tjdESrNrOrYs rr\zBTestBuildExt.test_get_output_mapping_with_stub..r]rc\t|tjdS)zDMake it possible to do comparisons and tests in a OS-independent wayrL)_compiled_file_namerPr8rQ)files rCz9TestBuildExt.test_get_output_mapping_with_stub..Cs"&t,,44RVSAA Arz/ext3.pyz src/ext3.pyrUr^z/mypkg/ext1.pyzsrc/mypkg/ext1.pyrVr_z/mypkg/subpkg/ext2.pyzsrc/mypkg/subpkg/ext2.pyrWr`z/mypkg/__pycache__/ext1z.pyc)rarbrHrcrdre extensionsrfrPr8rQrhrj startswithr-) rrkrlrrr:rfrnrv 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__rr1r<rHrorzrrrrsp   !!!*444@   "   @'-'-'-'-'-rrc(eZdZd dZdZdZdZd S) TestBuildExtInplaceoptionalboolreturnrc .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)rf build_tempr~) rrEr rr+rCrvarsupdatere)rroptsrFr0rrs rget_build_ext_cmdz%TestBuildExtInplace.get_build_ext_cmds2 ,,= =  5kH:III Di[999::%ooS Qz4TestBuildExtInplace.test_optional..s6   ?      rN)rrunanyr)rrkrrrs r test_optionalz!TestBuildExtInplace.test_optionals{ $$dD$AA    ,,VV<<          rc|dd}tjt5|ddddS#1swxYwYdS)NFTr)rpytestraisesr r)rrkrs rtest_non_optionalz%TestBuildExtInplace.test_non_optionals$$eT$BB ]< ( (   GGIII                  sAAAN)rrrr)r{r|r}rrrrr~rrrrsX    MMM    rrctdtdtdd}tj|tjdgd\}\}}|dksJd |d |dS) 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.cfgrE)r)r data_streamrz STDOUT: z STDERR: )r rrEr run_setup_py)rkrFcodestdoutstderrs rtest_build_ext_config_handlingrs    ( * * V   m< < Ez Ju(5 ID 66 1999?F??v??99999r)! __future__rr8r.importlib.utilrrtrjaracorsetuptools.command.build_extrrsetuptools.distrsetuptools.errorsr setuptools.extensionr rr textwrapr distutils.command.build_extcommandrdistutils.sysconfigrbuiltin_module_namesr7rrrr~rrrs"""""" CCCCCC CCCCCCCC((((((*********************...... 0 0[-[-[-[-[-[-[-[-|))))))))XC@C@C@C@C@r