+
   ^{c                      ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIt^ RIHt ^ RIHt ^RIHt R t]! RR	4      tRQR
 lt]P,                  ! RR7      R 4       t]P,                  ! RR7      R 4       t]P,                  ! RR7      R 4       t]P,                  ! RR7      R 4       t]P,                  ! RR7      R 4       t]P,                  ! RR7      R 4       tR tR tR tR t R t!R t"]PF                  PI                  ]PJ                  RR8*  RR7      ]PF                  PL                  R 4       4       t']PF                  PL                  R 4       t(]PF                  PR                  R 4       t*R t+R t,R  t-R! t.R" t/R# t0R$ t1R% t2R& t3R' t4]PF                  PL                  R( 4       t5R) t6R* t7R+ t8R, t9]PF                  Pu                  R-R7      R. 4       t;R/ t<R0 t=R1 t>]PF                  PI                  ]P~                  ! 4       R28g  R3R7      ]PF                  PL                  R4 4       4       t@R5 tAR6 tBR7 tCR8 tDR9 tER: tF]PF                  Pu                  R-R7      R; 4       tG]PF                  PI                  ]P~                  ! 4       R28g  ;'       g    ]PJ                  RR8*  R<R7      ]PF                  PL                  R= 4       4       tH]PF                  PI                  ]P~                  ! 4       R28g  ;'       g    ]PJ                  RR8*  R<R7      R> 4       tIR? tJR@ tKRA tLRB tMRC tNRD tORE tPRF tQRG tRRH tSRI tTRJ tURK tVRL tWRM tXRN tYRO tZRP t[R# )S    N)
namedtuple)Path)main)NOGIL_BUILD)utilc                      \         P                  ! 4       '       g   \        P                  ! R 4       R# \	        4        R# )z$CLI command needs a Fortran compilerN)r   has_fortran_compilerpytestskipf2pycli     A/usr/lib/python3.14/site-packages/numpy/f2py/tests/test_f2py2e.pycompiler_check_f2pyclir      s#    $$&&:;	r   PPathsz(finp, f90inp, pyf, wrap77, wrap90, cmodfc                    \        V 4      p\        VP                  R4      VP                  R4      VP                  R4      VP                  V R24      VP                  V R24      VP                  V R24      R7      # )a8  Takes in a temporary file for testing and returns the expected output and input paths

Here expected output is essentially one of any of the possible generated
files.

..note::

     Since this does not actually run f2py, none of these are guaranteed to
     exist, and module names are typically incorrect

Parameters
----------
fname_inp : str
            The input filename
mname : str, optional
            The name of the module, untitled by default

Returns
-------
genp : NamedTuple PPaths
        The possible paths which are generated, not all of which exist
z.fz.f90.pyfz-f2pywrappers.fz-f2pywrappers2.f90module.c)finpf90inppyfwrap77wrap90cmodf)r   r   with_suffix	with_name)	fname_inpmnamebpaths   && r   get_io_pathsr    &   s~    . OEt$  (f%%89%(:;<oox01 r   session)scopec                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )'Generates a single f90 file for testingtestssrcclizhiworld.f90z	hello.f90asciiencodingr   getpath	read_textgetbasetemp
write_texttmpdir_factoryfdatfns   &  r   hello_world_f90r4   M   sI     <<}=GGID		#	#	%	3BMM$M)Ir   c                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )z(F90 file for testing warnings in gh23598r%   r&   crackfortranzgh23598Warn.f90r(   r)   r+   r0   s   &  r   gh23598_warnr7   V   sK     <<8IJTTVD		#	#	%(9	9BMM$M)Ir   c                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )z8F90 file for testing disallowed CLI arguments in ghff819r%   r&   r'   zgh_22819.pyfr(   r)   r+   r0   s   &  r   gh22819_clir9   _   sI     <<~>HHJD		#	#	%	6BMM$M)Ir   c                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )'Generates a single f77 file for testingr%   r&   r'   zhi77.fzhello.fr(   r)   r+   r0   s   &  r   hello_world_f77r<   h   sI     <<x8BBDD		#	#	%		1BMM$M)Ir   c                    \         P                  ! RRRR4      P                  4       pV P                  4       R,          pVP	                  VRR7       V# )r;   r%   r&   return_realzfoo77.fzfoo.fr(   r)   r+   r0   s   &  r   retreal_f77r?   q   sI     <<yAKKMD		#	#	%	/BMM$M)Ir   c                J   \         P                  ! RRRR4      P                  4       p\         P                  ! RRRR4      P                  4       pV P                  4       R,          pV P                  4       R,          pVP	                  VRR	7       VP	                  VRR	7       V# )
r$   r%   r&   f2cmapzisoFortranEnvMap.f90z.f2py_f2cmapz
f2cmap.f90mapfiler(   r)   r+   )r1   r2   rA   r3   fmaps   &    r   
f2cmap_f90rD   y   s     <<2HISSUD\\'5(NCMMOF		#	#	%	4B%%')3DMM$M)OOFWO-Ir   c                   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        VP                  P                  R4       Uu. uF&  qDP                  4       '       g   K  VP                  NK(  	  ppRRR4       R# u upi   + '       g   i     R# ; i)zCheck that module names are handled correctly
gh-22819
Essentially, the -m name cannot be used to import the module, so the module
named in the .pyf needs to be used instead

