a
    ž˜ëjc  ã                   @   s  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	Z	d dl
Z
ddlmZ d dlmZ eddƒZd‡d
d„Ze
jdd�dd„ ƒZe
jdd�dd„ ƒZe
jdd�dd„ ƒZe
jdd�dd„ ƒZe
jdd�dd„ ƒZe
jdd�dd„ ƒZdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Ze
jj e	 !¡ d&k�p@ej"d'kd(d)�d*d+„ ƒZ#e
jj e	 !¡ d&k�plej"d'kd(d)�d,d-„ ƒZ$e
jj%d.d/„ ƒZ&d0d1„ Z'd2d3„ Z(d4d5„ Z)d6d7„ Z*d8d9„ Z+d:d;„ Z,d<d=„ Z-d>d?„ Z.d@dA„ Z/dBdC„ Z0dDdE„ Z1dFdG„ Z2dHdI„ Z3dJdK„ Z4e
jj5dLd)�dMdN„ ƒZ6dOdP„ Z7dQdR„ Z8dSdT„ Z9dUdV„ Z:dWdX„ Z;dYdZ„ Z<d[d\„ Z=d]d^„ Z>d_d`„ Z?e
jj5dLd)�dadb„ ƒZ@dcdd„ ZAdedf„ ZBdgdh„ ZCdidj„ ZDdkdl„ ZEdmdn„ ZFdodp„ ZGdqdr„ ZHdsdt„ ZIdudv„ ZJdwdx„ ZKdydz„ ZLd{d|„ ZMd}d~„ ZNdd€„ ZOd�d‚„ ZPdƒd„„ ZQd…d†„ ZRdS )ˆé    N)ÚPath)Ú
namedtupleé   )Úutil)ÚmainÚPPathsz(finp, f90inp, pyf, wrap77, wrap90, cmodfÚuntitledc              
   C   sR   t | ƒ}t| d¡| d¡| d¡| |› d�¡| |› d�¡| |› d�¡d�S )ax  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)Z	fname_inpÚmnameÚbpath© r   ú[/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/numpy/f2py/tests/test_f2py2e.pyÚget_io_paths   s    úr   Úsession)Zscopec                 C   s2   t  dddd¡ ¡ }|  ¡ d }|j|dd� |S )ú'Generates a single f90 file for testingÚtestsÚsrcÚclizhiworld.f90z	hello.f90Úascii©Úencoding©r   ZgetpathÚ	read_textZgetbasetempÚ
write_text©Útmpdir_factoryÚfdatÚfnr   r   r   Úhello_world_f909   s    r'   c                 C   s2   t  dddd¡ ¡ }|  ¡ d }|j|dd� |S )z(F90 file for testing warnings in gh23598r   r   Zcrackfortranzgh23598Warn.f90r   r   r    r#   r   r   r   Úgh23598_warnB   s    r(   c                 C   s2   t  dddd¡ ¡ }|  ¡ d }|j|dd� |S )z8F90 file for testing disallowed CLI arguments in ghff819r   r   r   zgh_22819.pyfr   r   r    r#   r   r   r   Úgh22819_cliK   s    r)   c                 C   s2   t  dddd¡ ¡ }|  ¡ d }|j|dd� |S )ú'Generates a single f77 file for testingr   r   r   zhi77.fzhello.fr   r   r    r#   r   r   r   Úhello_world_f77T   s    r+   c                 C   s2   t  dddd¡ ¡ }|  ¡ d }|j|dd� |S )r*   r   r   Zreturn_realzfoo77.fzfoo.fr   r   r    r#   r   r   r   Úretreal_f77]   s    r,   c                 C   s`   t  dddd¡ ¡ }t  dddd¡ ¡ }|  ¡ d }|  ¡ d }|j|dd	� |j|dd	� |S )
r   r   r   Úf2cmapzisoFortranEnvMap.f90z.f2py_f2cmapz
f2cmap.f90Zmapfiler   r   r    )r$   r%   r-   r&   Zfmapr   r   r   Ú
f2cmap_f90e   s    r.   c                 C   s¤   t |ƒ}| tdd|› � ¡ ¡ t |j¡�d tƒ  dd„ |j d¡D ƒ}d|vsVJ ‚d|vsbJ ‚d|v snJ ‚d	|v szJ ‚d
s‚J ‚W d  ƒ n1 s–0    Y  dS )zÝCheck 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 c                 S   s   g | ]}|  ¡ r|j‘qS r   )Úis_fileÚname)Ú.0Úitemr   r   r   Ú
<listcomp>}   ó    z$test_gh22819_cli.<locals>.<listcomp>Ú*zblahmodule.czblah-f2pywrappers.fztest_22819-f2pywrappers.fztest_22819module.czIgnoring blahN)	r   ÚsetattrÚsysÚsplitr   Ú	switchdirÚparentÚf2pycliÚrglob)Úcapfdr)   ÚmonkeypatchÚipathZ	gen_pathsr   r   r   Útest_gh22819_cliq   s    rB   c              	   C   s†   t |ƒ}| tdd|› d� ¡ ¡ t |j¡�D tjt	dd�� t
ƒ  W d  ƒ n1 sZ0    Y  W d  ƒ n1 sx0    Y  dS )zBOnly one .pyf file allowed
    gh-22819
    CLI :: .pyf files
    r/   r0   z
 hello.pyfzOnly one .pyf file per call)ÚmatchN)r   r8   r9   r:   r   r;   r<   ÚpytestÚraisesÚ
