403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/numpy/f2py/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/numpy/f2py/tests/__pycache__/test_f2py2e.cpython-312.pyc
�

	�g�p���ddlZddlZddlZddlZddlZddlmZddlmZddl	Z	ddl
Z
ddlmZddl
mZddlmZd�Zed	d
�ZdQd�Ze
j*d�
�d��Ze
j*d�
�d��Ze
j*d�
�d��Ze
j*d�
�d��Ze
j*d�
�d��Ze
j*d�
�d��Zd�Zd�Zd�Zd�Zd�Z d�Z!e
jDjGejHdkd��d��Z%e
jDjGe	jL�dk7xsejHdkd��d ��Z'e
jDjPd!��Z)d"�Z*d#�Z+d$�Z,d%�Z-d&�Z.d'�Z/d(�Z0d)�Z1d*�Z2d+�Z3d,�Z4d-�Z5d.�Z6d/�Z7e
jDjqd0��d1��Z9d2�Z:d3�Z;d4�Z<d5�Z=d6�Z>d7�Z?d8�Z@d9�ZAd:�ZBe
jDjqd0��d;��ZCe
jDjGe	jL�dk7xsejHdkd<��d=��ZDe
jDjGe	jL�dk7xsejHdkd<��d>��ZEd?�ZFd@�ZGdA�ZHdB�ZIdC�ZJdD�ZKdE�ZLdF�ZMdG�ZNdH�ZOdI�ZPdJ�ZQdK�ZRdL�ZSdM�ZTdN�ZUdO�ZVdP�ZWy)R�N)�Path)�
namedtuple�)�util)�main)�NOGIL_BUILDc�l�tj�stjd�yt	�y)Nz$CLI command needs a Fortran compiler)r�has_fortran_compiler�pytest�skip�f2pycli���>C:\Python312\Lib\site-packages\numpy/f2py/tests/test_f2py2e.py�compiler_check_f2pyclirs ���$�$�&����:�;��	r�PPathsz(finp, f90inp, pyf, wrap77, wrap90, cmodfc��t|�}t|jd�|jd�|jd�|j|�d��|j|�d��|j|�d����S)axTakes 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)rr�with_suffix�	with_name)�	fname_inp�mname�bpaths   r�get_io_pathsr!$s~��.
��O�E��
�
�
�t�
$�� � ��(����f�%����%���8�9����%��(:�;�<��o�o���x�0�1�
�r�session)�scopec��tjdddd�j�}|j�dz}|j	|d��|S)�'Generates a single f90 file for testing�tests�src�clizhiworld.f90z	hello.f90�ascii��encoding�r�getpath�	read_text�getbasetemp�
write_text��tmpdir_factory�fdat�fns   r�hello_world_f90r5KsI���<�<����}�=�G�G�I�D�	�	#�	#�	%��	3�B��M�M�$��M�)�
�Irc��tjdddd�j�}|j�dz}|j	|d��|S)z(F90 file for testing warnings in gh23598r&r'�crackfortranzgh23598Warn.f90r)r*r,r1s   r�gh23598_warnr8TsK���<�<����8I�J�T�T�V�D�	�	#�	#�	%�(9�	9�B��M�M�$��M�)�
�Irc��tjdddd�j�}|j�dz}|j	|d��|S)z8F90 file for testing disallowed CLI arguments in ghff819r&r'r(zgh_22819.pyfr)r*r,r1s   r�gh22819_clir:]sI���<�<����~�>�H�H�J�D�	�	#�	#�	%��	6�B��M�M�$��M�)�
�Irc��tjdddd�j�}|j�dz}|j	|d��|S)�'Generates a single f77 file for testingr&r'r(zhi77.fzhello.fr)r*r,r1s   r�hello_world_f77r=fsI���<�<����x�8�B�B�D�D�	�	#�	#�	%�	�	1�B��M�M�$��M�)�
�Irc��tjdddd�j�}|j�dz}|j	|d��|S)r<r&r'�return_realzfoo77.fzfoo.fr)r*r,r1s   r�retreal_f77r@osI���<�<���
�y�A�K�K�M�D�	�	#�	#�	%��	/�B��M�M�$��M�)�
�Irc�6�tjdddd�j�}tjdddd�j�}|j�dz}|j�dz}|j	|d�	�|j	|d�	�|S)
r%r&r'�f2cmapzisoFortranEnvMap.f90z.f2py_f2cmapz
f2cmap.f90�mapfiler)r*r,)r2r3rBr4�fmaps     r�
f2cmap_f90rEws����<�<����2H�I�S�S�U�D�
�\�\�'�5�(�N�
C�
M�
M�
O�F�	�	#�	#�	%��	4�B��%�%�'�)�3�D��M�M�$��M�)��O�O�F�W�O�-�
�Irc��t|�}|jtdd|��j��t	j
|j�5t�|jjd�D�cgc]}|j�s�|j��!}}d|vsJ�d|vsJ�d|vsJ�d|vsJ�	ddd�ycc}w#1swYyxYw)	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 �*zblahmodule.czblah-f2pywrappers.fztest_22819-f2pywrappers.fztest_22819module.cN)r�setattr�sys�splitr�	switchdir�parentr
�rglob�is_file�name)�capfdr:�monkeypatch�ipath�item�	gen_pathss      r�test_gh22819_clirW�s���
���E�����V�}�U�G�%<�%B�%B�%D�E�	
������	%���	�+0�<�<�+=�+=�c�+B�U�4�d�l�l�n�T�Y�Y�U�	�U��Y�.�.�.�$�I�5�5�5�*�i�7�7�7�#�y�0�0�0�����U���s$�(C�;C�C�C�C�Cc�H�t|�}|jtdd|�d�j��t	j
|j�5tjtd��5t�ddd�ddd�y#1swY�xYw#1swYyxYw)zBOnly one .pyf file allowed
    gh-22819
    CLI :: .pyf files
    rGrHz
 hello.pyfzOnly one .pyf file per call)�matchN)rrJrKrLrrMrNr�raises�
ValueErrorr
)rRr:rSrTs    r�test_gh22819_many_pyfr\�s���

���E�����V�}�U�G�:�%F�%L�%L�%N�O�	
������	%��
�]�]�:�-J�
K�	��I�	���	�	����s$�B�0B�;B�B	�B�B!c�F�t|d��}|j}|jtdd|�d�j	��tj|j�5t�|jj�}d|vsJ�	ddd�y#1swYyxYw)N�test�rrG�f2py z -m testzintproductf2pywrap, intpr)r!rrJrKrLrrMrNr
rr.)rRr8rS�foutlrT�wrappers      r�test_gh23598_warnrc�s�����V�4�E��L�L�E�����V�
��w�h��%�%�'�)�
������	%�:��	��,�,�(�(�*��*�'�9�9�9�:�:�:�s�"+B�B c��t|�}t|�jdz}|jtdd|�d|��j	��tj|j�5t�|j�\}}d|vsJ�t|��j�sJ�	ddd�y#1swYyxYw)zIEnsures that a signature file is generated via the CLI
    CLI :: -h
    rrGzf2py -h � �Saving signatures to fileN)r�stemrJrKrLrrMrNr
�
readouterr�exists)rRr5rSrT�opath�out�_s       r�test_gen_pyfrm�s���
��!�E���!�&�&��/�E�����V�x��w�a��w�%?�%E�%E�%G�H�	
������	%�)��	��!�!�#���Q�*�c�1�1�1��u�g��&�&�(�(�(�	)�)�)�s
�.AB8�8Cc�&�t|�}|jtdd|��j��t	j
|j�5t�|j�\}}d|vsJ�d|vsJ�	ddd�y#1swYyxYw)zHEnsures that a signature file can be dumped to stdout
    CLI :: -h
    rGzf2py -h stdout rfzfunction hi() ! in N�	rrJrKrLrrMrNr
rh�rRr5rSrTrkrls      r�test_gen_pyf_stdoutrq�s���
��!�E�����V��u�g�%>�%D�%D�%F�G�	
������	%�,��	��!�!�#���Q�*�c�1�1�1�$��+�+�+�	,�,�,�s�*B�Bc��t|�}|jtdd|��j��t	j
|j�5td�jdd��tjt�5t�|j�\}}d|vsJ�	ddd�ddd�y#1swY�xYw#1swYyxYw)	zjEnsures that the CLI refuses to overwrite signature files
    CLI :: -h without --overwrite-signature
    rG�f2py -h faker.pyf �	faker.pyf�	Fake newsr)r*z&Use --overwrite-signature to overwriteN)
