Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/f2py/tests/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/f2py/tests/__pycache__/util.cpython-311.pyc

�

�܋fy+���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZddlmZmZddlmZdadaejdkr8ee��jjjZee�d	����Zd
�Zd�Z d�Z!d
�Z"e"gggdfd���Z#e"gggddfd���Z$da%d�Z&d�Z'd�Z(d�Z)e"d���Z*Gd�d��Z+d�Z,ej-d���Z.dS)z�
Utility functions for

- building and importing modules on test time, using a temporary location
- detecting if compilers are present
- determining paths to tests

�N)�Path)�asbytes�asstr)�temppath�IS_WASM)�
import_modulei�cygwinz**/*.dllc���t�e	tj�t��n#t$rYnwxYw	tjt��n#t$rYnwxYwdadSdS�N)�_module_dir�sys�path�remove�
ValueError�shutil�rmtree�OSError���h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/numpy/f2py/tests/util.py�_cleanupr's�����	��H�O�O�K�(�(�(�(���	�	�	��D�	����	��M�+�&�&�&�&���	�	�	��D�	���������s�$.�
;�;�A�
A&�%A&c���t�dtj��atjt
��ttjvr%tj�dt��tS�Nr)	r�tempfile�mkdtemp�atexit�registerrr
r�insertrrr�get_module_dirr5sO�����&�(�(�����!�!�!��c�h�&�&��H�O�O�A�{�+�+�+��rc��t��dtz}tdz
a|tjvrt	d���|S)Nz_test_ext_module_%d�z%Temporary module name already in use.)r�_module_numr
�modules�RuntimeError)�names r�get_temp_module_namer&?sE������ �;�.�D��1��K��s�{����B�C�C�C��Krc�2���i���fd�}�j|_|S)Nc���t||f��}|�vr%	�|i|���|<n#t$r}|�|<�d}~wwxYw�|}t|t��r|�|Sr)�repr�	Exception�
isinstance)�a�kw�key�e�ret�func�memos     ��r�wrapperz_memoize.<locals>.wrapperNs�����A�r�7�m�m���d�?�?�
� �D�!�N�r�N�N��S�	�	���
�
�
���S�	������
�����3�i���c�9�%�%�	��I��
s�$�
9�4�9)�__name__)r1r3r2s` @r�_memoizer5Ks8����
�D��������}�G���Nrc
��dtj�d�}t��}g}g}|D]�}	tj�|	��std|	z���tj�|tj�|	����}
tj	|	|
��|�
|
��tj�|
��\}}|dvr|�
|
����|sJ�|�t��}dd|g|z|z}
|r	|
dg|zz
}
|r	|
d	g|zz
}
tj
��}	tj|��tjd|g|
z}t!j|t jt j�
��}|���\}}|jdkr*td|d
d��dt-|�������	tj|��|D]}	tj|	���n2#tj|��|D]}	tj|	���wxYwtjdkr{t2�t7jtj�|d�|��������t!jgd�t2z��t=|��S)zH
    Compile and import a f2py module, built from the given files.

    zimport sys; sys.path = z&; import numpy.f2py; numpy.f2py.main()�%s is not a file)�.f90�.fz.c�.pyfNz-cz-mzskip:zonly:��stdout�stderrrzRunning f2py failed: ��
r	z{:s}*)z/usr/bin/rebasez
--databasez--obliviousz	--verbose)r
rr�os�isfiler$�join�basenamer�copyfile�append�splitextr&�getcwd�chdir�
executable�
subprocess�Popen�PIPE�STDOUT�communicate�
returncoder�unlink�platform�_module_list�extend�glob�format�
check_callr)�source_files�options�skip�only�module_name�code�d�dst_sources�f2py_sources�fn�dst�base�ext�	f2py_opts�cwd�cmd�p�out�errs                   r�build_modulerjds���X�S�X�W�W�W�D����A��K��L��	%�	%���w�~�~�b�!�!�	8��1�B�6�7�7�7��g�l�l�1�b�g�.�.�r�2�2�3�3�����C� � � ����3�����G�$�$�S�)�)�	��c��.�.�.�����$�$�$�����<���*�,�,���t�[�)�G�3�l�B�I��&��g�Y��%�%�	��&��g�Y��%�%�	�
�)�+�+�C��
�������~�t�T�*�Y�6����S�$.�O�$.�$5�
7�
7�
7���=�=�?�?���S��<�1����,� #�A�B�B�����s���� 5�6�6�
6��	���
�
�
��	�	�B��I�b�M�M�M�M�	��	���
�
�
��	�	�B��I�b�M�M�M�M�	�����|�x���	����I�b�g�l�l�1�g�n�n�[�&A�&A�B�B�C�C�	
�	
�	
�	��I�I�I��
�	
�	
�	
���%�%�%s
�BH�/H?c��|�d}t|���5}t|d��5}|�|��ddd��n#1swxYwYt|g||||���cddd��S#1swxYwYdS)z6
    Compile and import Fortran code using f2py.

    Nr9)�suffix�w�rXrYrZr[)r�open�writerj)�source_coderXrYrZrlr[r�fs        r�
build_coders�s���~���	��	 �	 �	 �5�D�
�$��_�_�	!��
�G�G�K� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!��T�F�$+�!%�!%�(3�	5�5�5�5�5�5�5�5�5�5�5�5�5�5�5����5�5�5�5�5�5s3�A4�A�A4�A	�A4�A	�A4�4A8�;A8c	�&�t�tSdatrtStjdt	t
j���d���}|tt	t
j�����z}tj	��}	tj�|d��}t|d��5}|�
|��ddd��n#1swxYwYt
jddg}tj|tjtj|���}|���\}}t)j|��n#t)j|��wxYwt-jd	|��}|r�t1t3|�d
������t1t3|�d������t1t3|�d������fatS)
N)FFFz8        import os
        import sys
        sys.path = a{

        def configuration(parent_name='',top_path=None):
            global config
            from numpy.distutils.misc_util import Configuration
            config = Configuration('', parent_name, top_path)
            return config

        from numpy.distutils.core import setup
        setup(configuration=configuration)

        config_cmd = config.get_config_cmd()
        have_c = config_cmd.try_compile('void foo() {}')
        print('COMPILERS:%%d,%%d,%%d' %% (have_c,
                                          config.have_f77c(),
                                          config.have_f90c()))
        sys.exit(99)
        )�syspathzsetup.pyrm�config)r<r=resCOMPILERS:(\d+),(\d+),(\d+)r!��)�_compiler_statusr�textwrap�dedentr)r
r�dictrrr@rBrorprIrJrKrLrMrNrr�re�search�bool�int�group)	r\�tmpdir�scriptrrrfrgrhri�ms	         r�_get_compiler_statusr��s����#���,��� ����?�����N�N����
�
�D�*�$�t�C�H�~�~�.�.�.�.�D�
�
�
�
�F�
�����f�j�1�1��
�&�#�
�
�	�!�
�G�G�D�M�M�M�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��~�z�8�4����S�$.�O�$.�$5�!'�
)�
)�
)���=�=�?�?���S��
�f�������
�f��������
�	�1�3�7�7�A��
���Q�W�W�Q�Z�Z���!�!���Q�W�W�Q�Z�Z���!�!���Q�W�W�Q�Z�Z���!�!�
���s1�0E�<C�E�C"�"E�%C"�&AE�E&c�*�t��dSr�r�rrr�has_c_compilerr�
����!�!�!�$�$rc�*�t��dS)Nr!r�rrr�has_f77_compilerr�r�rc�*�t��dS)Nrwr�rrr�has_f90_compilerr�r�rc�j�t��}g}|D]�}tj�|��st	d|z���tj�|tj�|����}tj||��|�	|����tj|���dd��}dttj���d|�d�}tj�|t��dz��}	|�	|	��t!|	d��5}
|
�t%|����d	d	d	��n#1swxYwYtj��}	tj|��tj|	d
dg}t-j|t,jt,j���}
|
���\}}|
jd
kr*t	d|dd	��dt9|�������	tj|��|D]}tj|���n2#tj|��|D]}tj|���wxYwt=|��tj|S)z6
    Build a module via distutils and import it.

    r7r?z
    z!
import os
import sys
sys.path = z�

def configuration(parent_name='',top_path=None):
    from numpy.distutils.misc_util import Configuration
    config = Configuration('', parent_name, top_path)
    z�
    return config

if __name__ == "__main__":
    from numpy.distutils.core import setup
    setup(configuration=configuration)
    z.py�wbN�	build_extz-ir;rz Running distutils build failed: r>) rr@rrAr$rBrCrrDrErzr{�replacer)r
r&rorprrGrHrIrJrKrLrMrNrOrrP�
__import__r#)rW�config_coder[r-r]r^r`rar\r�rrrerfrgrhris                r�build_module_distutilsr�s���	���A��K�� � ���w�~�~�b�!�!�	8��1�B�6�7�7�7��g�l�l�1�b�g�.�.�r�2�2�3�3�����C� � � ����3������/�+�.�.�6�6�t�X�F�F�K��
���N�N�������D��W�\�\�!�1�3�3�e�;�
<�
<�F����v����	
�f�d�	�	��q�	�����
�
����������������������
�)�+�+�C��
�������~�v�{�D�9����S�$.�O�$.�$5�
7�
7�
7���=�=�?�?���S��<�1����,� #�A�B�B�����s���� 5�6�6�
6��	���
�
�
��	�	�B��I�b�M�M�M�M�	��	���
�
�
��	�	�B��I�b�M�M�M�M�	�����{�����;�{�#�#s�
#E9�9E=�E=�BI"�"/Jc�F�eZdZdZdZgZgZgZdZdZ	e
d���Zd�ZdS)�F2PyTestNr9c�z�t|��}d|j�dd��d�d|j�d�S)N�_�.r!����_ext_module)�type�
__module__�rsplitr4)�self�clss  rr[zF2PyTest.module_nameis?���4�j�j��O�3�>�(�(��Q�/�/��3�O�O�c�l�O�O�O�Orc��tjdkrtjd��|j�dSt��stjd��g}|jr|�|j��|j�|�	|j
��d}d}d}|D]p}t|���d��rd}�'t|���d��rd}�Lt|���d��rd}�q|r"t��stjd	��|r"t��stjd
��|r0t��s"t��stjd��|j�8t|j|j|j|j|j
|j���|_|j�4t'|j|j|j|j|j�
��|_dSdS)N�win32z)Fails with MinGW64 Gfortran (Issue #9673)zNo C compiler availableFr9Tr8r:z No Fortran 77 compiler availablez No Fortran 90 compiler availablezNo Fortran compiler available)rXrYrZrlr[rn)r
rQ�pytestrY�moduler��sourcesrSr\rErl�str�endswithr�r�rsrXrZr[rj)r��codes�	needs_f77�	needs_f90�	needs_pyfr`s      r�setup_methodzF2PyTest.setup_methodns���<�7�"�"��K�C�D�D�D��;�"��F����	3��K�1�2�2�2����<�	'��L�L���&�&�&��9� ��L�L���%�%�%��	��	��	��	!�	!�B��2�w�w����%�%�
!� �	�	��R���!�!�&�)�)�
!� �	�	��R���!�!�&�)�)�
!� �	���	<�-�/�/�	<��K�:�;�;�;��	<�-�/�/�	<��K�:�;�;�;��	9�.�0�0�	9�4D�4F�4F�	9��K�7�8�8�8��9� �$��	����Y��Y��{� �,�
���D�K��<�#�&������Y��Y� �,����D�K�K�K�$�#r)
r4r��__qualname__r\r�rXrYrZrlr��propertyr[r�rrrr�r�`sb�������D��G��G�
�D�
�D�
�F�
�F�
�P�P��X�P�4�4�4�4�4rr�c��ttjj��j���}|j|�Sr)r�numpy�f2py�__file__�parent�resolve�joinpath)r,r]s  r�getpathr��s1���U�Z�
 �!�!�(�0�0�2�2�A��1�:�q�>�rc#�K�tj��}tj|��	dV�tj|��dS#tj|��wxYwr)rrer@rH)r�curpaths  r�	switchdirr��sX�����h�j�j�G��H�T�N�N�N��
����
������������������s�A�A)/�__doc__rTr@r
rJrrrrzr}r��
contextlibr��pathlibr�numpy.compatrr�
numpy.testingrr�	importlibrrr"rQr�r��NUMPY_INSTALL_ROOT�listrRrrr&r5rjrsryr�r�r�r�r�r�r��contextmanagerr�rrr�<module>r�s���������	�	�	�	�
�
�
�
���������
�
�
�
�
�
�
�
�����	�	�	�	�
�
�
�
���������������'�'�'�'�'�'�'�'�+�+�+�+�+�+�+�+�#�#�#�#�#�#������<�8�����h���.�5�<���4�*�/�/�
�;�;�<�<�L�������	�	�	����2
�')����F&�F&�F&�
��F&�R
������5�5�5�
��5�4��;�;�;�|%�%�%�%�%�%�%�%�%�
�<$�<$�
��<$�HB�B�B�B�B�B�B�B�T�����������r

Hacked By AnonymousFox1.0, Coded By AnonymousFox