CLI :: -m and a .pyf file
argvf2py -m blah *N)r   setattrsyssplitr   	switchdirparentr   rglobis_filename)capfdr9   monkeypatchipathitem	gen_pathss   &&&   r   test_gh22819_clirV      s     EV}UG%<%B%B%DE		%	%	+0<<+=+=c+BU+B4llnYTYY+B	U 
&	%U 
&	%	%s$   (CB< B<0C<CC	c           	        \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        P                  ! \        RR7      ;_uu_ 4        \        4        RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z6Only one .pyf file allowed
gh-22819
CLI :: .pyf files
rF   rG   z
 hello.pyfzOnly one .pyf file per call)matchN)r   rI   rJ   rK   r   rL   rM   r
   raises
ValueErrorr   )rQ   r9   rR   rS   s   &&& r   test_gh22819_many_pyfr[      s}    
 EV}UG:%F%L%L%NO		%	%]]:-JKKI L 
&	%KK 
&	%	%s$   %B2B	B2B/*B22C	c                 \   \        VR R7      pVP                  pVP                  \        RRV R2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        VP                  P                  4       pRRR4       R#   + '       g   i     R# ; i)testr   rF   f2py z -m testN)r    r   rI   rJ   rK   r   rL   rM   r   r   r-   )rQ   r7   rR   foutlrS   wrappers   &&&   r   test_gh23598_warnrb      sz    V4ELLEV
wh%%') 
	%	%	,,((* 
&	%	%	%s   +%BB+	c                l   \        V4      p\        V4      P                  R,           pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRRR4       R#   + '       g   i     R# ; i)zAEnsures that a signature file is generated via the CLI
CLI :: -h
r   rF   zf2py -h  N)
r   stemrI   rJ   rK   r   rL   rM   r   
readouterr)rQ   r4   rR   rS   opathout_s   &&&    r   test_gen_pyfrj      s     !E!&&/EVxwaw%?%E%E%GH		%	%	!!# 
&	%	%	%s   ;B""B3	c                .   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)z@Ensures that a signature file can be dumped to stdout
CLI :: -h
rF   zf2py -h stdout N	r   rI   rJ   rK   r   rL   rM   r   rf   rQ   r4   rR   rS   rh   ri   s   &&&   r   test_gen_pyf_stdoutrn      sg     !EVug%>%D%D%FG		%	%	!!# 
&	%	%	%   BB	c           	        \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        R4      P                  RRR7       \        P                  ! \        4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zbEnsures that the CLI refuses to overwrite signature files
CLI :: -h without --overwrite-signature
rF   f2py -h faker.pyf 	faker.pyf	Fake newsr(   r)   N)r   rI   rJ   rK   r   rL   rM   r/   r
   rY   
SystemExitr   rf   )rQ   r4   rR   rS   ri   errs   &&&   r   test_gen_pyf_no_overwriterv      s     !EV'9%%A%G%G%IJ		%	%[$$[7$C]]:&&I%%'FA ' 
&	%&& 
&	%	%s$   ?CC
	8C
CCC.	zPython 3.12 required)reasonc                .   \        V4      pVP                  \        RRV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)z8Check that modules are named correctly

CLI :: defaults
rF   zf2py --backend meson -c N)	r   rI   rJ   rK   r   rL   rM   r   rf   rm   s   &&&   r   test_untitled_cliry      si     !EV'?w%G%M%M%OP		%	% !!# 
&	%	%	%ro   c                2   Rp\        WR7      pVP                  pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgRRR4       VP                  \        RRR.4       \        P                  ! \        4      ;_uu_ 4        \        4        V P                  4       w  rgRRR4       VP                  \        R. R	O4       \        P                  ! \        4      ;_uu_ 4        \        4        \        4        V P                  4       w  rgRRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)
ziCheck that distutils backend and related options fail
CLI :: --fcompiler --help-link --backend distutils
hir^   rF   r_   z -c --fcompiler=gfortran -m Nf2pyz--help-link)r|   z	--backend	distutils)r    r   rI   rJ   rK   r   rL   rM   r   rf   r
   rY   rt   r   )rQ   r4   rR   MNAMEr`   rS   rh   ri   s   &&&     r   test_no_distutils_backendr      s)   
 E6ELLEVuUG#?wGMMO 
	%	% !!# 
&
 Vfm, 
z	"	"	!!# 
#
 V7 
z	"	" 	!!# 
#	"! 
&	% 
#	" 
#	"	"s$   .EE2.'FE/	2F	F	c                   \        VRR7      pVP                  pRpRpVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP	                  4        F  p	K  	  VP	                  4        F  p
K  	  RRR4       R#   + '       g   i     R# ; i)	z1Tests that functions can be skipped
CLI :: skip:
r]   r^   t0 t4 t8 sd s8 s4td s0rF   r_   z -m test skip: N
r    r   rI   rJ   rK   r   rL   rM   r   rf   )rQ   r?   rR   r`   rS   toskip	remainingrh   ru   skeyrkeys   &&&        r   test_f2py_skipr     s    
 F3EJJE FIV
wofX.4468 
	%	%	##%LLNDN OO%D% 
&	%	%	%   1ACC	c                   \        VRR7      pVP                  pRpRpVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxVP	                  4        F  p	K  	  VP	                  4        F  p
K  	  RRR4       R#   + '       g   i     R# ; i)	z6Test that functions can be kept by only:
CLI :: only:
r]   r^   r   r   rF   r_   z -m test only: Nr   )rQ   r?   rR   r`   rS   r   tokeeprh   ru   r   r   s   &&&        r   test_f2py_onlyr   &  s     F3EJJE FFV
wofX.4468 
	%	%	##%LLNDN LLNDN 
&	%	%	%r   c                   \        VRR7      pVP                  pRp\        V4      pRpRp	VP                  \        RRV RV	 R	V R
V 2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVP                  4        F  pK  	  VP                  4        F  pK  	  RRR4       R#   + '       g   i     R# ; i)zZTests that it is possible to return to file processing mode
CLI :: :
BUG: numpy-gh #20520
r]   r^   r   ztd s0 hiblahrF   r_    -m z only: z : N)r    r   r   rI   rJ   rK   r   rL   rM   r   rf   )rQ   r4   r?   rR   r`   rS   r   ipath2r   r   rh   ru   r   r   s   &&&&          r   test_file_processing_switchr   =  s     F3EJJE F/"FFE
wd5'F8<BB 	
 
	%	%	##%LLNDN LLNDN 
&	%	%	%s   ACC*	c                .   Rp\        WR7      pVP                  pVP                  \        RRV RV 2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        RRR4       R#   + '       g   i     R# ; i)z@Checks the generation of files based on a module name
CLI :: -m
r{   r^   rF   r_   r   N)	r    r   rI   rJ   rK   r   rL   rM   r   )rQ   r4   rR   r~   r`   rS   s   &&&   r   test_mod_gen_f77r   [  sk     E6ELLEVuUG4w%?%E%E%GH		%	%	 
&	%	%	%s   .BB	c           	        Rp\        WR7      pVP                  pVP                  \        RRV RV R2P	                  4       4       \
        P                  ! VP                  4      ;_uu_ 4        \        4        \        R4      P                  4       ;_uu_ 4       pVP                  4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zuCheck that pyf files are correctly generated with module structure
CLI :: -m <name> -h pyf_file
BUG: numpy-gh #20520
r{   r^   rF   r_   r   z
 -h hi.pyfzhi.pyfN)r    r   rI   rJ   rK   r   rL   rM   r   r   openread)rQ   r<   rR   r~   r`   rS   hipyfpyfdats   &&&     r   test_mod_gen_gh25263r   l  s    
 E6EJJEVuUG4wj%I%O%O%QR		%	%	(^  ""eZZ\F # 
&	%"" 
&	%	%s$   /,CB>	,C>C	CC"	c                   \        VRR7      pVP                  p\        P                  ! R4      p\        P                  ! R4      pVP	                  \
        RRV R2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxRRR4       VP	                  \
        RRV R	2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxRRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
z@Lowers cases by flag or when -h is present

CLI :: --[no-]lower
r]   r^   zHI\(\)zhi\(\)rF   r_   z -m test --lowerNz -m test --no-lower)r    r   recompilerI   rJ   rK   r   rL   rM   r   rf   	rQ   r<   rR   r`   rS   capshicapslorh   ri   s	   &&&      r   test_lower_cmodr   |  s    
 7EJJEZZ	"FZZ	"FVuUG3C%D%J%J%LM		%	%	!!# 
& Vw&9:@@BD		%	%	!!# 
&	% 
&	% 
&	%	%s   D4E4E	E	c           	        \        VRR7      pVP                  p\        P                  ! R4      p\        P                  ! R4      pVP	                  \
        RRV RVP                   R2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxR	R	R	4       VP	                  \
        RRV RVP                   R
2P                  4       4       \        P                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rxR	R	R	4       R	#   + '       g   i     L; i  + '       g   i     R	# ; i)zVLowers cases in signature files by flag or when -h is present

CLI :: --[no-]lower -h
r]   r^   z	Block: HIz	Block: hirF   r_   z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r    r   r   r   rI   rJ   r   rK   r   rL   rM   r   rf   r   s	   &&&      r   test_lower_sigr     s   
 7EJJEZZ%FZZ%F 
wd599+%CDJJL 
	%	%	!!# 
& 
wd599+%NO		 
	%	%	!!# 
&	% 
&	% 
&	%	%s   $E'E!E	!E2	c           
     B   \        V4      pRpRpVP                  \        RRV RV RV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rgRRR4       R#   + '       g   i     R# ; i)zFEnsures that the build directory can be specified

CLI :: --build-dir
r   tttmprF   f2py -m rd   z --build-dir Nrl   )rQ   r4   rR   rS   r   odirrh   ri   s   &&&     r   test_build_dirr     s    
 !EEDV"5'5'tfEKKMO 
	%	%	!!# 
&	%	%	%s   &BB	c                h   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        R4      P                  RRR7       \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)	zPEnsures that the build directory can be specified

CLI :: --overwrite-signature
rF   rq   z --overwrite-signaturerr   rs   r(   r)   N)
r   rI   rJ   rK   r   rL   rM   r/   r   rf   rm   s   &&&   r   test_overwriter     s    
 !EV
UG#9:@@BD 
	%	%[$$[7$C	!!# 
&	%	%	%s   9B  B1	c           	        \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rV\        V R24      P                  4       ;_uu_ 4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zBEnsures that TeX documentation is written out

CLI :: --latex-doc
r   rF   r   rd   z --latex-doc
module.texN
r   rI   rJ   rK   r   rL   rM   r   rf   r   rQ   r4   rR   rS   r   rh   ri   otexs   &&&     r   test_latexdocr     s    
 !EEV"5'5'>DDFH 
	%	%	!!#UG:&',,..$.	 
&	% /.	 
&	%	%s%   "AC	#B6	$C	6CC		C	c           	     :   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRRR4       R#   + '       g   i     R# ; i)zEEnsures that TeX documentation is written out

CLI :: --no-latex-doc
r   rF   r   rd   z --no-latex-docNrl   rQ   r4   rR   rS   r   rh   ri   s   &&&    r   test_nolatexdocr     sz    
 !EEV"5'5'AGGIK 
	%	%	!!# 
&	%	%	%   "B		B	c                    \         P                  ! 4       '       g   \        P                  ! R 4       \        P
                  ! R4      pV R,          p\        VR4      ;_uu_ 4       pVP                  V4       RRR4       \        P                  RRR\        V4      RRR	.p\        P                  ! W@R
7       R#   + '       g   i     LJ; i)zNo Fortran compiler foundz(
        subroutine foo
        end
    ztest_latex.f90wNz-mz
numpy.f2pyz-c
test_latexz--latex-doc)cwd)r   r	   r
   r   textwrapdedentr   writerJ   
executablestr
subprocess
check_call)tmp_pathfsourcefpathfcmds   &    r   test_latex_doc_gh30268r      s     $$&&/0oo  	G
 ''E	eS		Q	 
 >>4tSZ|Ub
cC#,	 
	s   %B99C		c           	        \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rV\        RV R24      P                  4       ;_uu_ 4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zEnsures that truncated documentation is written out

TODO: Test to ensure this has no effect without --latex-doc
CLI :: --latex-doc --short-latex
r   rF   r   rd   z --latex-doc --short-latex./r   Nr   r   s   &&&     r   test_shortlatexr     s     !EE
5'5'!;<BBD 
	%	%	!!#BugZ()..00D0	 
&	% 10	 
&	%	%%   "AC
$B7	%C
7CC

C	c           	        \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rV\        RV R24      P                  4       ;_uu_ 4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zAEnsures that RsT documentation is written out

CLI :: --rest-doc
r   rF   r   rd   z --rest-docr   zmodule.restNr   )rQ   r4   rR   rS   r   rh   ri   orsts   &&&     r   test_restdocr   )  s    
 !EEV"5'5'=CCEG 
	%	%	!!#Bug[)*//11T1	 