ValueErrorr=   )r?   r)   r@   rA   r   r   r   Útest_gh22819_many_pyf…   s
    rG   c                 C   sx   t |dd�}|j}| tdd|› d� ¡ ¡ t |j¡�, tƒ  |j	 
¡ }d|vsVJ ‚W d   ƒ n1 sj0    Y  d S )NÚtest©r   r/   úf2py z -m testzintproductf2pywrap, intpr)r   r   r8   r9   r:   r   r;   r<   r=   r   r!   )r?   r(   r@   ÚfoutlrA   Úwrapperr   r   r   Útest_gh23598_warn‘   s    þ
rM   c                 C   s”   t |ƒ}t |ƒjd }| tdd|› d|› � ¡ ¡ t |j¡�@ tƒ  |  	¡ \}}d|v s`J ‚t |› ƒ 
¡ srJ ‚W d  ƒ n1 s†0    Y  dS )zIEnsures that a signature file is generated via the CLI
    CLI :: -h
    r	   r/   zf2py -h ú úSaving signatures to fileN)r   Ústemr8   r9   r:   r   r;   r<   r=   Ú
readouterrÚexists)r?   r'   r@   rA   ZopathÚoutÚ_r   r   r   Útest_gen_pyfž   s    rU   c                 C   sz   t |ƒ}| tdd|› � ¡ ¡ t |j¡�: tƒ  |  ¡ \}}d|v sLJ ‚d|v sXJ ‚W d  ƒ n1 sl0    Y  dS )zHEnsures that a signature file can be dumped to stdout
    CLI :: -h
    r/   zf2py -h stdout rO   zfunction hi() ! in N©	r   r8   r9   r:   r   r;   r<   r=   rQ   ©r?   r'   r@   rA   rS   rT   r   r   r   Útest_gen_pyf_stdout­   s    rX   c              	   C   sª   t |ƒ}| tdd|› � ¡ ¡ t |j¡�j t dƒjddd� t 	t
¡�. tƒ  |  ¡ \}}d|v sjJ ‚W d  ƒ n1 s~0    Y  W d  ƒ n1 sœ0    Y  dS )	zjEnsures 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   r8   r9   r:   r   r;   r<   r"   rD   rE   Ú
SystemExitr=   rQ   )r?   r'   r@   rA   rT   Úerrr   r   r   Útest_gen_pyf_no_overwriteº   s    r^   ÚLinux)é   é   zCompiler and 3.12 required)Úreasonc                 C   sn   t |ƒ}| tdd|› � ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|v sLJ ‚W d  ƒ n1 s`0    Y  dS )z@Check that modules are named correctly

    CLI :: defaults
    r/   zf2py --backend meson -c zuntitledmodule.cNrV   rW   r   r   r   Útest_untitled_cliÉ   s    rc   c              	   C   sP  d}t ||d�}|j}| tdd|› d|› � ¡ ¡ t |j¡�. tƒ  |  	¡ \}}d|v s`J ‚W d  ƒ n1 st0    Y  | tdd ¡ ¡ t |j¡�. tƒ  |  	¡ \}}d	|v s¼J ‚W d  ƒ n1 sÐ0    Y  d
}| tdd|› d|› d� ¡ ¡ t |j¡�0 tƒ  |  	¡ \}}d|v �s,J ‚W d  ƒ n1 �sB0    Y  dS )zqCheck that no distutils imports are performed on 3.12
    CLI :: --fcompiler --help-link --backend distutils
    ÚhirI   r/   rJ   z -c --fcompiler=gfortran -m z%--fcompiler cannot be used with mesonNzf2py --help-linkzUse --dep for meson buildsZhi2z -c -m z --backend distutilsz.Cannot use distutils backend with Python>=3.12)
r   r   r8   r9   r:   r   r;   r<   r=   rQ   )r?   r'   r@   ÚMNAMErK   rA   rS   rT   r   r   r   Ú!test_no_py312_distutils_fcompilerØ   s2    ÿ*
ÿ*ÿrf   c                 C   s¾   t |dd�}|j}d}d}| tdd|› d|› � ¡ ¡ t |j¡�f tƒ  |  	¡ \}}| ¡ D ]}	d|	› d	�|v s`J ‚q`| ¡ D ]}
d
|
› d�|v s‚J ‚q‚W d  ƒ n1 s°0    Y  dS )z9Tests that functions can be skipped
    CLI :: skip:
    rH   rI   út0 t4 t8 sd s8 s4útd s0r/   rJ   z -m test skip: z=buildmodule: Could not found the body of interfaced routine "ú". Skipping.úConstructing wrapper function "ú"N©
r   r   r8   r9   r:   r   r;   r<   r=   rQ   )r?   r,   r@   rK   rA   ÚtoskipÚ	remainingrS   r]   ÚskeyÚrkeyr   r   r   Útest_f2py_skipø   s$    þ
ÿÿrq   c                 C   s¾   t |dd�}|j}d}d}| tdd|› d|› � ¡ ¡ t |j¡�f tƒ  |  	¡ \}}| ¡ D ]}	d|	› d	�|v s`J ‚q`| ¡ D ]}
d
|
› d�|v s‚J ‚q‚W d  ƒ n1 s°0    Y  dS )z>Test that functions can be kept by only:
    CLI :: only:
    rH   rI   rg   rh   r/   rJ   z -m test only: ú<buildmodule: Could not find the body of interfaced routine "ri   rj   rk   Nrl   )r?   r,   r@   rK   rA   rm   ÚtokeeprS   r]   ro   rp   r   r   r   Útest_f2py_only  s$    þ
ÿÿrt   c                 C   sÖ   t |dd�}|j}d}t|ƒ}d}d}	| tdd|› d|	› d	|› d
|› � ¡ ¡ t |j¡�f t	ƒ  |  
¡ \}
}| ¡ D ]}d|› d�|v sxJ ‚qx| ¡ D ]}d|› d�|
v sšJ ‚qšW d  ƒ n1 sÈ0    Y  dS )zfTests that it is possible to return to file processing mode
    CLI :: :
    BUG: numpy-gh #20520
    rH   rI   rg   ztd s0 hiÚblahr/   rJ   ú -m z only: z : rr   ri   rj   rk   N)r   r   r   r8   r9   r:   r   r;   r<   r=   rQ   )r?   r'   r,   r@   rK   rA   rm   Zipath2rs   r   rS   r]   ro   rp   r   r   r   Útest_file_processing_switch'  s*    ý
ÿÿrw   c                 C   sŠ   d}t ||d�}|j}| tdd|› d|› � ¡ ¡ t |j¡� tƒ  W d  ƒ n1 s\0    Y  t	 
|j¡svJ ‚t	 
|j¡s†J ‚dS )zHChecks the generation of files based on a module name
    CLI :: -m
    rd   rI   r/   rJ   rv   N)r   r   r8   r9   r:   r   r;   r<   r=   r   rR   r   r   )r?   r'   r@   re   rK   rA   r   r   r   Útest_mod_gen_f77E  s    $rx   c              	   C   s¬   d}t ||d�}|j}| tdd|› d|› d� ¡ ¡ t |j¡�V tƒ  t	dƒ 
¡ �$}| ¡ }d|v slJ ‚W d	  ƒ n1 s€0    Y  W d	  ƒ n1 sž0    Y  d	S )
z�Check that pyf files are correctly generated with module structure
    CLI :: -m <name> -h pyf_file
    BUG: numpy-gh #20520
    rd   rI   r/   rJ   rv   z
 -h hi.pyfzhi.pyfzpython module hiN)r   r   r8   r9   r:   r   r;   r<   r=   r   ÚopenÚread)r?   r+   r@   re   rK   rA   ZhipyfZpyfdatr   r   r   Útest_mod_gen_gh25263V  s     r{   c           	      C   s&  t |dd�}|j}t d¡}t d¡}| tdd|› d� ¡ ¡ t |j	¡�F t
ƒ  |  ¡ \}}| |¡dusrJ ‚| |¡du s„J ‚W d  ƒ n1 s˜0    Y  | tdd|› d	� ¡ ¡ t |j	¡�H t
ƒ  |  ¡ \}}| |¡du sîJ ‚| |¡du�sJ ‚W d  ƒ n1 �s0    Y  dS )
zHLowers cases by flag or when -h is present

    CLI :: --[no-]lower
    rH   rI   zHI\(\)zhi\(\)r/   rJ   z -m test --lowerNz -m test --no-lower)r   r   ÚreÚcompiler8   r9   r:   r   r;   r<   r=   rQ   Úsearch©	r?   r+   r@   rK   rA   ZcapshiZcapslorS   rT   r   r   r   Útest_lower_cmodf  s$    

0ÿr€   c           	   	   C   s6  t |dd�}|j}t d¡}t d¡}| tdd|› d|j› d� ¡ ¡ t 	|j
¡�F tƒ  |  ¡ \}}| |¡d	uszJ ‚| |¡d	u sŒJ ‚W d	  ƒ n1 s 0    Y  | tdd|› d|j› d
� ¡ ¡ t 	|j
¡�H tƒ  |  ¡ \}}| |¡d	u sþJ ‚| |¡d	u�sJ ‚W d	  ƒ n1 �s(0    Y  d	S )z^Lowers cases in signature files by flag or when -h is present

    CLI :: --[no-]lower -h
    rH   rI   z	Block: HIz	Block: hir/   rJ   z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r   r   r|   r}   r8   r9   r   r:   r   r;   r<   r=   rQ   r~   r   r   r   r   Útest_lower_sig€  s0    

ý0ýr�   c              
   C   sŠ   t |ƒ}d}d}| tdd|› d|› d|› � ¡ ¡ t |j¡�6 tƒ  |  ¡ \}}d|› d�|v shJ ‚W d	  ƒ n1 s|0    Y  d	S )
zNEnsures that the build directory can be specified

    CLI :: --build-dir
    ru   Ztttmpr/   úf2py -m rN   z --build-dir zWrote C/API module "rk   NrV   )r?   r'   r@   rA   r   ZodirrS   rT   r   r   r   Útest_build_dir§  s    ÿrƒ   c                 C   s‚   t |ƒ}| tdd|› d� ¡ ¡ t |j¡�@ t dƒjddd� tƒ  |  	¡ \}}d|v s`J ‚W d	  ƒ n1 st0    Y  d	S )
