+
    SBis'                        ^ RI Ht ^ RIt^ RIt^ RIHt ^ RIt^ RIH	t	 ^ RI
HtHt ^ RIHt ^ RIHt ^ RIHt ^R	IHt ^R
IHt ^ RIHu Ht ^ RIHt R]P8                  9   t ! R R4      t ! R R4      tR t R# )    )annotationsN)cache_from_source)path)	build_extget_abi3_suffix)Distribution)CompileError)	Extension)environment)DALS)get_config_var__pypy__c                  :    ] tR t^tR tR tR tR tR tR t	Rt
R# )	TestBuildExtc                    \        4       p\        V4      pRVP                  R&   VP                  R4      p\        P                  P                  VR4      pW48X  g   Q hR# )ze
Setuptools needs to give back the same
result as distutils, even if the fullname
is not in ext_map.
 zfoo/barfooN)r   r   ext_mapget_ext_filenameorig)selfdistcmdreswanteds   &    D/usr/lib/python3.14/site-packages/setuptools/tests/test_build_ext.pytest_get_ext_filename"TestBuildExt.test_get_ext_filename   sR     ~o!#I""5)00e<}}    c                   \        \        4       4       \        RR.RR7      p\        \	        V.R7      4      p\        V4      pVP                  4        RVP                  9   g   Q hVP                  R4      p\        4       '       g%   VP                  \        R4      4      '       g   Q hR
# \        P                  R8X  d   VP                  R4      '       g   Q hR
# R	V9   g   Q hR
# )ze
Filename needs to be loadable by several versions
of Python 3 if 'is_abi3' is truthy on Extension()
	spam.eggseggs.cTpy_limited_apiext_modules
EXT_SUFFIXwin32zeggs.pydabi3N)printr   r
   r   dictr   finalize_optionsr   r   endswithr   sysplatform)r   	extensionr   r   r   s   &    r   test_abi3_filenameTestBuildExt.test_abi3_filename&   s    
 	o kH:dK	Di[9:ockk)))"";/  <<| <====\\W$<<
++++S= =r   c                   \        4       p\        V4      p\        RR.RR7      ;VP                  R&   pRVn        \
        '       g   VP                  R4      pMRp R\        P                  R&   VP                  R	4      pR
V8X  g   Q hVP                  R4      pWE8X  g   Q h \        P                  R R#   \        P                  R i ; i)zL
SETUPTOOLS_EXT_SUFFIX variable always overrides
default extension options.
for_abi3zs.cTr#   Fzfor_abi3.test-suffixz.test-suffixSETUPTOOLS_EXT_SUFFIXnormalznormal.test-suffixN)	r   r   r
   r   _links_to_dynamicIS_PYPYr   osenviron)r   r   r   extexpectr   s   &     r   test_ext_suffix_override%TestBuildExt.test_ext_suffix_override;   s    
 ~o(1G	)
 	
J# !&w))*5F ,F	42@BJJ./&&x0C'3...&&z2C= =

23

23s   AB6 6C	c           	     	    R RRRR///RRRR///p\        RR	.4      p\        R
R.4      p\        RR.4      p\        P                  ! V4       \        RRRW#V.RRR //4      # )srcmypkgsubpkgzext2.cr   zc-extensionsext1zmain.cz
mypkg.ext1zc-extensions/ext1/main.czmypkg.subpkg.ext2zsrc/mypkg/subpkg/ext2.cext3zc-extension/ext3.cscript_namez%test%r&   package_dir)r
   r   buildr   )r   filesrC   ext2rD   s   &    r   dist_with_exampleTestBuildExt.dist_with_example[   s    Gh278Vh^4

 (B'CD,/H.IJ"6!78

58D-B;
  	r   c           	     	^   VP                  R R4       VP                  RR4       V P                  4       pVP                  R4      pRVn        VP
                  ! 4        VP                  P                  \        P                  R4      pVP                  ! 4        Uu. uF"  qfP                  \        P                  R4      NK$  	  ppVV R2V R2V R2.8X  g   Q hVP                  ! 4       / 8X  g   Q hVP                  R4       R	Vn        VP
                  ! 4        VP                  ! 4       P                  4        UU	u/ uFD  w  rVP                  \        P                  R4      V	P                  \        P                  R4      bKF  	  p
pp	V
V R2R
V R2RV R2R/8X  g   Q hR# u upi u up	pi )r5   .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.mp3N)setenvsetattrrJ   get_command_objeditable_modeensure_finalized	build_libreplacer9   sepget_outputsget_output_mappingreinitialize_commanditems)r   
tmpdir_cwdmonkeypatchr   r   r[   xoutputskvmappings   &&&        r   test_get_outputsTestBuildExt.test_get_outputsl   s   2F;DeL%%' ((5	"'	""$''//<	3<3H3H3JK3Ja99RVVS)3JKk#k)k/0
 
 	
 

 ++-333 	!!+."&	""$ "446<<>
> IIbffc"AIIbffc$::> 	 
 k#^k)+?k/02M
 
 	
 
! L
s   (F$=A
F)c                	   VP                  R R4       VP                  RR4       V P                  4       pVP                  R4      pRVn        VP
                  ! 4        VP                   F  pVP                  VRR4       K  	  VP                  P                  \        P                  R4      pVP                  ! 4       P                  4        UUu/ uFD  w  rxVP                  \        P                  R4      VP                  \        P                  R4      bKF  	  p	ppR p
V	V
! V R24      V
! R	4      V R
2RV
! V R24      V
! R4      V R2RV
! V R24      V
! R4      V R2R/8X  g   Q hV R2V	9  g   Q hV R2V	9  g   Q hV
! V R24      pW9   g   Q hVP                  V R24      '       g   Q hVP                  R4      '       g   Q hR# u uppi )r5   rM   rN   Tr   _needs_stubrO   c                T    \        V 4      P                  \        P                  R4      # )zDMake it possible to do comparisons and tests in a OS-independent wayrO   )_compiled_file_namer\   r9   r]   )files   &r   C9TestBuildExt.test_get_output_mapping_with_stub.<locals>.C   s    &t,44RVVSAAr   z/ext3.pyzsrc/ext3.pyrP   rS   z/mypkg/ext1.pyzsrc/mypkg/ext1.pyrQ   rT   z/mypkg/subpkg/ext2.pyzsrc/mypkg/subpkg/ext2.pyrR   rU   z/mypkg/__pycache__/ext1z.pycN)rV   rW   rJ   rX   rY   rZ   
extensionsr[   r\   r9   r]   r_   ra   
startswithr-   )r   rb   rc   r   r   r;   r[   rf   rg   rh   rp   example_stubs   &&&         r   !test_get_output_mapping_with_stub.TestBuildExt.test_get_output_mapping_with_stub   s   2F;DdK%%' ((5	"&	""$''C]D9 ( ''//<	 "446<<>
> IIbffc"AIIbffc$::> 	 

	B 8$%q'7k#^>*+Q/B-Ck)+?012A6P4Qk/02M
 
 	
 
 N+7:::12'AAA I;n56&&&&&)4K'LMMMM$$V,,,,5
s   A
G N)__name__
__module____qualname____firstlineno__r   r1   r=   rJ   ri   ru   __static_attributes__rw   r   r   r   r      s"    !*4@"
@'-r   r   c                  4    ] tR t^tR R ltR tR tR tRtR# )TestBuildExtInplacec                    V ^8  d   QhRRRR/# )   optionalboolreturnr   rw   )formats   "r   __annotate__ TestBuildExtInplace.__annotate__   s      $ 9 r   c                	   R RRR/ R/ //p\         P                  ! V4       \        RR .VR7      p\        \	        V.R7      4      pRVn        \        V4      p\        V4      P                  ! RR	R
RR/VB  VP                  4        V# )r"   z#include missingheader.h
z.buildlibtmpr!   )r   r%   setup.pyr[   z
.build/lib
build_tempz
.build/tmprw   )
r   rG   r
   r   r+   rE   r   varsupdaterZ   )r   r   optsrH   r0   r   r   s   &&,    r   get_build_ext_cmd%TestBuildExtInplace.get_build_ext_cmd   s    2ub%,=
 	

