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   ú[/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/numpy/f2py/tests/test_f2py2e.pyÚget_io_paths   s    úr   Úsession)Ú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    rC   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
    r0   r1   z
 hello.pyfzOnly one .pyf file per call)ÚmatchN)r   r9   r:   r;   r   r<   r=   ÚpytestÚraisesÚ
ValueErrorr>   )r@   r*   rA   rB   r   r   r   Útest_gh22819_many_pyf…   s
    rH   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   r0   úf2py z -m testzintproductf2pywrap, intpr)r   r   r9   r:   r;   r   r<   r=   r>   r   r"   )r@   r)   rA   ÚfoutlrB   Úwrapperr   r   r   Útest_gh23598_warn‘   s    þ
rN   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	   r0   zf2py -h ú úSaving signatures to fileN)r   Ústemr9   r:   r;   r   r<   r=   r>   Ú
readouterrÚexists)r@   r(   rA   rB   ZopathÚoutÚ_r   r   r   Útest_gen_pyfž   s    rV   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
    r0   zf2py -h stdout rP   zfunction hi() ! in N©	r   r9   r:   r;   r   r<   r=   r>   rR   ©r@   r(   rA   rB   rT   rU   r   r   r   Útest_gen_pyf_stdout­   s    rY   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
    r0   úf2py -h faker.pyf ú	faker.pyfú	Fake newsr   r   z&Use --overwrite-signature to overwriteN)r   r9   r:   r;   r   r<   r=   r#   rE   rF   Ú
SystemExitr>   rR   )r@   r(   rA   rB   rU   Ú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
    r0   zf2py --backend meson -c zuntitledmodule.cNrW   rX   r   r   r   Útest_untitled_cliÉ   s    rd   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
    ÚhirJ   r0   rK   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   r9   r:   r;   r   r<   r=   r>   rR   )r@   r(   rA   ÚMNAMErL   rB   rT   rU   r   r   r   Ú!test_no_py312_distutils_fcompilerØ   s2    ÿ*
ÿ*ÿrg   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:
    rI   rJ   út0 t4 t8 sd s8 s4útd s0r0   rK   z -m test skip: z=buildmodule: Could not found the body of interfaced routine "ú". Skipping.úConstructing wrapper function "ú"N©
r   r   r9   r:   r;   r   r<   r=   r>   rR   )r@   r-   rA   rL   rB   ÚtoskipÚ	remainingrT   r^   ÚskeyÚrkeyr   r   r   Útest_f2py_skipø   s$    þ
ÿÿrr   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:
    rI   rJ   rh   ri   r0   rK   z -m test only: ú<buildmodule: Could not find the body of interfaced routine "rj   rk   rl   Nrm   )r@   r-   rA   rL   rB   rn   ÚtokeeprT   r^   rp   rq   r   r   r   Útest_f2py_only  s$    þ
ÿÿru   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
    rI   rJ   rh   ztd s0 hiÚblahr0   rK   ú -m z only: z : rs   rj   rk   rl   N)r   r   r   r9   r:   r;   r   r<   r=   r>   rR   )r@   r(   r-   rA   rL   rB   rn   Zipath2rt   r   rT   r^   rp   rq   r   r   r   Útest_file_processing_switch'  s*    ý
ÿÿrx   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
    re   rJ   r0   rK   rw   N)r   r   r9   r:   r;   r   r<   r=   r>   r   rS   r   r   )r@   r(   rA   rf   rL   rB   r   r   r   Útest_mod_gen_f77E  s    $ry   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
    re   rJ   r0   rK   rw   z
 -h hi.pyfzhi.pyfzpython module hiN)r   r   r9   r:   r;   r   r<   r=   r>   r   ÚopenÚread)r@   r,   rA   rf   rL   rB   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
    rI   rJ   zHI\(\)zhi\(\)r0   rK   z -m test --lowerNz -m test --no-lower)r   r   ÚreÚcompiler9   r:   r;   r   r<   r=   r>   rR   Úsearch©	r@   r,   rA   rL   rB   ZcapshiZcapslorT   rU   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
    rI   rJ   z	Block: HIz	Block: hir0   rK   z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r   r   r}   r~   r9   r:   r   r;   r   r<   r=   r>   rR   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
    rv   Ztttmpr0   úf2py -m rO   z --build-dir zWrote C/API module "rl   NrW   )r@   r(   rA   rB   r   ZodirrT   rU   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
    r0   rZ   z --overwrite-signaturer[   r\   r   r   rP   N)
r   r9   r:   r;   r   r<   r=   r#   r>   rR   rX   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
    rv   r0   rƒ   rO   z --latex-docúDocumentation is saved to fileú
module.texú\documentclassN©r   r9   r:   r;   r   r<   r=   r>   rR   rz   r{   ©r@   r(   rA   rB   r   rT   rU   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
    rv   r0   rƒ   rO   z --no-latex-docr†   NrW   ©r@   r(   rA   rB   r   rT   rU   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
    rv   r0   rƒ   rO   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
    rv   r0   rƒ   rO   z --rest-docú#ReST Documentation is saved to filerŽ   zmodule.restz.. -*- rest -*-Nr‰   )r@   r(   rA   rB   r   rT   rU   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
    rv   r0   rƒ   rO   z --no-rest-docr�   NrW   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
    rv   r0   rƒ   rO   z --debug-capirŽ   r
   z#define DEBUGCFUNCSN©
r   r9   r:   r;   r   r<   r=   r>   rz   r{   )r@   r(   rA   rB   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
    rv   r0   rƒ   rO   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   r9   r:   r;   r   r<   r=   r>   ÚshlexÚ
subprocessÚrunÚtextwrapÚdedentÚstdoutÚstderr)r(   rA   rB   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
    rv   r0   rƒ   rO   Nú Fortran 77 wrappers are saved toz --wrap-functionsrW   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
    rv   r0   rƒ   rO   z --no-wrap-functionsr¥   NrW   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
    rv   r0   rƒ   rO   z' -include<stdbool.h> -include<stdio.h> rŽ   r
   z#include <stdbool.h>z#include <stdio.h>Nr“   )r@   r(   rA   rB   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
    r0   r1   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 changesNrW   )r@   r/   rA   rB   rT   rU   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
    r0   r1   z --quietr   N)
r   r9   r:   r;   r   r<   r=   r>   rR   ÚlenrX   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
    r0   r1   z
 --verboseZanalyzelineNrW   rX   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
    r0   zf2py -vr   N)r9   r:   r;   rE   rF   r]   r>   rR   ÚnumpyÚ__version__Ústrip)r@   rA   rT   rU   Ú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
    r0   r1   z -cz"python -c "import blah; blah.hi()"Tr–   r—   r™   N)r   r9   r:   r;   r   r<   r=   r>   rš   r›   rœ   rŸ   )r(   rA   rB   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}   r:   r›   rš   Úpathlibr   Úcollectionsr   ÚplatformrE   Ú r   Znumpy.f2py.f2py2er   r>   r   r   Zfixturer(   r)   r*   r,   r-   r/   rC   rH   rN   rV   rY   r_   ÚmarkZskipifÚsystemÚversion_inford   rg   Zxfailrr   ru   rx   ry   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ž   (

'











ÿ
"

'
		