zXEnsures that the build directory can be specified

    CLI :: --overwrite-signature
    r/   rY   z --overwrite-signaturerZ   r[   r   r   rO   N)
r   r8   r9   r:   r   r;   r<   r"   r=   rQ   rW   r   r   r   Útest_overwrite¸  s    þr„   c              	   C   s¼   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�p tƒ  |  ¡ \}}d|v sXJ ‚t |› d�ƒ 	¡ � }d| 
¡ v s|J ‚W d	  ƒ n1 s�0    Y  W d	  ƒ n1 s®0    Y  d	S )
zJEnsures that TeX documentation is written out

    CLI :: --latex-doc
    ru   r/   r‚   rN   z --latex-docúDocumentation is saved to fileú
module.texú\documentclassN©r   r8   r9   r:   r   r;   r<   r=   rQ   ry   rz   ©r?   r'   r@   rA   r   rS   rT   Zotexr   r   r   Útest_latexdocÉ  s    ÿrŠ   c              	   C   sz   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|vsXJ ‚W d  ƒ n1 sl0    Y  dS )zMEnsures that TeX documentation is written out

    CLI :: --no-latex-doc
    ru   r/   r‚   rN   z --no-latex-docr…   NrV   ©r?   r'   r@   rA   r   rS   rT   r   r   r   Útest_nolatexdocÛ  s    ÿrŒ   c              	   C   s¾   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�r tƒ  |  ¡ \}}d|v sXJ ‚t d|› d�ƒ 	¡ � }d	| 