5kH:I	Di[9:%oS	Q<QLQDQ
r   c                    VP                  4       pVP                  P                  4       VP                  P                  4       ,           VP                  ,           # )z
Historically, distutils "logged" by printing to sys.std*.
Later versions adopted the logging framework. Grab
messages regardless of how they were captured.
)
readouterrout
splitlineserrmessages)r   caplogcapsysstds   &&& r   get_log_messages$TestBuildExtInplace.get_log_messages   s@     !ww!!#cgg&8&8&::V__LLr   c                    V P                  RRR7      pVP                  4        \        ;QJ d+    R V P                  W#4       4       F  '       g   K   RM 	  RM! R V P                  W#4       4       4      '       g   Q hR# )zj
If optional extensions fail to build, setuptools should show the error
in the logs but not fail to build
Tr   inplacec              3  &   "   T F  pR x  K	  	  R# 5i)z0build_ext: building extension "spam.eggs" failedNrw   ).0msgs   & r   	<genexpr>4TestBuildExtInplace.test_optional.<locals>.<genexpr>   s      
< ?<s   FN)r   runanyr   )r   rb   r   r   r   s   &&&& r   test_optional!TestBuildExtInplace.test_optional   sq    
 $$dD$A	s 
,,V<
sss 
,,V<
 
 
 	
 
r   c                	    V P                  R RR7      p\        P                  ! \        4      ;_uu_ 4        VP	                  4        RRR4       R#   + '       g   i     R# ; i)FTr   N)r   pytestraisesr	   r   )r   rb   r   s   && r   test_non_optional%TestBuildExtInplace.test_non_optional   s>    $$eT$B]]<((GGI )(((s   AA"	rw   N)	rx   ry   rz   r{   r   r   r   r   r|   rw   r   r   r~   r~      s    M

r   r~   c                    R \        R4      R\        R4      R\        R4      /p\        P                  ! V4       \        P                  ! R.RR7      w  pw  r4V^ 8X  g   Q RV R	V 24       hR
# )r   z
            from setuptools import Extension, setup
            setup(
                name='foo',
                version='0.0.0',
                ext_modules=[Extension('foo', ['foo.c'])],
            )
            zfoo.ca  
            #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
            }
            z	setup.cfgzD
            [build]
            build_base = foo_build
            rG   )r   data_streamz	
STDOUT:
z	
STDERR:
N)r   r   )r   r   rG   r   run_setup_py)rb   rH   codestdoutstderrs   &    r   test_build_ext_config_handlingr      s    D	
 	(*
V 	T
m<Ez 	JJu(55ID
6 19?F8;vh??9r   )!
__future__r   r9   r.   importlib.utilr   rn   r   jaracor   setuptools.command.build_extr   r   setuptools.distr   setuptools.errorsr	   setuptools.extensionr
   r   r   textwrapr   distutils.command.build_extcommandr   distutils.sysconfigr   builtin_module_namesr8   r   r~   r   rw   r   r   <module>r      sa    " 	 
 C   C ( * *   * * .
00
0[- [-|) )XC@r   