rrJrKrLrrMrNr0rrZ�
SystemExitr
rh)rRr5rSrTrl�errs      r�test_gen_pyf_no_overwriterx�s���
��!�E�����V�'9�%��%A�%G�%G�%I�J�	
������	%�C��[��$�$�[�7�$�C�
�]�]�:�
&�	C��I��%�%�'�F�A�s�;�s�B�B�B�	C�C�C�	C�	C��C�C�s$�6C�	$B?�.C�?C	�C�C)��zPython 3.12 required)�reasonc��t|�}|jtdd|��j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swYyxYw)z@Check that modules are named correctly

    CLI :: defaults
    rGzf2py --backend meson -c zuntitledmodule.cN)	rrJrKrLrrMrNrrhrps      r�test_untitled_clir}�s|��
��!�E�����V�'?��w�%G�%M�%M�%O�P�	
������	%�)�� ��!�!�#���Q�!�S�(�(�(�)�)�)�s�$B�B
�LinuxzCompiler and 3.12 requiredc	�F�d}t||��}|j}|jtdd|�d|��j	��tj|j�5t�|j�\}}d|vsJ�	ddd�|jtddj	��tj|j�5t�|j�\}}d	|vsJ�	ddd�d
}|jtdd|�d|�d�j	��tj|j�5t�|j�\}}d
|vsJ�	ddd�y#1swY��xYw#1swY��xYw#1swYyxYw)zqCheck that no distutils imports are performed on 3.12
    CLI :: --fcompiler --help-link --backend distutils
    �hir_rGr`z -c --fcompiler=gfortran -m z%--fcompiler cannot be used with mesonNzf2py --help-linkzUse --dep for meson builds�hi2z -c -m z --backend distutilsz.Cannot use distutils backend with Python>=3.12)r!rrJrKrLrrMrNrrhr
)rRr5rS�MNAMErarTrkrls        r�!test_no_py312_distutils_fcompilerr��s���

�E����6�E��L�L�E�����V�u�U�G�#?��w�G�M�M�O��
������	%�>�� ��!�!�#���Q�6�#�=�=�=�>�����V�'�-�-�/��
������	%�3��	��!�!�#���Q�+�s�2�2�2�3�
�E�����V�u�U�G�7�5�'�1E�F�L�L�N��
������	%�G��	��!�!�#���Q�?�3�F�F�F�G�G�>�>��3�3��G�G�s$�&$E?�$F�$F�?F�F�F c��t|d��}|j}d}d}|jtdd|�d|��j	��tj|j�5t�|j�\}}|j	�D]}	d|	�d	�|vr�J�|j	�D]}
d
|
�d�|vr�J�	ddd�y#1swYyxYw)
z9Tests that functions can be skipped
    CLI :: skip:
    r^r_�t0 t4 t8 sd s8 s4�td s0rGr`z -m test skip: z=buildmodule: Could not found the body of interfaced routine "�". Skipping.�Constructing wrapper function "�"N�
r!rrJrKrLrrMrNr
rh)rRr@rSrarT�toskip�	remainingrkrw�skey�rkeys           r�test_f2py_skipr�s���

��F�3�E��J�J�E�
 �F��I�����V�
��w�o�f�X�.�4�4�6�8�
������	%�D��	��#�#�%���S��L�L�N�	�D�O�PT�v�Ua�b���
��	��O�O�%�	D�D�4�T�F�!�<��C�C�C�	D�D�D�D���(9C�"C�C�Cc��t|d��}|j}d}d}|jtdd|�d|��j	��tj|j�5t�|j�\}}|j	�D]}	d|	�d	�|vr�J�|j	�D]}
d
|
�d�|vr�J�	ddd�y#1swYyxYw)
z>Test that functions can be kept by only:
    CLI :: only:
    r^r_r�r�rGr`z -m test only: �<buildmodule: Could not find the body of interfaced routine "r�r�r�Nr�)rRr@rSrarTr��tokeeprkrwr�r�s           r�test_f2py_onlyr�$s���
��F�3�E��J�J�E�
 �F�
�F�����V�
��w�o�f�X�.�4�4�6�8�
������	%�D��	��#�#�%���S��L�L�N�	�D�N�t�f�T`�a���
��	��L�L�N�	D�D�4�T�F�!�<��C�C�C�	D�D�D�D�r�c���t|d��}|j}d}t|�}d}d}	|jtdd|�d|	�d	|�d
|��j��t
j|j�5t�|j�\}
}|j�D]}d|�d�|vr�J�|j�D]}
d
|
�d�|
vr�J�	ddd�y#1swYyxYw)zfTests that it is possible to return to file processing mode
    CLI :: :
    BUG: numpy-gh #20520
    r^r_r�ztd s0 hi�blahrGr`� -m z only: z : r�r�r�r�N)r!rrrJrKrLrrMrNr
rh)rRr5r@rSrarTr��ipath2r�rrkrwr�r�s              r�test_file_processing_switchr�;s��
��F�3�E��J�J�E�
 �F�
�/�
"�F�
�F��E������
��w�d�5�'�����F�8�<�B�B�	
��
������	%�D��	��#�#�%���S��L�L�N�	�D�N�t�f�T`�a���
��	��L�L�N�	D�D�4�T�F�!�<��C�C�C�	D�D�D�D�s�;9C!�5C!�C!�!C*c��d}t||��}|j}|jtdd|�d|��j	��tj|j�5t�ddd�tj|j�sJ�tj|j�sJ�y#1swY�LxYw)zHChecks the generation of files based on a module name
    CLI :: -m
    r�r_rGr`r�N)
r!rrJrKrLrrMrNr
rrirr)rRr5rSr�rarTs      r�test_mod_gen_f77r�Ys���
�E����6�E��L�L�E�����V�u�U�G�4��w�%?�%E�%E�%G�H�	
������	%���	���;�;�u�{�{�#�#�#��;�;�u�|�|�$�$�$�
��s�&B<�<Cc	��d}t||��}|j}|jtdd|�d|�d�j	��tj|j�5t�td�j�5}|j�}d|vsJ�	d	d	d	�d	d	d	�y	#1swY�xYw#1swYy	xYw)
z�Check that pyf files are correctly generated with module structure
    CLI :: -m <name> -h pyf_file
    BUG: numpy-gh #20520
    r�r_rGr`r�z
 -h hi.pyfzhi.pyfzpython module hiN)r!rrJrKrLrrMrNr
r�open�read)rRr=rSr�rarT�hipyf�pyfdats        r�test_mod_gen_gh25263r�js���

�E����6�E��J�J�E�����V�u�U�G�4��w�j�%I�%O�%O�%Q�R�	
������	%�0��	�
�(�^�
 �
 �
"�	0�e��Z�Z�\�F�%��/�/�/�	0�0�0�	0�	0��0�0�s$�'$C�B4�#C�4B=	�9C�C	c��t|d��}|j}tjd�}tjd�}|j	t
dd|�d�j
��tj|j�5t�|j�\}}|j|��J�|j|��J�	ddd�|j	t
dd|�d	�j
��tj|j�5t�|j�\}}|j|��J�|j|��J�	ddd�y#1swY��xYw#1swYyxYw)
zHLowers cases by flag or when -h is present

    CLI :: --[no-]lower
    r^r_zHI\(\)zhi\(\)rGr`z -m test --lowerNz -m test --no-lower)
r!r�re�compilerJrKrLrrMrNr
rh�search�	rRr=rSrarT�capshi�capslorkrls	         r�test_lower_cmodr�zsV��

���7�E��J�J�E�
�Z�Z�	�
"�F�
�Z�Z�	�
"�F�����V�u�U�G�3C�%D�%J�%J�%L�M�	
������	%�*��	��!�!�#���Q��}�}�S�!�-�-�-��}�}�S�!�)�)�)�	*�����V���w�&9�:�@�@�B�D�	
������	%�.��	��!�!�#���Q��}�}�S�!�)�)�)��}�}�S�!�-�-�-�	.�.�*�*��.�.�s�AE/�!AE;�/E8�;Fc	�B�t|d��}|j}tjd�}tjd�}|j	t
dd|�d|j�d�j��tj|j�5t�|j�\}}|j|��J�|j|��J�	d	d	d	�|j	t
dd|�d|j�d
�j��tj|j�5t�|j�\}}|j|��J�|j|��J�	d	d	d	�y	#1swY��xYw#1swYy	xYw)z^Lowers cases in signature files by flag or when -h is present

    CLI :: --[no-]lower -h
    r^r_z	Block: HIz	Block: hirGr`z -h z -m test --overwrite-signatureNz) -m test --overwrite-signature --no-lower)r!rr�r�rJrKrrLrrMrNr
