
    (phOc                     ~   S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJr  S SK	r	S SK
r
SSKJr  S SKJr  \" SS5      rSKS	 jr\
R$                  " S
S9S 5       r\
R$                  " S
S9S 5       r\
R$                  " S
S9S 5       r\
R$                  " S
S9S 5       r\
R$                  " S
S9S 5       r\
R$                  " S
S9S 5       rS rS rS rS rS rS r\
R>                  RA                  \	RB                  " 5       S:g  =(       d    \RD                  S:*  SS9S 5       r#\
R>                  RA                  \	RB                  " 5       S:g  =(       d    \RD                  S:*  SS9S 5       r$\
R>                  RJ                  S 5       r&S r'S  r(S! r)S" r*S# r+S$ r,S% r-S& r.S' r/S( r0S) r1S* r2S+ r3S, r4\
R>                  RK                  S-S9S. 5       r5S/ r6S0 r7S1 r8S2 r9S3 r:S4 r;S5 r<S6 r=S7 r>\
R>                  RK                  S-S9S8 5       r?S9 r@S: rAS; rBS< rCS= rDS> rES? rFS@ rGSA rHSB rISC rJSD rKSE rLSF rMSG rNSH rOSI rPSJ rQg)L    N)Path)
namedtuple   )util)mainPPathsz(finp, f90inp, pyf, wrap77, wrap90, cmodfc                     [        U 5      n[        UR                  S5      UR                  S5      UR                  S5      UR                  U S35      UR                  U S35      UR                  U S35      S9$ )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      O/var/www/html/venv/lib/python3.13/site-packages/numpy/f2py/tests/test_f2py2e.pyget_io_pathsr      s~    . OEt$  (f%%89%(:;<oox01     session)scopec                     [         R                  " SSSS5      R                  5       nU R                  5       S-  nUR	                  USS9  U$ )'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_f90r-   9   sI     <<}=GGID		#	#	%	3BMM$M)Ir   c                     [         R                  " SSSS5      R                  5       nU R                  5       S-  nUR	                  USS9  U$ )z(F90 file for testing warnings in gh23598r   r   crackfortranzgh23598Warn.f90r!   r"   r$   r)   s      r   gh23598_warnr0   B   sK     <<8IJTTVD		#	#	%(9	9BMM$M)Ir   c                     [         R                  " SSSS5      R                  5       nU R                  5       S-  nUR	                  USS9  U$ )z8F90 file for testing disallowed CLI arguments in ghff819r   r   r    zgh_22819.pyfr!   r"   r$   r)   s      r   gh22819_clir2   K   sI     <<~>HHJD		#	#	%	6BMM$M)Ir   c                     [         R                  " SSSS5      R                  5       nU R                  5       S-  nUR	                  USS9  U$ )'Generates a single f77 file for testingr   r   r    zhi77.fzhello.fr!   r"   r$   r)   s      r   hello_world_f77r5   T   sI     <<x8BBDD		#	#	%		1BMM$M)Ir   c                     [         R                  " SSSS5      R                  5       nU R                  5       S-  nUR	                  USS9  U$ )r4   r   r   return_realzfoo77.fzfoo.fr!   r"   r$   r)   s      r   retreal_f77r8   ]   sI     <<yAKKMD		#	#	%	/BMM$M)Ir   c                 .   [         R                  " SSSS5      R                  5       n[         R                  " SSSS5      R                  5       nU R                  5       S-  nU R                  5       S-  nUR	                  USS	9  UR	                  USS	9  U$ )
r   r   r   f2cmapzisoFortranEnvMap.f90z.f2py_f2cmapz
f2cmap.f90mapfiler!   r"   r$   )r*   r+   r:   r,   fmaps        r   
f2cmap_f90r=   e   s     <<2HISSUD\\'5(NCMMOF		#	#	%	4B%%')3DMM$M)OOFWO-Ir   c                    [        U5      nUR                  [        SSU 3R                  5       5        [        R
                  " UR                  5         [        5         UR                  R                  S5       Vs/ s H%  oDR                  5       (       d  M  UR                  PM'     nnSU;  d   eSU;  d   eSU;   d   eSU;   d   e SSS5        gs  snf ! , (       d  f       g= f)	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 *zblahmodule.czblah-f2pywrappers.fztest_22819-f2pywrappers.fztest_22819module.cN)r   setattrsyssplitr   	switchdirparentf2pyclirglobis_filename)capfdr2   monkeypatchipathitem	gen_pathss         r   test_gh22819_clirP   q   s     EV}UG%<%B%B%DE		%	+0<<+=+=c+BU+B4llnYTYY+B	UY...$I555*i777#y000 
&	%U 
&	%s$   (C<CC("CC
C'c                 Z   [        U5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        R                  " [        SS9   [        5         SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)z6Only one .pyf file allowed
gh-22819
CLI :: .pyf files
r?   r@   z
 hello.pyfzOnly one .pyf file per call)matchN)r   rB   rC   rD   r   rE   rF   pytestraises
ValueErrorrG   )rK   r2   rL   rM   s       r   test_gh22819_many_pyfrV      st    
 EV}UG:%F%L%L%NO		%]]:-JKI L 