¡ vs~J ‚W d
  ƒ n1 s’0    Y  W d
  ƒ n1 s°0    Y  d
S )zžEnsures that truncated documentation is written out

    TODO: Test to ensure this has no effect without --latex-doc
    CLI :: --latex-doc --short-latex
    ru   r/   r‚   rN   z --latex-doc --short-latexr…   ú./r†   r‡   Nrˆ   r‰   r   r   r   Útest_shortlatexë  s    ýrŽ   c              	   C   s¾   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�r tƒ  |  ¡ \}}d|v sXJ ‚t d|› d�ƒ 	¡ � }d	| 
¡ v s~J ‚W d
  ƒ n1 s’0    Y  W d
  ƒ n1 s°0    Y  d
S )zIEnsures that RsT documentation is written out

    CLI :: --rest-doc
    ru   r/   r‚   rN   z --rest-docú#ReST Documentation is saved to filer�   zmodule.restz.. -*- rest -*-Nrˆ   )r?   r'   r@   rA   r   rS   rT   Zorstr   r   r   Útest_restdoc  s    ÿr�   c              	   C   sz   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|vsXJ ‚W d  ƒ n1 sl0    Y  dS )zLEnsures that TeX documentation is written out

    CLI :: --no-rest-doc
    ru   r/   r‚   rN   z --no-rest-docr�   NrV   r‹   r   r   r   Útest_norestexdoc  s    ÿr‘   c              	   C   s¦   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�Z tƒ  t d|› d�ƒ ¡ � }d| 	¡ v sfJ ‚W d	  ƒ n1 sz0    Y  W d	  ƒ n1 s˜0    Y  d	S )