rhr�r�s	         r�test_lower_sigr��st��

���7�E��J�J�E�
�Z�Z��
%�F�
�Z�Z��
%�F������
��w�d�5�9�9�+�%C�D�J�J�L��
������	%�*��	��!�!�#���Q��}�}�S�!�-�-�-��}�}�S�!�)�)�)�	*������
��w�d�5�9�9�+�%N�O�	���	�
������	%�.��	��!�!�#���Q��}�}�S�!�)�)�)��}�}�S�!�-�-�-�	.�.�*�*��.�.�s�AF	�;AF�	F�Fc
�6�t|�}d}d}|jtdd|�d|�d|��j��t	j
|j�5t�|j�\}}d|�d�|vsJ�	d	d	d	�y	#1swYy	xYw)
zNEnsures that the build directory can be specified

    CLI :: --build-dir
    r��tttmprG�f2py -m rez
 --build-dir zWrote C/API module "r�Nro)rRr5rSrTr�odirrkrls        r�test_build_dirr��s���

��!�E��E��D�����V�"�5�'��5�'��t�f�E�K�K�M�O�
������	%�8��	��!�!�#���Q�&�u�g�R�0�C�7�7�7�8�8�8�s�(B�Bc�T�t|�}|jtdd|�d�j��t	j
|j�5td�jdd��t�|j�\}}d|vsJ�	d	d	d	�y	#1swYy	xYw)
zXEnsures that the build directory can be specified

    CLI :: --overwrite-signature
    rGrsz --overwrite-signaturertrur)r*rfN)
rrJrKrLrrMrNr0r
rhrps      r�test_overwriter��s���

��!�E�����V�
�U�G�#9�:�@�@�B�D�
������	%�2��[��$�$�[�7�$�C��	��!�!�#���Q�*�c�1�1�1�	2�2�2�s
�AB�B'c	��t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�t|�d��j�5}d|j�vsJ�	d	d	d	�d	d	d	�y	#1swY�xYw#1swYy	xYw)
zJEnsures that TeX documentation is written out

    CLI :: --latex-doc
    r�rGr�rez --latex-doc�Documentation is saved to file�
module.tex�\documentclassN�rrJrKrLrrMrNr
rhr�r��rRr5rSrTrrkrl�otexs        r�
test_latexdocr��s���

��!�E��E�����V�"�5�'��5�'��>�D�D�F�H�
������	%�4��	��!�!�#���Q�/�3�6�6�6�
�U�G�:�&�
'�
,�
,�
.�	4�$�$��	�	��3�3�3�	4�	4�4�	4�	4��	4�4�s%�AC�C�/C�C		�C�Cc	�&�t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swYyxYw)zMEnsures that TeX documentation is written out

    CLI :: --no-latex-doc
    r�rGr�rez --no-latex-docr�Nro�rRr5rSrTrrkrls       r�test_nolatexdocr��s���

��!�E��E�����V�"�5�'��5�'��A�G�G�I�K�
������	%�;��	��!�!�#���Q�/�s�:�:�:�;�;�;���$B�Bc	��t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�td|�d��j�5}d	|j�vsJ�	d
d
d
�d
d
d
�y
#1swY�xYw#1swYy
xYw)z�Ensures that truncated documentation is written out

    TODO: Test to ensure this has no effect without --latex-doc
    CLI :: --latex-doc --short-latex
    r�rGr�rez --latex-doc --short-latexr��./r�r�Nr�r�s        r�test_shortlatexr��s���
��!�E��E������
�5�'��5�'�!;�<�B�B�D��
������	%�8��	��!�!�#���Q�/�3�6�6�6�
�B�u�g�Z�(�
)�
.�
.�
0�	8�D�$�D�I�I�K�7�7�7�	8�	8�8�	8�	8��	8�8��%�AC
�C�0C
�C
	�C
