Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
test_build_ext.cpython-313.pyc176 linesDownload Raw Back to __pycache__
1�

2`js'����SSKJr SSKrSSKrSSKJr SSKrSSKJ	r	 SSK3JrJr SSK
Jr SSKJr SSKJr S	S4KJr S	SKJr SSKJs Jr SSKJr S
\R8;r"SS5r"SS5rSr g)�)�annotationsN)�cache_from_source)�path)�	build_ext�get_abi3_suffix)�Distribution)�CompileError)�	Extension�)�environment)�DALS)�get_config_var�__pypy__c�8�\rSrSrSrSrSrSrSrSr	Sr5g	)6�TestBuildExt�c��[5n[U5nSURS'URS5n[RRUS5nX4:Xdeg)ze7Setuptools needs to give back the same8result as distutils, even if the fullname9is not in ext_map.10�zfoo/bar�fooN)rr�ext_map�get_ext_filename�orig)�self�dist�cmd�res�wanteds     �QD:\code\apps\devtools\python\Lib\site-packages\setuptools/tests/test_build_ext.py�test_get_ext_filename�"TestBuildExt.test_get_ext_filenamesR���~����o��!#����I���"�"�5�)�����0�0��e�<���}��}�c��[[55 [SS/SS9n[[	U/S95n[U5nUR
5 SUR;deURS5n[5(d"UR[S55(deg11[RS:XaURS5(deg12S	U;deg13)ze14Filename needs to be loadable by several versions15of Python 3 if 'is_abi3' is truthy on Extension()16�	spam.eggs�eggs.cT��py_limited_api��ext_modules�17EXT_SUFFIX�win32zeggs.pyd�abi3N)
�printrr18r�dictr�finalize_optionsrr�endswithr�sys�platform)r�	extensionrrrs     r�test_abi3_filename�TestBuildExt.test_abi3_filename&s���19	�o�� ��k�H�:�d�K�	��D�i�[�9�:����o�������c�k�k�)�)�)��"�"�;�/��� � ��<�<��|� <�=�=�=�=�
�\�\�W�
$��<�<�20�+�+�+�+��S�=� �=r!c��[5n[U5n[SS/SS9=URS'nSUl[21(dUR
S5nOSnS[RS'UR
S	5nS22U:XdeUR
S5nXE:Xde[RS	g![RS	f=f)zL23SETUPTOOLS_EXT_SUFFIX variable always overrides24default extension options.25�for_abi3zs.cTr%Fzfor_abi3.test-suffixz.test-suffix�SETUPTOOLS_EXT_SUFFIX�normalznormal.test-suffixN)	rrr26r�_links_to_dynamic�IS_PYPYr�os�environ)rrr�ext�expectrs      r�test_ext_suffix_override�%TestBuildExt.test_ext_suffix_override;s���27�~����o��(1��
�G��	)28�	29����J��#�!&����w��)�)�*�5�F�,�F�	4�2@�B�J�J�.�/��&�&�x�0�C�'�3�.�.�.��&�&�z�2�C��=� �=��30�31�2�3���32�33�2�3�s
�AB/�/Cc���SSSS000SSS00S.n[SS	/5n[S34S/5n[SS
/5n[R"U5 [SX#U/SS0S.5$)N�mypkg�subpkgzext2.cr�ext1zmain.c)�srczc-extensionsz35mypkg.ext1zc-extensions/ext1/main.czmypkg.subpkg.ext2zsrc/mypkg/subpkg/ext2.c�ext3zc-extension/ext3.cz%test%rE)�script_namer(�package_dir)r36r�buildr)r�filesrD�ext2rFs     r�dist_with_example�TestBuildExt.dist_with_example[s����h��2��7�8�#�h��^�4�37��38��(B�'C�D���,�/H�.I�J����"6�!7�8���39�40�5���#� ��-���;�41��	r!c	�Z�URSS5 URSS5 UR5nURS5nSUlUR42"5 URR[RS5nUR"5Vs/sH"ofR[RS5PM$ nnUUS3US3US	3/:XdeUR"50:XdeURS5 S43UlUR44"5 UR"5R5VV	s0sHDup�UR[RS5U	R[RS5_MF n45nn	U46US3SUS3SUS	3S
0:Xdegs snfs sn	nf)Nr7�.mp3�&setuptools.command.build_ext.use_stubsFr�/�	/ext3.mp3�/mypkg/ext1.mp3�/mypkg/subpkg/ext2.mp3T�src/ext3.mp3�src/mypkg/ext1.mp3�src/mypkg/subpkg/ext2.mp3)�setenv�setattrrL�get_command_obj�
editable_mode�ensure_finalized�	build_lib�replacer;�sep�get_outputs�get_output_mapping�reinitialize_command�items)r�47tmpdir_cwd�monkeypatchrrr]�x�outputs�k�v�mappings           r�test_get_outputs�TestBuildExt.test_get_outputsls������2�F�;����D�e�L��%�%�'���(�(��5�	�"'�	���"�"�$��'�'�/�/�����<�	�3<�3H�3H�3J�K�3J�a�9�9�R�V�V�S�)�3J��K���k��#��k��)��k�/�0�48�49�	50�51�52�+�+�-��3�3�3�	
�!�!�+�.�"&�	���"�"�$�"�4�4�6�<�<�>�53�>���
�I�I�b�f�f�c�"�A�I�I�b�f�f�c�$:�:�>�	�54���k��#�^��k��)�+?��k�/�0�2M�55�56�	57�58��!L��59s
�)F"�<AF'c
��URSS5 URSS5 UR5nURS5nSUlUR60"5 URHnURUSS5 M URR[RS5nUR"5R5VVs0sHDupxUR[RS5UR[RS5_MF n	nnSn61U	U62"US	35U63"S645US3SU65"US
35U66"S5US3SU67"US35U68"S5US3S0:XdeUS
3U	;deUS3U	;deU69"US
35nX�;deURUS35(deURS5(degs snnf)Nr7rOrPTr�_needs_stubrQc�T�[U5R[RS5$)zDMake it possible to do comparisons and tests in a OS-independent wayrQ)�_compiled_file_namer^r;r_)�files r�C�9TestBuildExt.test_get_output_mapping_with_stub.<locals>.C�s��&�t�,�4�4�R�V�V�S�A�Ar!z/ext3.pyzsrc/ext3.pyrRrUz/mypkg/ext1.pyzsrc/mypkg/ext1.pyrSrVz/mypkg/subpkg/ext2.pyzsrc/mypkg/subpkg/ext2.pyrTrWz/mypkg/__pycache__/ext1z.pyc)rXrYrLrZr[r\�70extensionsr]r^r;r_rarc�71startswithr/)rrdrerrr=r]rhrirjrr�example_stubs            r�!test_get_output_mapping_with_stub�.TestBuildExt.test_get_output_mapping_with_stub�s�����2�F�;����D�d�K��%�%�'���(�(��5�	�"&�	���"�"�$��'�'�C�����]�D�9�(��'�'�/�/�����<�	�"�4�4�6�<�<�>�72�>���
�I�I�b�f�f�c�"�A�I�I�b�f�f�c�$:�:�>�	�73�74	B��
���8�$�%�q��'7��k��#�^�
���>�*�+�Q�/B�-C��k��)�+?�
���0�1�2�A�6P�4Q��k�/�0�2M�
75�76�	77�78���N�+�7�:�:�:���1�2�'�A�A�A��I�;�n�5�6���&�&�&��&�&�)��4K�'L�M�M�M�M��$�$�V�,�,�,�,��579s�AG�N)�__name__�80__module__�__qualname__�__firstlineno__rr3r?rLrkrw�__static_attributes__ryr!rrrs"���!�*4�@�"81�@'-r!rc�0�\rSrSrSSjrSrSrSrSrg)	�TestBuildExtInplace�c��S00S.S.n[R"U5 [SS/US9n[[	U/S95nSUl[
U5n[U5R"SS	S82S.UD6 UR5 U$)
Nz#include missingheader.h83)�lib�tmp)r$z.buildr#r$)�optionalr'�setup.pyz84.build/libz85.build/tmp)r]�86build_tempry)87rrIr88rr-rGr�vars�updater\)rr��optsrJr2rrs       r�get_build_ext_cmd�%TestBuildExtInplace.get_build_ext_cmd�s���2� ��,�=89��	
�90�91�5���k�H�:��I�	��D�i�[�9�:��%�����o���S�	���Q�<�L�Q�D�Q������92r!c��UR5nURR5URR5-UR-$)z�93Historically, distutils "logged" by printing to sys.std*.94Later versions adopted the logging framework. Grab95messages regardless of how they were captured.96)�97readouterr�out�98splitlines�err�messages)r�caplog�capsys�stds    r�get_log_messages�$TestBuildExtInplace.get_log_messages�s@�����!���w�w�!�!�#�c�g�g�&8�&8�&:�:�V�_�_�L�Lr!c��URSSS9nUR5 [SURX#555(deg)zj99If optional extensions fail to build, setuptools should show the error100in the logs but not fail to build101T�r��inplacec3�&# �UHnSv� M	 g7f)z0build_ext: building extension "spam.eggs" failedNry)�.0�msgs  r�	<genexpr>�4TestBuildExtInplace.test_optional.<locals>.<genexpr>�s���102�<��
?�<�s�N)r��run�anyr�)rrdr�r�rs     r�
test_optional�!TestBuildExtInplace.test_optional�sQ��103�$�$�d�D�$�A�����	��104��,�,�V�<�105�106�107�	108�109r!c��URSSS9n[R"[5 UR	5 SSS5 g!,(df   g=f)NFTr�)r��pytest�raisesr	r�)rrdrs   r�test_non_optional�%TestBuildExtInplace.test_non_optional�s8���$�$�e�T�$�B��
�]�]�<�
(��G�G�I�)�
(�
(�s�A�110AryN)r��bool�returnr)	rzr{r|r}r�r�r�r�r~ryr!rr�r��s���M�111112�r!r�c���[S5[S5[S5S.n[R"U5 [R"S/SS9unup4US:Xd
S	US113U35eg)Nz�114            from setuptools import Extension, setup115            setup(116                name='foo',117                version='0.0.0',118                ext_modules=[Extension('foo', ['foo.c'])],119            )120            a�121            #include "Python.h"122 123            #if PY_MAJOR_VERSION >= 3124 125            static struct PyModuleDef moduledef = {126                    PyModuleDef_HEAD_INIT,127                    "foo",128                    NULL,129                    0,130                    NULL,131                    NULL,132                    NULL,133                    NULL,134                    NULL135            };136 137            #define INITERROR return NULL138 139            PyMODINIT_FUNC PyInit_foo(void)140 141            #else142 143            #define INITERROR return144 145            void initfoo(void)146 147            #endif148            {149            #if PY_MAJOR_VERSION >= 3150                PyObject *module = PyModule_Create(&moduledef);151            #else152                PyObject *module = Py_InitModule("extension", NULL);153            #endif154                if (module == NULL)155                    INITERROR;156            #if PY_MAJOR_VERSION >= 3157                return module;158            #endif159            }160            zD161            [build]162            build_base = foo_build163            )r�zfoo.cz	setup.cfgrI)r�)r�data_streamrz	164STDOUT:165z	166STDERR:167)r
rrIr�run_setup_py)rdrJ�code�stdout�stderrs     r�test_build_ext_config_handlingr��s����
�	168��(
�*169�V�
�170�m<
�E�z	�J�J�u��(�5�5�
�I����D�171�6��1�9�?��F�8�;�v�h�?�?�9r!)!�172__future__rr;r0�importlib.utilrrpr��jaracor�setuptools.command.build_extrr�setuptools.distr�setuptools.errorsr	�setuptools.extensionr173rr�textwrapr
�distutils.command.build_ext�commandr�distutils.sysconfigr�builtin_module_namesr:rr�r�ryr!r�<module>r�sa��"�	�174�C�
��C�(�*�*���*�*�.�175��0�0�1760��[-�[-�|)�)�XC@r!
codekingpro/portable-devtools · Team Ai