zIEnsures that debugging wrappers are written

    CLI :: --debug-capi
    ru   r/   r‚   rN   z --debug-capir�   r
   z#define DEBUGCFUNCSN©
r   r8   r9   r:   r   r;   r<   r=   ry   rz   )r?   r'   r@   rA   r   Úocmodr   r   r   Útest_debugcapi#  s    ÿr”   z2Consistently fails on CI; noisy so skip not xfail.c              	   C   s¦   t | ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�Z tƒ  t d¡}t	j
|ddd	�}d
}t d¡}|j|ksvJ ‚|j|ks„J ‚W d  ƒ n1 s˜0    Y  dS )zEEnsures that debugging wrappers work

    CLI :: --debug-capi -c
    ru   r/   r‚   rN   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   r8   r9   r:   r   r;   r<   r=   ÚshlexÚ
subprocessÚrunÚtextwrapÚdedentÚstdoutÚstderr)r'   r@   rA   r   Úcmd_runÚroutÚeoutZeerrr   r   r   Útest_debugcapi_bld3  s    ÿ


r£   c              	   C   sâ   t |ƒ}d}| tdd|› d|› � ¡ ¡ t |j¡� tƒ  W d  ƒ n1 sR0    Y  |  ¡ \}}d|v stJ ‚| tdd|› d|› d� ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|v sÀJ ‚W d  ƒ n1 sÔ0    Y  dS )zoEnsures that fortran subroutine wrappers for F77 are included by default

    CLI :: --[no]-wrap-functions
    ru   r/   r‚   rN   Nú Fortran 77 wrappers are saved toz --wrap-functionsrV   r‹   r   r   r   Útest_wrapfunc_defQ  s    $ÿr¥   c              	   C   sz   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|vsXJ ‚W d  ƒ n1 sl0    Y  dS )zeEnsures that fortran subroutine wrappers for F77 can be disabled

    CLI :: --no-wrap-functions
    ru   r/   r‚   rN   z --no-wrap-functionsr¤   NrV   r‹   r   r   r   Útest_nowrapfuncj  s    ÿr¦   c              	   C   s¶   t |ƒ}d}| tdd|› d|› d� ¡ ¡ t |j¡�j tƒ  t d|› d�ƒ ¡ �0}| 	¡ }d|v sjJ ‚d	|v svJ ‚W d
  ƒ n1 sŠ0    Y  W d
  ƒ n1 s¨0    Y  d