&	% 21	 
&	%	%r   c           	     :   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRRR4       R#   + '       g   i     R# ; i)zDEnsures that TeX documentation is written out

CLI :: --no-rest-doc
r   rF   r   rd   z --no-rest-docNrl   r   s   &&&    r   test_norestexdocr   ;  sz    
 !EEV"5'5'@FFHJ 
	%	%	!!# 
&	%	%	%r   c           	        \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        RV R24      P                  4       ;_uu_ 4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zAEnsures that debugging wrappers are written

CLI :: --debug-capi
r   rF   r   rd   z --debug-capir   r   N)	r   rI   rJ   rK   r   rL   rM   r   r   )rQ   r4   rR   rS   r   ocmods   &&&   r   test_debugcapir   K  s    
 !EEV"5'5'?EEGI 
	%	%	BugX&',,..%. 
&	%.. 
&	%	%s$   "0B8B%	B8%B50B88C		z2Consistently fails on CI; noisy so skip not xfail.c           	        \        V 4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                  ! \        P                   R24      p\        P                  ! VRRR	7      pR
p\        P                  ! R4      pRRR4       R#   + '       g   i     R# ; i)z=Ensures that debugging wrappers work

CLI :: --debug-capi -c
r   rF   r   rd   z -c --debug-capi -c "import blah; blah.hi()"TUTF-8capture_outputr*    Hello World
a   debug-capi:Python C/API function blah.hi()
debug-capi:float hi=:output,hidden,scalar
debug-capi:hi=0
debug-capi:Fortran subroutine `f2pywraphi(&hi)'
debug-capi:hi=0
debug-capi:Building return value.
debug-capi:Python C/API function blah.hi: successful.
debug-capi:Freeing memory.
        N)r   rI   rJ   rK   r   rL   rM   r   shlexr   r   runr   r   )r4   rR   rS   r   cmd_runrouteouteerrs   &&      r   test_debugcapi_bldr   [  s     !EEV"5'5'1ABHHJL 
	%	%	++ 00NOP~~gdWM 	  	 
&	%	%	%s   "A#CC 	c           	     P   \        V4      pRpVP                  \        RRV RV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        RRR4       V P                  4       w  rVVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zgEnsures that fortran subroutine wrappers for F77 are included by default

CLI :: --[no]-wrap-functions
r   rF   r   rd   Nz --wrap-functionsrl   r   s   &&&    r   test_wrapfunc_defr   y  s     !EEVxwaw%?%E%E%GH		%	%	 
&FC V"5'5'1BCIIKM 
	%	%	!!# 
&	% 
&	% 
&	%	%s   !DDD	D%	c           	     :   \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rVRRR4       R#   + '       g   i     R# ; i)z]Ensures that fortran subroutine wrappers for F77 can be disabled

CLI :: --no-wrap-functions
r   rF   r   rd   z --no-wrap-functionsNrl   r   s   &&&    r   test_nowrapfuncr     s{    
 !EEV"5'5'1EFLLNP 
	%	%	!!# 
&	%	%	%r   c           	        \        V4      pRpVP                  \        RRV RV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        RV R24      P                  4       ;_uu_ 4       pVP                  4       pRRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	zWAdd to the include directories

CLI :: -include
TODO: Document this in the help string
r   rF   r   rd   z' -include<stdbool.h> -include<stdio.h> r   r   N)
r   rI   rJ   rK   r   rL   rM   r   r   r   )rQ   r4   rR   rS   r   r   ocmrs   &&&    r   test_inclheaderr     s     !EE
5'5'!HI	 
	%	%	BugX&',,..%::<D / 
&	%.. 
&	%	%s$   "0CB5	#C5C CC	LinuxzCompiler requiredc                   \        V4      pRpRpRpVP                  \        RRV RV RV RV 2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        V4      P                  4        \        4        \        V R	24      P                  4       ;_uu_ 4       pVP                  4       pR
R
R
4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     R
# ; i)zLEnsures that the extra object can be specified when using meson backend
    r   r   zextra.orF   z!f2py --backend meson --build-dir r   z -c rd   z/meson.buildN)r   rI   rJ   rK   r   rL   rM   touchr   r   r   )	rQ   r4   rR   rS   r   r   obj
mesonbuildmblds	   &&&      r   test_cli_objr     s    
 !EED
CV;D6eWDQTPUUVW\V]^ddfh 
	%	%S	 TF,'(--//:??$D 0 
&	% 0/ 
&	%	%s%   +AC)3C	C)C&!C))C:	c                     R# )z7Add to the include directories

CLI :: --include-paths
Nr   r   r   r   test_inclpathr          	r   c                     R# )z3Add to the include directories

CLI :: --help-link
Nr   r   r   r   
test_hlinkr     r   r   c                0   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)zGCheck that Fortran-to-Python KIND specs can be passed

CLI :: --f2cmap
rF   rG   z --f2cmap mapfileNrl   )rQ   rD   rR   rS   rh   ri   s   &&&   r   test_f2cmapr     sj    
 EV}UG;L%M%S%S%UV		%	%	!!# 
&	%	%	%   BB	c                0   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)z!Reduce verbosity

CLI :: --quiet
rF   rG   z --quietNrl   rm   s   &&&   r   
test_quietr     si    
 !EV}UG8%D%J%J%LM		%	%	!!# 
&	%	%	%r   c                0   \        V4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        V P                  4       w  rERRR4       R#   + '       g   i     R# ; i)z%Increase verbosity

CLI :: --verbose
rF   rG   z
 --verboseNrl   rm   s   &&&   r   test_verboser     si    
 !EV}UG:%F%L%L%NO		%	%	!!# 
&	%	%	%r   c                    VP                  \        RRR.4       \        P                  ! \        4      ;_uu_ 4        \        4        V P                  4       w  r#^ RIpRRR4       R#   + '       g   i     R# ; i)zEnsure version

CLI :: -v
rF   r|   z-vN)rI   rJ   r
   rY   rt   r   rf   numpy)rQ   rR   rh   ri   nps   &&   r   test_versionr     sP    
 Vfd^4	z	"	"	!!# 
#	"	"	"s   !A''A8	c                   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                  ! \        P                   R24      p\        P                  ! VRRR7      pRpR	R	R	4       R	#   + '       g   i     R	# ; i)
z
CLI :: -c
rF   rG   z -cr   Tr   r   r   N)r   rI   rJ   rK   r   rL   rM   r   r   r   r   r   )r4   rR   rS   r   r   r   s   &&    r   test_npdistopr     s    
 !EV}UG3%?%E%E%GH		%	%	++ 00NOP~~gdWM	 
&	%	%	%s   AB44C	z*Compiler and Python 3.12 or newer requiredc                   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                   R2p\        '       d   VR,          pM	VR,          p\        P                  ! V4      p\        P                  ! VRRR	7      pR
p\        '       d   RRR4       R#   + '       g   i     R# ; i)z&
CLI :: --no-freethreading-compatible
rF   rG   z! -c --no-freethreading-compatible -c "import blah; blah.hi();z1import sys; assert sys._is_gil_enabled() is True""Tr   r   r   N)r   rI   rJ   rK   r   rL   rM   r   r   r   r   r   r   r4   rR   rS   r   r   r   r   s   &&     r    test_no_freethreading_compatibler  +  s     !EV}UG;\%]%c%c%ef		%	%   =>;GGC4KC++c"~~gdWM; 
&	%	%	%s   A9C!!C2	c                   \        V 4      pVP                  \        RRV R2P                  4       4       \        P
                  ! VP                  4      ;_uu_ 4        \        4        \        P                   R2p\        '       d   VR,          pM	VR,          p\        P                  ! V4      p\        P                  ! VRRR	7      pR
pR\        P                  9  d   RRR4       R#   + '       g   i     R# ; i)z#
CLI :: --freethreading_compatible
rF   rG   z -c --freethreading-compatibler   z2import sys; assert sys._is_gil_enabled() is False"r   Tr   r   r   LSAN_OPTIONSN)r   rI   rJ   rK   r   rL   rM   r   r   r   r   r   r   osenvironr  s   &&     r   test_freethreading_compatibler  E  s     !EV}UG;Y%Z%`%`%bc		%	%   =>;HHC4KC++c"~~gdWM+ 
&	%	%	%s   BC**C;	c                     R# )z
CLI :: -c --fcompiler
Nr   r   r   r   test_npd_fcompilerr	  a      
 	r   c                     R# )z
CLI :: -c --compiler
Nr   r   r   r   test_npd_compilerr  i  r
  r   c                     R# )z
CLI :: -c --help-fcompiler
Nr   r   r   r   test_npd_help_fcompilerr  q  r
  r   c                     R# )z
CLI :: -c --f77exec
Nr   r   r   r   test_npd_f77execr  y  r
  r   c                     R# )z
CLI :: -c --f90exec
Nr   r   r   r   test_npd_f90execr    r
  r   c                     R# )z
CLI :: -c --f77flags
Nr   r   r   r   test_npd_f77flagsr    r
  r   c                     R# )z
CLI :: -c --f90flags
Nr   r   r   r   test_npd_f90flagsr    r
  r   c                     R# )z
CLI :: -c --opt
Nr   r   r   r   test_npd_optr    r
  r   c                     R# )z
CLI :: -c --arch
Nr   r   r   r   test_npd_archr    r
  r   c                     R# )z
CLI :: -c --noopt
Nr   r   r   r   test_npd_nooptr    r
  r   c                     R# )z
CLI :: -c --noarch
Nr   r   r   r   test_npd_noarchr    r
  r   c                     R# )z
CLI :: -c --debug
Nr   r   r   r   test_npd_debugr     r
  r   c                     R# )z
CLI :: -c --link-<resource>
Nr   r   r   r   test_npd_link_autor"    r
  r   c                     R# )z'
CLI :: -c -L/path/to/lib/ -l<libname>
Nr   r   r   r   test_npd_libr$    r
  r   c                     R# )z
CLI :: -D<define>
Nr   r   r   r   test_npd_definer&    r
  r   c                     R# )z
CLI :: -U<name>
Nr   r   r   r   test_npd_undefiner(    r
  r   c                     R# )z
CLI :: -I/path/to/include/
Nr   r   r   r   test_npd_inclr*    r
  r   c                     R# )z0
CLI :: <filename>.o <filename>.so <filename>.a
Nr   r   r   r   test_npd_linkerr,    r
  r   )untitled)      )\r  platformr   r   r   rJ   r   collectionsr   pathlibr   r
   numpy.f2py.f2py2er   r   numpy.testing._private.utilsr    r   r   r   r    fixturer4   r7   r9   r<   r?   rD   rV   r[   rb   rj   rn   rv   markskipifversion_infoslowry   r   xfailr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   systemr   r   r   r   r   r   r   r   r  r  r	  r  r  r  r  r  r  r  r  r  r  r   r"  r$  r&  r(  r*  r,  r   r   r   <module>r=     s   	  	   
  "   - 4  
HH	IN i  ! i  ! i  ! i  ! i  ! i  !1&	
:)
,C C$$/8NO
)  P
) 8 8@ D D.D.D<%"0 .4$.N8"2"4$; - -$8,5$@ :  MN# O#::2> 0, X__&'1;NO*  P*&		I$$- MN# O# X__&'1QQc6F6F'6QG  I$ I$. X__&'1QQc6F6F'6QG  I$I$4																		r   