&	%KK 
&	%s$   B/B:B
B	B
B*c                 P   [        USS9nUR                  nUR                  [        SSU S3R	                  5       5        [
        R                  " UR                  5         [        5         UR                  R                  5       nSU;  d   e S S S 5        g ! , (       d  f       g = f)Ntestr   r?   f2py z -m testzintproductf2pywrap, intpr)r   r   rB   rC   rD   r   rE   rF   rG   r   r&   )rK   r0   rL   foutlrM   wrappers         r   test_gh23598_warnr]      s    V4ELLEV
wh%%') 
	%	,,((**'999 
&	%	%s    -B
B%c                    [        U5      n[        U5      R                  S-   nUR                  [        SSU SU 3R	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pVSU;   d   e[        U 5      R                  5       (       d   e SSS5        g! , (       d  f       g= f)zAEnsures that a signature file is generated via the CLI
CLI :: -h
r
   r?   zf2py -h  Saving signatures to fileN)r   stemrB   rC   rD   r   rE   rF   rG   
readouterrexists)rK   r-   rL   rM   opathout_s          r   test_gen_pyfrg      s     !E!&&/EVxwaw%?%E%E%GH		%	!!#*c111ug&&((((	 
&	%	%s   /AB??
Cc                 8   [        U5      nUR                  [        SSU 3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pESU;   d   eSU;   d   e SSS5        g! , (       d  f       g= f)z@Ensures that a signature file can be dumped to stdout
CLI :: -h
r?   zf2py -h stdout r`   zfunction hi() ! in N	r   rB   rC   rD   r   rE   rF   rG   rb   rK   r-   rL   rM   re   rf   s         r   test_gen_pyf_stdoutrk      s}     !EVug%>%D%D%FG		%	!!#*c111$+++	 
&	%	%s   -B
Bc                    [        U5      nUR                  [        SSU 3R                  5       5        [        R
                  " UR                  5         [        S5      R                  SSS9  [        R                  " [        5         [        5         U R                  5       u  pESU;   d   e SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)	zbEnsures that the CLI refuses to overwrite signature files
CLI :: -h without --overwrite-signature
r?   f2py -h faker.pyf 	faker.pyf	Fake newsr!   r"   z&Use --overwrite-signature to overwriteN)r   rB   rC   rD   r   rE   rF   r(   rS   rT   
SystemExitrG   rb   )rK   r-   rL   rM   rf   errs         r   test_gen_pyf_no_overwriterr      s     !EV'9%%A%G%G%IJ		%[$$[7$C]]:&I%%'FA;sBBB ' 
&	%&& 
&	%s$   4C%B?.C?
C		C
CLinux)      zCompiler and 3.12 required)reasonc                 (   [        U5      nUR                  [        SSU 3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pESU;   d   e SSS5        g! , (       d  f       g= f)z8Check that modules are named correctly

CLI :: defaults
r?   zf2py --backend meson -c zuntitledmodule.cNri   rj   s         r   test_untitled_clirx      sp     !EV'?w%G%M%M%OP		%	!!#!S((( 
&	%	%s   %B
Bc           	      h   Sn[        XS9nUR                  nUR                  [        SSU SU 3R	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pgSU;   d   e SSS5        UR                  [        SSR	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pgS	U;   d   e SSS5        S
nUR                  [        SSU SU S3R	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pgSU;   d   e SSS5        g! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g= f)ziCheck that no distutils imports are performed on 3.12
CLI :: --fcompiler --help-link --backend distutils
hirY   r?   rZ   z -c --fcompiler=gfortran -m z%--fcompiler cannot be used with mesonNzf2py --help-linkzUse --dep for meson buildshi2z -c -m z --backend distutilsz.Cannot use distutils backend with Python>=3.12)
r   r   rB   rC   rD   r   rE   rF   rG   rb   )rK   r-   rL   MNAMEr[   rM   re   rf   s           r   !test_no_py312_distutils_fcompilerr}      sj   
 E6ELLEVuUG#?wGMMO 
	%	!!#6#=== 
& V'..0 
	%	!!#+s222 
& EVuUG75'1EFLLN 
	%	!!#?3FFF 
&	% 
&	% 
&	% 
&	%s$   #%F%F%F#
F
F #
F1c                    [        USS9nUR                  nSnSnUR                  [        SSU SU 3R	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pxUR	                  5        H  n	SU	 S	3U;   a  M   e   UR	                  5        H  n
S
U
 S3U;   a  M   e   SSS5        g! , (       d  f       g= f)z1Tests that functions can be skipped
CLI :: skip:
rX   rY   t0 t4 t8 sd s8 s4td s0r?   rZ   z -m test skip: z=buildmodule: Could not found the body of interfaced routine "". Skipping.Constructing wrapper function ""N
r   r   rB   rC   rD   r   rE   rF   rG   rb   )rK   r8   rL   r[   rM   toskip	remainingre   rq   skeyrkeys              r   test_f2py_skipr      s    
 F3EJJE FIV
wofX.4468 
	%	##%LLNDOPTvUab # OO%D4TF!<CCC & 
&	%	%   &8C"CC
C c                    [        USS9nUR                  nSnSnUR                  [        SSU SU 3R	                  5       5        [
        R                  " UR                  5         [        5         U R                  5       u  pxUR	                  5        H  n	SU	 S	3U;   a  M   e   UR	                  5        H  n
S
U
 S3U;   a  M   e   SSS5        g! , (       d  f       g= f)z6Test that functions can be kept by only:
CLI :: only:
rX   rY   r   r   r?   rZ   z -m test only: <buildmodule: Could not find the body of interfaced routine "r   r   r   Nr   )rK   r8   rL   r[   rM   r   tokeepre   rq   r   r   s              r   test_f2py_onlyr     s     F3EJJE FFV
wofX.4468 
	%	##%LLNDNtfT`a # LLND4TF!<CCC # 
&	%	%r   c                    [        USS9nUR                  nSn[        U5      nSnSn	UR                  [        SSU SU	 S	U S
U 3R                  5       5        [        R                  " UR                  5         [        5         U R                  5       u  pUR                  5        H  nSU S3U;   a  M   e   UR                  5        H  nSU S3U
;   a  M   e   SSS5        g! , (       d  f       g= f)zZTests that it is possible to return to file processing mode
CLI :: :
BUG: numpy-gh #20520
rX   rY   r   ztd s0 hiblahr?   rZ    -m z only: z : r   r   r   r   N)r   r   r   rB   rC   rD   r   rE   rF   rG   rb   )rK   r-   r8   rL   r[   rM   r   ipath2r   r   re   rq   r   r   s                 r   test_file_processing_switchr   '  s     F3EJJE F/"FFE
wd5'F8<BB 	
 
	%	##%LLNDNtfT`a # LLND4TF!<CCC # 
&	%	%s   98C%5C%C%%
C3c                    Sn[        XS9nUR                  nUR                  [        SSU SU 3R	                  5       5        [
        R                  " UR                  5         [        5         SSS5        [        R                  " UR                  5      (       d   e[        R                  " UR                  5      (       d   eg! , (       d  f       N]= f)z@Checks the generation of files based on a module name
CLI :: -m
rz   rY   r?   rZ   r   N)r   r   rB   rC   rD   r   rE   rF   rG   r   rc   r   r   )rK   r-   rL   r|   r[   rM   s         r   test_mod_gen_f77r   E  s     E6ELLEVuUG4w%?%E%E%GH		%	 
& ;;u{{####;;u||$$$$ 
&	%s   #C
Cc           	         Sn[        XS9nUR                  nUR                  [        SSU SU S3R	                  5       5        [
        R                  " UR                  5         [        5         [        S5      R                  5        nUR                  5       nSU;   d   e S	S	S	5        S	S	S	5        g	! , (       d  f       N= f! , (       d  f       g	= f)
zuCheck that pyf files are correctly generated with module structure
CLI :: -m <name> -h pyf_file
BUG: numpy-gh #20520
rz   rY   r?   rZ   r   z
 -h hi.pyfzhi.pyfzpython module hiN)r   r   rB   rC   rD   r   rE   rF   rG   r   openread)rK   r5   rL   r|   r[   rM   hipyfpyfdats           r   test_mod_gen_gh25263r   V  s    
 E6EJJEVuUG4wj%I%O%O%QR		%	(^  "eZZ\F%/// # 
&	%"" 
&	%s$   $$CB3"C3
C	=C
Cc                 (   [        USS9nUR                  n[        R                  " S5      n[        R                  " S5      nUR	                  [
        SSU S3R                  5       5        [        R                  " UR                  5         [        5         U R                  5       u  pxUR                  U5      c   eUR                  U5      b   e SSS5        UR	                  [
        SSU S	3R                  5       5        [        R                  " UR                  5         [        5         U R                  5       u  pxUR                  U5      b   eUR                  U5      c   e SSS5        g! , (       d  f       N= f! , (       d  f       g= f)
z@Lowers cases by flag or when -h is present

CLI :: --[no-]lower
rX   rY   zHI\(\)zhi\(\)r?   rZ   z -m test --lowerNz -m test --no-lower)r   r   recompilerB   rC   rD   r   rE   rF   rG   rb   search	rK   r5   rL   r[   rM   capshicapslore   rf   s	            r   test_lower_cmodr   f  sB   
 7EJJEZZ	"FZZ	"FVuUG3C%D%J%J%LM		%	!!#}}S!---}}S!)))	 
& Vw&9:@@BD		%	!!#}}S!)))}}S!---	 
&	% 
&	% 
&	%s   AE2#AF2
F 
Fc           	      \   [        USS9nUR                  n[        R                  " S5      n[        R                  " S5      nUR	                  [
        SSU SUR                   S3R                  5       5        [        R                  " UR                  5         [        5         U R                  5       u  pxUR                  U5      c   eUR                  U5      b   e S	S	S	5        UR	                  [
        SSU SUR                   S
3R                  5       5        [        R                  " UR                  5         [        5         U R                  5       u  pxUR                  U5      b   eUR                  U5      c   e S	S	S	5        g	! , (       d  f       N= f! , (       d  f       g	= f)zVLowers cases in signature files by flag or when -h is present

CLI :: --[no-]lower -h
rX   rY   z	Block: HIz	Block: hir?   rZ   z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r   r   r   r   rB   rC   r   rD   r   rE   rF   rG   rb   r   r   s	            r   test_lower_sigr     s`   
 7EJJEZZ%FZZ%F 
wd599+%CDJJL 
	%	!!#}}S!---}}S!)))	 
& 
wd599+%NO		 
	%	!!#}}S!)))}}S!---	 
&	% 
&	% 
&	%s   AF=AF
F
F+c           
      D   [        U5      nSnSnUR                  [        SSU SU SU 3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pgSU S3U;   d   e S	S	S	5        g	! , (       d  f       g	= f)
zFEnsures that the build directory can be specified

CLI :: --build-dir
r   tttmpr?   f2py -m r_   z --build-dir zWrote C/API module "r   Nri   )rK   r-   rL   rM   r   odirre   rf   s           r   test_build_dirr     s    
 !EEDV"5'5'tfEKKMO 
	%	!!#&ugR0C777 
&	%	%s   )B
Bc                 \   [        U5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        S5      R                  SSS9  [        5         U R                  5       u  pESU;   d   e S	S	S	5        g	! , (       d  f       g	= f)
zPEnsures that the build directory can be specified

CLI :: --overwrite-signature
r?   rm   z --overwrite-signaturern   ro   r!   r"   r`   N)
r   rB   rC   rD   r   rE   rF   r(   rG   rb   rj   s         r   test_overwriter     s    
 !EV
UG#9:@@BD 
	%[$$[7$C	!!#*c111	 
&	%	%s   >B
B+c           	         [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;   d   e[        U S35      R                  5        nSUR                  5       ;   d   e S	S	S	5        S	S	S	5        g	! , (       d  f       N= f! , (       d  f       g	= f)
zBEnsures that TeX documentation is written out

CLI :: --latex-doc
r   r?   r   r_   z --latex-docDocumentation is saved to file
module.tex\documentclassNr   rB   rC   rD   r   rE   rF   rG   rb   r   r   rK   r-   rL   rM   r   re   rf   otexs           r   test_latexdocr     s    
 !EEV"5'5'>DDFH 
	%	!!#/3666UG:&',,.$$		333 /	 
&	% /.	 
&	%s%   ACC3C
C	C
C#c           	      4   [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;  d   e SSS5        g! , (       d  f       g= f)zEEnsures that TeX documentation is written out

CLI :: --no-latex-doc
r   r?   r   r_   z --no-latex-docr   Nri   rK   r-   rL   rM   r   re   rf   s          r   test_nolatexdocr     s    
 !EEV"5'5'AGGIK 
	%	!!#/s::: 
&	%	%   %B		
Bc           	         [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;   d   e[        SU S35      R                  5        nS	UR                  5       ;  d   e S
S
S
5        S
S
S
5        g
! , (       d  f       N= f! , (       d  f       g
= f)zEnsures that truncated documentation is written out

TODO: Test to ensure this has no effect without --latex-doc
CLI :: --latex-doc --short-latex
r   r?   r   r_   z --latex-doc --short-latexr   ./r   r   Nr   r   s           r   test_shortlatexr     s     !EE
5'5'!;<BBD 
	%	!!#/3666BugZ()..0D$DIIK777 1	 
&	% 10	 
&	%%   ACC4C
C	C
C$c           	         [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;   d   e[        SU S35      R                  5        nS	UR                  5       ;   d   e S
S
S
5        S
S
S
5        g
! , (       d  f       N= f! , (       d  f       g
= f)zAEnsures that RsT documentation is written out

CLI :: --rest-doc
r   r?   r   r_   z --rest-doc#ReST Documentation is saved to filer   zmodule.restz.. -*- rest -*-Nr   )rK   r-   rL   rM   r   re   rf   orsts           r   test_restdocr     s    
 !EEV"5'5'=CCEG 
	%	!!#4;;;Bug[)*//1T%444 2	 
&	% 21	 
&	%r   c           	      4   [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;  d   e SSS5        g! , (       d  f       g= f)zDEnsures that TeX documentation is written out

CLI :: --no-rest-doc
r   r?   r   r_   z --no-rest-docr   Nri   r   s          r   test_norestexdocr     s    
 !EEV"5'5'@FFHJ 
	%	!!#4C??? 
&	%	%r   c           	         [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         [        SU S35      R                  5        nSUR                  5       ;   d   e S	S	S	5        S	S	S	5        g	! , (       d  f       N= f! , (       d  f       g	= f)
zAEnsures that debugging wrappers are written

CLI :: --debug-capi
r   r?   r   r_   z --debug-capir   r   z#define DEBUGCFUNCSN
r   rB   rC   rD   r   rE   rF   rG   r   r   )rK   r-   rL   rM   r   ocmods         r   test_debugcapir   #  s    
 !EEV"5'5'?EEGI 
	%	BugX&',,.%)UZZ\999 / 
&	%.. 
&	%s$   (B<B+B<+
B9	5B<<
C
zConsistently fails on CI.c           	         [        U 5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         [        R                  " S5      n[        R                  " USSS	9nS
n[        R                  " S5      nUR                  U:X  d   eUR                  U:X  d   e SSS5        g! , (       d  f       g= f)z=Ensures that debugging wrappers work

CLI :: --debug-capi -c
r   r?   r   r_   z -c --debug-capiz#python3 -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   rB   rC   rD   r   rE   rF   rG   shlex
subprocessruntextwrapdedentstdoutstderr)r-   rL   rM   r   cmd_runrouteouteerrs           r   test_debugcapi_bldr   3  s     !EEV"5'5'1ABHHJL 
	%	++EF~~gdWM 	  	 {{d"""{{d"""! 
&	%	%s   A3C
C%c           	      F   [        U5      nSnUR                  [        SSU SU 3R                  5       5        [        R
                  " UR                  5         [        5         SSS5        U R                  5       u  pVSU;   d   eUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;   d   e SSS5        g! , (       d  f       N= f! , (       d  f       g= f)zgEnsures that fortran subroutine wrappers for F77 are included by default

CLI :: --[no]-wrap-functions
r   r?   r   r_   N Fortran 77 wrappers are saved toz --wrap-functionsri   r   s          r   test_wrapfunc_defr   Q  s     !EEVxwaw%?%E%E%GH		%	 
&FC.#555 V"5'5'1BCIIKM 
	%	!!#2c999 
&	% 
&	% 
&	%s   D%D
D
D c           	      4   [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pVSU;  d   e SSS5        g! , (       d  f       g= f)z]Ensures that fortran subroutine wrappers for F77 can be disabled

CLI :: --no-wrap-functions
r   r?   r   r_   z --no-wrap-functionsr   Nri   r   s          r   test_nowrapfuncr   j  s    
 !EEV"5'5'1EFLLNP 
	%	!!#2#=== 
&	%	%r   c           	         [        U5      nSnUR                  [        SSU SU S3R                  5       5        [        R
                  " UR                  5         [        5         [        SU S35      R                  5        nUR                  5       nSU;   d   eS	U;   d   e S
S
S
5        S
S
S
5        g
! , (       d  f       N= f! , (       d  f       g
= f)zWAdd to the include directories

CLI :: -include
TODO: Document this in the help string
r   r?   r   r_   z' -include<stdbool.h> -include<stdio.h> r   r   z#include <stdbool.h>z#include <stdio.h>Nr   )rK   r-   rL   rM   r   r   ocmrs          r   test_inclheaderr   z  s     !EE
5'5'!HI	 
	%	BugX&',,.%::<D)T111'4/// / 
&	%.. 
&	%s$   (C!B5$C5
C	?C
Cc                      g)z7Add to the include directories

CLI :: --include-paths
N r   r   r   test_inclpathr          	r   c                      g)z3Add to the include directories

CLI :: --help-link
Nr   r   r   r   
test_hlinkr     r   r   c                 j   [        U5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pESU;   d   eSU;   d   eSU;   d   eSU;   d   eSU;   d   e S	S	S	5        g	! , (       d  f       g	= f)
zGCheck that Fortran-to-Python KIND specs can be passed

CLI :: --f2cmap
r?   r@   z --f2cmap mapfilez!Reading f2cmap from 'mapfile' ...z&Mapping "real(kind=real32)" to "float"z'Mapping "real(kind=real64)" to "double"z,Mapping "integer(kind=int64)" to "long_long"z0Successfully applied user defined f2cmap changesNri   )rK   r=   rL   rM   re   rf   s         r   test_f2cmapr     s    
 EV}UG;L%M%S%S%UV		%	!!#2c999;sBBB<CCCASHHHASHHH 
&	%	%s   AB$$
B2c                 <   [        U5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pE[        U5      S:X  d   e SSS5        g! , (       d  f       g= f)z!Reduce verbosity

CLI :: --quiet
r?   r@   z --quietr   N)
r   rB   rC   rD   r   rE   rF   rG   rb   lenrj   s         r   
test_quietr     ss    
 !EV}UG8%D%J%J%LM		%	!!#3x1}} 
&	%	%s   .B
Bc                 *   [        U5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        5         U R                  5       u  pESU;   d   e SSS5        g! , (       d  f       g= f)z%Increase verbosity

CLI :: --verbose
r?   r@   z
 --verboseanalyzelineNri   rj   s         r   test_verboser     sq    
 !EV}UG:%F%L%L%NO		%	!!#### 
&	%	%s   %B
Bc                 8   UR                  [        SSR                  5       5        [        R                  " [
        5         [        5         U R                  5       u  p#SSKnUR                  UR                  5       :X  d   e SSS5        g! , (       d  f       g= f)zEnsure version

CLI :: -v
r?   zf2py -vr   N)rB   rC   rD   rS   rT   rp   rG   rb   numpy__version__strip)rK   rL   re   rf   nps        r   test_versionr     se    
 VY__%67	z	"	!!#~~,,,	 
#	"	"s    AB
Bc                 v   [        U 5      nUR                  [        SSU S3R                  5       5        [        R
                  " UR                  5         [        5         [        R                  " S5      n[        R                  " USSS9nSnUR                  U:X  d   e S	S	S	5        g	! , (       d  f       g	= f)
z
CLI :: -c
r?   r@   z -cz"python -c "import blah; blah.hi()"Tr   r   r   N)r   rB   rC   rD   r   rE   rF   rG   r   r   r   r   )r-   rL   rM   r   r   r   s         r   test_npdistopr     s    
 !EV}UG3%?%E%E%GH		%	++DE~~gdWM{{d""" 
&	%	%s   AB**
B8c                      g)z
CLI :: -c --fcompiler
Nr   r   r   r   test_npd_fcompilerr         
 	r   c                      g)z
CLI :: -c --compiler
Nr   r   r   r   test_npd_compilerr     r   r   c                      g)z
CLI :: -c --help-fcompiler
Nr   r   r   r   test_npd_help_fcompilerr     r   r   c                      g)z
CLI :: -c --f77exec
Nr   r   r   r   test_npd_f77execr     r   r   c                      g)z
CLI :: -c --f90exec
Nr   r   r   r   test_npd_f90execr     r   r   c                      g)z
CLI :: -c --f77flags
Nr   r   r   r   test_npd_f77flagsr    r   r   c                      g)z
CLI :: -c --f90flags
Nr   r   r   r   test_npd_f90flagsr  #  r   r   c                      g)z
CLI :: -c --opt
Nr   r   r   r   test_npd_optr  +  r   r   c                      g)z
CLI :: -c --arch
Nr   r   r   r   test_npd_archr  3  r   r   c                      g)z
CLI :: -c --noopt
Nr   r   r   r   test_npd_nooptr
  ;  r   r   c                      g)z
CLI :: -c --noarch
Nr   r   r   r   test_npd_noarchr  C  r   r   c                      g)z
CLI :: -c --debug
Nr   r   r   r   test_npd_debugr  K  r   r   c                      g)z
CLI :: -c --link-<resource>
Nr   r   r   r   test_npd_link_autor  S  r   r   c                      g)z'
CLI :: -c -L/path/to/lib/ -l<libname>
Nr   r   r   r   test_npd_libr  [  r   r   c                      g)z
CLI :: -D<define>
Nr   r   r   r   test_npd_definer  c  r   r   c                      g)z
CLI :: -U<name>
Nr   r   r   r   test_npd_undefiner  k  r   r   c                      g)z
CLI :: -I/path/to/include/
Nr   r   r   r   test_npd_inclr  s  r   r   c                      g)z0
CLI :: <filename>.o <filename>.so <filename>.a
Nr   r   r   r   test_npd_linkerr  {  r   r   )untitled)Rr   r   rC   r   r   pathlibr   collectionsr   platformrS    r   numpy.f2py.f2py2er   rG   r   r   fixturer-   r0   r2   r5   r8   r=   rP   rV   r]   rg   rk   rr   markskipifsystemversion_inforx   r}   xfailr   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   r  r  r  r  r
  r  r  r  r  r  r  r  r  r   r   r   <module>r'     s   + + +  "    - 
HH	IN i  ! i  ! i  ! i  ! i  ! i  !(	
:)
,C X__&'1Ss7G7G77R7  9
)9
) X__&'1Ss7G7G77R\xyG zG> D D.D.D<%"0 .4$.N8"2"4$; 8,5$@ :  56# 7#::2> 0.		I$$- 56# 7#&																		r   