S )zcAdd to the include directories

    CLI :: -include
    TODO: Document this in the help string
    ru   r/   r‚   rN   z' -include<stdbool.h> -include<stdio.h> r�   r
   z#include <stdbool.h>z#include <stdio.h>Nr’   )r?   r'   r@   rA   r   r“   Zocmrr   r   r   Útest_inclheaderz  s    ýr§   c                   C   s   dS )z?Add to the include directories

    CLI :: --include-paths
    Nr   r   r   r   r   Útest_inclpath‘  s    r¨   c                   C   s   dS )z;Add to the include directories

    CLI :: --help-link
    Nr   r   r   r   r   Ú
test_hlinkš  s    r©   c                 C   s    t |ƒ}| tdd|› d� ¡ ¡ t |j¡�^ tƒ  |  ¡ \}}d|v sNJ ‚d|v sZJ ‚d|v sfJ ‚d|v srJ ‚d|v s~J ‚W d	  ƒ n1 s’0    Y  d	S )
zOCheck that Fortran-to-Python KIND specs can be passed

    CLI :: --f2cmap
    r/   r0   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 changesNrV   )r?   r.   r@   rA   rS   rT   r   r   r   Útest_f2cmap£  s    rª   c                 C   st   t |ƒ}| tdd|› d� ¡ ¡ t |j¡�2 tƒ  |  ¡ \}}t	|ƒdksRJ ‚W d  ƒ n1 sf0    Y  dS )z)Reduce verbosity

    CLI :: --quiet
    r/   r0   z --quietr   N)
r   r8   r9   r:   r   r;   r<   r=   rQ   ÚlenrW   r   r   r   Ú
test_quietµ  s    r¬   c                 C   sp   t |ƒ}| tdd|› d� ¡ ¡ t |j¡�. tƒ  |  ¡ \}}d|v sNJ ‚W d  ƒ n1 sb0    Y  dS )z-Increase verbosity

    CLI :: --verbose
    r/   r0   z
 --verboseZanalyzelineNrV   rW   r   r   r   Útest_verboseÃ  s    r­   c                 C   sl   |  tdd ¡ ¡ t t¡�< tƒ  |  ¡ \}}ddl}|j	| 