�
Cc	��t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�td|�d��j�5}d	|j�vsJ�	d
d
d
�d
d
d
�y
#1swY�xYw#1swYy
xYw)zIEnsures that RsT documentation is written out

    CLI :: --rest-doc
    r�rGr�rez --rest-doc�#ReST Documentation is saved to filer�zmodule.restz.. -*- rest -*-Nr�)rRr5rSrTrrkrl�orsts        r�test_restdocr�s���

��!�E��E�����V�"�5�'��5�'��=�C�C�E�G�
������	%�5��	��!�!�#���Q�4��;�;�;�
�B�u�g�[�)�
*�
/�
/�
1�	5�T�%�����4�4�4�	5�	5�5�	5�	5��	5�5�r�c	�&�t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swYyxYw)zLEnsures that TeX documentation is written out

    CLI :: --no-rest-doc
    r�rGr�rez --no-rest-docr�Nror�s       r�test_norestexdocr�'s���

��!�E��E�����V�"�5�'��5�'��@�F�F�H�J�
������	%�@��	��!�!�#���Q�4�C�?�?�?�@�@�@�r�c	��t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�td|�d��j�5}d|j�vsJ�	d	d	d	�d	d	d	�y	#1swY�xYw#1swYy	xYw)
zIEnsures that debugging wrappers are written

    CLI :: --debug-capi
    r�rGr�rez
 --debug-capir�rz#define DEBUGCFUNCSN�
rrJrKrLrrMrNr
r�r�)rRr5rSrTr�ocmods      r�test_debugcapir�7s���

��!�E��E�����V�"�5�'��5�'��?�E�E�G�I�
������	%�:��	�
�B�u�g�X�&�
'�
,�
,�
.�	:�%�)�U�Z�Z�\�9�9�9�	:�:�:�	:�	:��:�:�s$�(B4�B(�B4�(B1	�-B4�4B=z2Consistently fails on CI; noisy so skip not xfail.c	���t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�tjtj�d��}tj|dd�	�}d
}tjd�}|j|k(sJ�|j|k(sJ�	ddd�y#1swYyxYw)
zEEnsures that debugging wrappers work

    CLI :: --debug-capi -c
    r�rGr�rez -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)rrJrKrLrrMrNr
�shlex�
executable�
subprocess�run�textwrap�dedent�stdout�stderr)r5rSrTr�cmd_run�rout�eout�eerrs        r�test_debugcapi_bldr�Gs���
��!�E��E�����V�"�5�'��5�'�1A�B�H�H�J�L�
������	%�#��	��+�+���� 0�0N�O�P���~�~�g�d�W�M�������	 �	
���{�{�d�"�"�"��{�{�d�"�"�"�!#�#�#�s
�BC%�%C.c	�*�t|�}d}|jtdd|�d|��j��t	j
|j�5t�ddd�|j�\}}d|vsJ�|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swY��xYw#1swYyxYw)zoEnsures that fortran subroutine wrappers for F77 are included by default

    CLI :: --[no]-wrap-functions
    r�rGr�reN� Fortran 77 wrappers are saved toz --wrap-functionsror�s       r�test_wrapfunc_defr�es��
��!�E��E�����V�x��w�a��w�%?�%E�%E�%G�H�	
������	%���	��
�
�
�
�F�C��.�#�5�5�5�����V�"�5�'��5�'�1B�C�I�I�K�M�
������	%�:��	��!�!�#���Q�2�c�9�9�9�:�:����:�:�s�C=�$D	�=D�	Dc	�&�t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swYyxYw)zeEnsures that fortran subroutine wrappers for F77 can be disabled

    CLI :: --no-wrap-functions
    r�rGr�rez --no-wrap-functionsr�Nror�s       r�test_nowrapfuncr�~s���

��!�E��E�����V�"�5�'��5�'�1E�F�L�L�N�P�
������	%�>��	��!�!�#���Q�2�#�=�=�=�>�>�>�r�c	��t|�}d}|jtdd|�d|�d�j��t	j
|j�5t�td|�d��j�5}|j�}d|vsJ�d	|vsJ�	d
d
d
�d
d
d
�y
#1swY�xYw#1swYy
xYw)zcAdd to the include directories

    CLI :: -include
    TODO: Document this in the help string
    r�rGr�rez' -include<stdbool.h> -include<stdio.h> r�rz#include <stdbool.h>z#include <stdio.h>Nr�)rRr5rSrTrr��ocmrs       r�test_inclheaderr��s���
��!�E��E������
�5�'��5�'�!H�I�
���	�
������	%�0��	�
�B�u�g�X�&�
'�
,�
,�
.�	0�%��:�:�<�D�)�T�1�1�1�'�4�/�/�/�	0�0�0�	0�	0��0�0�s$�(B<�B0�B<�0B9	�5B<�<Cc��y)z?Add to the include directories

    CLI :: --include-paths
    Nrrrr�
test_inclpathr�����	rc��y)z;Add to the include directories

    CLI :: --help-link
    Nrrrr�
test_hlinkr��r�rc�L�t|�}|jtdd|�d�j��t	j
|j�5t�|j�\}}d|vsJ�d|vsJ�d|vsJ�d|vsJ�d|vsJ�	d	d	d	�y	#1swYy	xYw)
zOCheck that Fortran-to-Python KIND specs can be passed

    CLI :: --f2cmap
    rGrHz --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 changesNro)rRrErSrTrkrls      r�test_f2cmapr��s���

���E�����V�}�U�G�;L�%M�%S�%S�%U�V�	
������	%�I��	��!�!�#���Q�2�c�9�9�9�;�s�B�B�B�<��C�C�C�A�S�H�H�H�A�S�H�H�H�I�I�I�s�<B�B#c�0�t|�}|jtdd|�d�j��t	j
|j�5t�|j�\}}t|�dk(sJ�	ddd�y#1swYyxYw)z)Reduce verbosity

    CLI :: --quiet
    rGrHz --quietrN)
rrJrKrLrrMrNr
rh�lenrps      r�
test_quietr��s~��

��!�E�����V�}�U�G�8�%D�%J�%J�%L�M�	
������	%���	��!�!�#���Q��3�x�1�}��}����s�.B�Bc��t|�}|jtdd|�d�j��t	j
|j�5t�|j�\}}d|vsJ�	ddd�y#1swYyxYw)z-Increase verbosity

    CLI :: --verbose
    rGrHz
 --verbose�analyzelineNrorps      r�test_verboser��s|��

��!�E�����V�}�U�G�:�%F�%L�%L�%N�O�	
������	%�$��	��!�!�#���Q���#�#�#�$�$�$�s�$B�Bc�,�|jtddj��tjt
�5t
�|j�\}}ddl}|j|j�k(sJ�	ddd�y#1swYyxYw)z"Ensure version

    CLI :: -v
    rGzf2py -vrN)rJrKrLrrZrvr
rh�numpy�__version__�strip)rRrSrkrl�nps     r�test_versionr��sp��
����V�Y�_�_�%6�7�	���z�	"�-��	��!�!�#���Q���~�~�����,�,�,�	-�-�-�s�AB
�
Bc��t|�}|jtdd|�d�j��t	j
|j�5t�tjtj�d��}tj|dd��}d}|j|k(sJ�	d	d	d	�y	#1swYy	xYw)
z
    CLI :: -c
    rGrHz -cr�Tr�r�r�N)
rrJrKrLrrMrNr
r�r�r�r�r�)r5rSrTr�r�r�s      r�
test_npdistopr��s���

��!�E�����V�}�U�G�3�%?�%E�%E�%G�H�	
������	%�#��	��+�+���� 0�0N�O�P���~�~�g�d�W�M�����{�{�d�"�"�"�#�#�#�s
�AB:�:Cz*Compiler and Python 3.12 or newer requiredc��t|�}|jtdd|�d�j��t	j
|j�5t�tj�d�}tr|dz
}n|dz
}tj|�}tj|dd�	�}d
}|j|k(sJ�trd|jvsJ�|jdk(sJ�	d
d
d
�y
#1swYy
xYw)z.
    CLI :: --no-freethreading-compatible
    rGrHz! -c --no-freethreading-compatible� -c "import blah; blah.hi();z1import sys; assert sys._is_gil_enabled() is True"r�Tr�r�r�zHThe global interpreter lock (GIL) has been enabled to load module 'blah'rN�rrJrKrLrrMrNrr�rr�r�r�r�r��
returncode�r5rSrT�cmdr�r�r�s       r� test_no_freethreading_compatiblers���
��!�E�����V�}�U�G�;\�%]�%c�%c�%e�f�	
������	%�
$�� ���� � =�>����G�G�C��4�K�C��+�+�c�"���~�~�g�d�W�M�����{�{�d�"�"�"��]�ae�al�al�l�l�l����!�#�#�#�
$�
$�
$�s
�BC4�4C=c��t|�}|jtdd|�d�j��t	j
|j�5t�tj�d�}tr|dz
}n|dz
}tj|�}tj|dd�	�}d
}|j|k(sJ�|jdk(sJ�|jdk(sJ�	d
d
d
�y
#1swYy
xYw)z+
    CLI :: --freethreading_compatible
    rGrHz -c --freethreading-compatibler�z2import sys; assert sys._is_gil_enabled() is False"r�Tr�r�r��rNr�rs       r�test_freethreading_compatiblers���
��!�E�����V�}�U�G�;Y�%Z�%`�%`�%b�c�	
������	%�$�� ���� � =�>����H�H�C��4�K�C��+�+�c�"���~�~�g�d�W�M�����{�{�d�"�"�"��{�{�b� � � ����!�#�#�#�$�$�$�s
�BC/�/C8c��y)z
    CLI :: -c --fcompiler
    Nrrrr�test_npd_fcompilerr7���
	rc��y)z
    CLI :: -c --compiler
    Nrrrr�test_npd_compilerr?r	rc��y)z$
    CLI :: -c --help-fcompiler
    Nrrrr�test_npd_help_fcompilerr
Gr	rc��y)z
    CLI :: -c --f77exec
    Nrrrr�test_npd_f77execrOr	rc��y)z
    CLI :: -c --f90exec
    Nrrrr�test_npd_f90execrWr	rc��y)z
    CLI :: -c --f77flags
    Nrrrr�test_npd_f77flagsr_r	rc��y)z
    CLI :: -c --f90flags
    Nrrrr�test_npd_f90flagsrgr	rc��y)z
    CLI :: -c --opt
    Nrrrr�test_npd_optror	rc��y)z
    CLI :: -c --arch
    Nrrrr�
test_npd_archrwr	rc��y)z
    CLI :: -c --noopt
    Nrrrr�test_npd_nooptrr	rc��y)z
    CLI :: -c --noarch
    Nrrrr�test_npd_noarchr�r	rc��y)z
    CLI :: -c --debug
    Nrrrr�test_npd_debugr�r	rc��y)z%
    CLI :: -c --link-<resource>
    Nrrrr�test_npd_link_autor!�r	rc��y)z/
    CLI :: -c -L/path/to/lib/ -l<libname>
    Nrrrr�test_npd_libr#�r	rc��y)z
    CLI :: -D<define>
    Nrrrr�test_npd_definer%�r	rc��y)z
    CLI :: -U<name>
    Nrrrr�test_npd_undefiner'�r	rc��y)z$
    CLI :: -I/path/to/include/
    Nrrrr�
test_npd_inclr)�r	rc��y)z8
    CLI :: <filename>.o <filename>.so <filename>.a
    Nrrrr�test_npd_linkerr+�r	r)�untitled)Xr�r�r�rKr��pathlibr�collectionsr�platformrrr�numpy.f2py.f2py2err
�numpy.testing._private.utilsrrrr!�fixturer5r8r:r=r@rErWr\rcrmrqrx�mark�skipif�version_infor}�systemr��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�rrrrr
rrrrrrrrrr!r#r%r'r)r+rrr�<module>r8sw��	���
���"��
��-�4��
�H�H�	I���N����i� ��!������i� ��!������i� ��!������i� ��!������i� ��!������i� ��!���(	�
:�)�
,�C������C�$�$��/�8N��O�
)�P�
)������_�X�_�_�&�'�1�S�s�7G�7G�7�7R�\x��y�G�z�G�>�����D��D�.D�.D�<%�"
0� .�4$.�N8�"2�"4�$
;� 8�,5�$
@� 
:� �����M��N�#�O�#�::�2
>� 0�.	�	�I�$�$�-������M��N�#�O�#������_�X�_�_�&�'�1�Q�c�6F�6F�'�6Q�G��I�$�I�$�.�����_�X�_�_�&�'�1�Q�c�6F�6F�'�6Q�G��I�$�I�$�2	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	r

Youez - 2016 - github.com/yon3zu
LinuXploit