https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/numpy/f2py/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/numpy/f2py/tests/__pycache__/util.cpython-310.pyc
o

6��at%�@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZddl
mZddlmZdadadd�Zd	d
�Zdd�Zd
d�Zegggdfdd��Zegggddfdd��Zdadd�Zdd�Zdd�Zdd�Zedd��ZGdd�d�ZdS)z�
Utility functions for

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

�N)�asbytes�asstr)�temppath)�
import_moduleic	Cs^tdur-ztj�t�Wn	tyYnwzt�t�Wnttfy(YnwdadSdS�N)	�_module_dir�sys�path�remove�
ValueError�shutil�rmtree�IOError�OSError�rr�7/usr/lib/python3/dist-packages/numpy/f2py/tests/util.py�_cleanups���rcCs6tdurt��at�t�ttjvrtj�dt�tS�Nr)	r�tempfile�mkdtemp�atexit�registerrrr	�insertrrrr�get_module_dir,s

rcCs,t�}dt}td7a|tjvrtd��|S)Nz_test_ext_module_%d�z%Temporary module name already in use.)r�_module_numr�modules�RuntimeError)�d�namerrr�get_temp_module_name6s
r csi���fdd�}�j|_|S)Nc
sht||f�}|�vr'z�|i|���|<Wnty&}z|�|<�d}~ww�|}t|t�r2|�|Sr)�repr�	Exception�
isinstance)�a�kw�key�e�ret��func�memorr�wrapperEs��
z_memoize.<locals>.wrapper)�__name__)r*r,rr)r�_memoizeBsr.c
Cs�dttj�}t�}g}g}|D]5}	tj�|	�std|	��tj�|tj�|	��}
t	�
|	|
�|�|
�tj�|
�\}}|dvrE|�|
�q|durMt
�}dd|g||}
|r_|
dg|7}
|rh|
dg|7}
t��}zDt�|�tjd|g|
}tj|tjtjd	�}|��\}}|jd
kr�td|dd�t|�f��Wt�|�|D]}	t�|	�q�t|�St�|�|D]}	t�|	�q�w)
zH
    Compile and import a f2py module, built from the given files.

    zEimport sys; sys.path = %s; import numpy.f2py as f2py2e; f2py2e.main()�%s is not a file)�.f90�.fz.cz.pyfNz-cz-mzskip:zonly:��stdout�stderrrzRunning f2py failed: %s
%s�)r!rr	r�os�isfiler�join�basenamer�copyfile�append�splitextr �getcwd�chdir�
executable�
subprocess�Popen�PIPE�STDOUT�communicate�
returncoder�unlinkr)�source_files�options�skip�only�module_name�coder�dst_sources�f2py_sources�fn�dst�base�ext�	f2py_opts�cwd�cmd�p�out�errrrr�build_moduleYsX�

�

�
��

��rYc	Cs�|durd}t|d��,}t|d��
}|�|�Wd�n1s!wYt|g||||d�Wd�S1s:wYdS)z6
    Compile and import Fortran code using f2py.

    Nr1)�suffix�w�rHrIrJrK)r�open�writerY)�source_coderHrIrJrZrKr	�frrr�
build_code�s��$�rac		Cs
tdurtSdat�d�}|tttj�d�}t��}z?t	j�
|d�}t|d��
}|�|�Wd�n1s8wYtj
ddg}tj|tjtj|d�}|��\}}Wt�|�nt�|�wt�d|�}|r�tt|�d	���tt|�d
���tt|�d���fatS)N)FFFa�        import os
        import sys
        sys.path = %(syspath)s

        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.pyr[�config)r3r4rTsCOMPILERS:(\d+),(\d+),(\d+)r��)�_compiler_status�textwrap�dedent�dictr!rr	rrr6r8r]r^r?r@rArBrCrDrr
�re�search�bool�int�group)	rL�tmpdir�scriptr`rUrVrWrX�mrrr�_get_compiler_status�s0
�
� �rrcC�
t�dSr�rrrrrr�has_c_compiler��
rucCrs)Nrrtrrrr�has_f77_compiler�rvrwcCrs)Nrdrtrrrr�has_f90_compiler�rvrxc
Ks�ddlm}ddlm}t�}g}|D]$}tj�|�s!td|��tj�	|tj�
|��}	t�||	�|�
|	�qt�|��dd�}t�d�t|ttj�d�}
tj�	|t�d	�}|�
|�t|d
��}|�t|
��Wd�n1suwYt��}
z@t�|�tj|dd
g}tj|tjtjd�}|��\}}|j dkr�td|dd�t!|�f��Wt�|
�|D]}t�"|�q�nt�|
�|D]}t�"|�q�wt#|�tj$|S)z6
    Build a module via distutils and import it.

    r)�
Configuration)�setupr/�
z
    a�        import os
        import sys
        sys.path = %(syspath)s

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

        if __name__ == "__main__":
            from numpy.distutils.core import setup
            setup(configuration=configuration)
        )�config_coderbz.py�wbN�	build_extz-ir2z%Running distutils build failed: %s
%sr5)%�numpy.distutils.misc_utilry�numpy.distutils.corerzrr6r	r7rr8r9rr:r;rgrh�replacerir!rr r]r^rr=r>r?r@rArBrCrDrErrF�
__import__r)rGr|rKr%ryrzrrMrOrPrLrpr`rTrUrVrWrXrrr�build_module_distutils�sT�
�

�
��
�
��
r�c@s4eZdZdZdZgZgZgZdZdZ	dZ
dd�ZdS)�F2PyTestNr1cCstjdkr
t�d�|jdurdSt�st�d�g}|jr$|�|j�|jdur/|�	|j
�d}d}|D]}|�d�r?d}q5|�d�rFd}q5|rQt�sQt�d�|r[t
�s[t�d	�|jdurqt|j|j|j|j|j
|jd
�|_|jdur�t|j|j|j|j|jd�|_dSdS)N�win32z)Fails with MinGW64 Gfortran (Issue #9673)zNo C compiler availableFr1Tr0z No Fortran 77 compiler availablez No Fortran 90 compiler available)rHrIrJrZrKr\)r�platform�pytestrI�moduleru�sources�extendrLr;rZ�endswithrwrxrarHrJrKrY)�self�codes�	needs_f77�	needs_f90rOrrrrz@sF






�





�

��zF2PyTest.setup)r-�
__module__�__qualname__rLr�rHrIrJrZr�rKrzrrrrr�6sr�) �__doc__r6rr@rrrrgrjr��numpy.compatrr�
numpy.testingr�	importlibrrrrrr r.rYrarfrrrurwrxr�r�rrrr�<module>sB
8�7
F

https://t.me/RX1948 - 2025