¡ ksJJ ‚W d  ƒ n1 s^0    Y  dS )z"Ensure version

    CLI :: -v
    r/   zf2py -vr   N)r8   r9   r:   rD   rE   r\   r=   rQ   ÚnumpyÚ__version__Ústrip)r?   r@   rS   rT   Únpr   r   r   Útest_versionÑ  s    r²   c                 C   s„   t | ƒ}| tdd|› d� ¡ ¡ t |j¡�B tƒ  t d¡}t	j
|ddd�}d}|j|ksbJ ‚W d	  ƒ n1 sv0    Y  d	S )
z
    CLI :: -c
    r/   r0   z -cz"python -c "import blah; blah.hi()"Tr•   r–   r˜   N)r   r8   r9   r:   r   r;   r<   r=   r™   rš   r›   rž   )r'   r@   rA   r    r¡   r¢   r   r   r   Útest_npdistopß  s    
r³   c                   C   s   dS )z
    CLI :: -c --fcompiler
    Nr   r   r   r   r   Útest_npd_fcompileró  s    r´   c                   C   s   dS )z
    CLI :: -c --compiler
    Nr   r   r   r   r   Útest_npd_compilerû  s    rµ   c                   C   s   dS )z$
    CLI :: -c --help-fcompiler
    Nr   r   r   r   r   Útest_npd_help_fcompiler  s    r¶   c                   C   s   dS )z
    CLI :: -c --f77exec
    Nr   r   r   r   r   Útest_npd_f77exec  s    r·   c                   C   s   dS )z
    CLI :: -c --f90exec
    Nr   r   r   r   r   Útest_npd_f90exec  s    r¸   c                   C   s   dS )z
    CLI :: -c --f77flags
    Nr   r   r   r   r   Útest_npd_f77flags  s    r¹   c                   C   s   dS )z
    CLI :: -c --f90flags
    Nr   r   r   r   r   Útest_npd_f90flags#  s    rº   c                   C   s   dS )z
    CLI :: -c --opt
    Nr   r   r   r   r   Útest_npd_opt+  s    r»   c                   C   s   dS )z
    CLI :: -c --arch
    Nr   r   r   r   r   Útest_npd_arch3  s    r¼   c                   C   s   dS )z
    CLI :: -c --noopt
    Nr   r   r   r   r   Útest_npd_noopt;  s    r½   c                   C   s   dS )z
    CLI :: -c --noarch
    Nr   r   r   r   r   Útest_npd_noarchC  s    r¾   c                   C   s   dS )z
    CLI :: -c --debug
    Nr   r   r   r   r   Útest_npd_debugK  s    r¿   c                   C   s   dS )z%
    CLI :: -c --link-<resource>
    Nr   r   r   r   r   Útest_npd_link_autoS  s    rÀ   c                   C   s   dS )z/
    CLI :: -c -L/path/to/lib/ -l<libname>
    Nr   r   r   r   r   Útest_npd_lib[  s    rÁ   c                   C   s   dS )z
    CLI :: -D<define>
    Nr   r   r   r   r   Útest_npd_definec  s    rÂ   c                   C   s   dS )z
    CLI :: -U<name>
    Nr   r   r   r   r   Útest_npd_undefinek  s    rÃ   c                   C   s   dS )z$
    CLI :: -I/path/to/include/
    Nr   r   r   r   r   Útest_npd_incls  s    rÄ   c                   C   s   dS )z8
    CLI :: <filename>.o <filename>.so <filename>.a
    Nr   r   r   r   r   Útest_npd_linker{  s    rÅ   )r   )Srœ   r|   r9   rš   r™   Úpathlibr   Úcollectionsr   ÚplatformrD   Ú r   Znumpy.f2py.f2py2er   r=   r   r   Zfixturer'   r(   r)   r+   r,   r.   rB   rG   rM   rU   rX   r^   ÚmarkZskipifÚsystemÚversion_inforc   rf   Zxfailrq   rt   rw   rx   r{   r€   r�   rƒ   r„   rŠ   rŒ   rŽ   r�   r‘   r”   Úskipr£   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>   sž   (

'











ÿ
"

'
		
