§
    `Štj$  ã                   ó‚   — d Z ddlZddlZddlZddlZddlZddlZddgZdddddœd„Z	 dd„Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ ZdS )zb
Build a c-extension module on-the-fly in tests.
See build_and_import_extensions for usage hints

é    NÚbuild_and_import_extensionÚcompile_extension_moduleÚ )ÚprologueÚ	build_dirÚinclude_dirsÚ	more_initc                ór  — |€g }|t          || ¦  «        z   }d}|st          j        d¦  «        }|r
|dz  }||z  }|dz  }t          | ||¦  «        }t	          | |||¦  «        }	ddl}
|
j                             | |	¦  «        }|
j                             |¦  «        }|j	         
                    |¦  «         |S )a  
    Build and imports a c-extension module `modname` from a list of function
    fragments `functions`.


    Parameters
    ----------
    functions : list of fragments
        Each fragment is a sequence of func_name, calling convention, snippet.
    prologue : string
        Code to precede the rest, usually extra ``#include`` or ``#define``
        macros.
    build_dir : pathlib.Path
        Where to build the module, usually a temporary directory
    include_dirs : list
        Extra directories to find include files when compiling
    more_init : string
        Code to appear in the module PyMODINIT_FUNC

    Returns
    -------
    out: module
        The module will have been loaded and is ready for use

    Examples
    --------
    >>> functions = [("test_bytes", "METH_O", """
        if ( !PyBytesCheck(args)) {
            Py_RETURN_FALSE;
        }
        Py_RETURN_TRUE;
    """)]
    >>> mod = build_and_import_extension("testme", functions)
    >>> assert not mod.test_bytes('abc')
    >>> assert mod.test_bytes(b'abc')
    Nz›
    PyObject *mod = PyModule_Create(&moduledef);
    #ifdef Py_GIL_DISABLED
    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
    #endif
           ú.z.#define INITERROR return NULL
                z
return mod;r   )Ú_make_methodsÚpathlibÚPathÚ_make_sourcer   Úimportlib.utilÚutilÚspec_from_file_locationÚmodule_from_specÚloaderÚexec_module)ÚmodnameÚ	functionsr   r   r   r	   ÚbodyÚinitÚsource_stringÚmod_soÚ	importlibÚspecÚfoos                ú]/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/numpy/testing/_private/extbuild.pyr   r      së   € ðN ÐØˆØ•m I¨wÑ7Ô7Ñ7€Dð€Dð ð &Ý”L Ñ%Ô%ˆ	Øð Øð ñ 	ˆà�	ÑˆØˆOÑ€DÝ  ¨$°Ñ5Ô5€MÝ%Ø�˜L¨-ñ9ô 9€FàÐÐÐØŒ>×1Ò1°'¸6ÑBÔB€DØ
Œ.×
)Ò
)¨$Ñ
/Ô
/€CØ„K×Ò˜CÑ Ô Ð Ø€Jó    c                 óÔ   — |                       d¦  «        d         }|| z  }|                     d¬¦  «         t          ||¦  «        }|pg }|pg }|pg }t          |||z  |||¬¦  «        S )aH  
    Build an extension module and return the filename of the resulting
    native code file.

    Parameters
    ----------
    name : string
        name of the module, possibly including dots if it is a module inside a
        package.
    builddir : pathlib.Path
        Where to build the module, usually a temporary directory
    include_dirs : list
        Extra directories to find include files when compiling
    libraries : list
        Libraries to link into the extension module
    library_dirs: list
        Where to find the libraries, ``-L`` passed to the linker
    r   éÿÿÿÿT©Úexist_ok)Úoutputfilenamer   Ú	librariesÚlibrary_dirs)ÚsplitÚmkdirÚ_convert_str_to_fileÚ
_c_compile)	ÚnameÚbuilddirr   r   r&   r'   r   ÚdirnameÚcfiles	            r   r   r   R   sŠ   € ð* �jŠj˜‰oŒo˜bÔ!€GØ˜‰o€GØ‡M‚M˜4€MÑ Ô Ð Ý  °Ñ8Ô8€EØÐ% 2€LØ�˜R€IØÐ% 2€LåØ˜g¨Ñ/Ø!¨YØ!ð
ñ 
ô 
ð 
r    c                 ó®   — |dz  }|                      d¦  «        5 }|                     t          | ¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y   |S )zHelper function to create a file ``source.c`` in `dirname` that contains
    the string in `source`. Returns the file name
    zsource.cÚwN)ÚopenÚwriteÚstr)Úsourcer.   ÚfilenameÚfs       r   r*   r*   v   s�   € ð ˜Ñ#€HØ	�Š�sÑ	Ô	ð ˜qØ	�Š•�F‘”ÑÔÐðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð à€Os   ›#A
Á
AÁAc           
      ó   — g }g }| D ]U\  }}}|› d|› �}d|v rd}nd}|                      d|›d|›d|›d�¦  «         d	|› |› d
|› d�}	|                      |	¦  «         ŒVd                     |¦  «        dd                     |¦  «        |dœz  z   }
|
S )zõ Turns the name, signature, code in functions into complete functions
    and lists them in a methods_table. Then turns the methods_table into a
    ``PyMethodDef`` structure and returns the resulting code fragment ready
    for compilation
    Ú_ÚMETH_KEYWORDSz2(PyObject *self, PyObject *args, PyObject *kwargs)z (PyObject *self, PyObject *args)z{"z", (PyCFunction)z, z},z
        static PyObject* z
        {
        z
        }
        ú
a6  
    static PyMethodDef methods[] = {
    %(methods)s
    { NULL }
    };
    static struct PyModuleDef moduledef = {
        PyModuleDef_HEAD_INIT,
        "%(modname)s",  /* m_name */
        NULL,           /* m_doc */
        -1,             /* m_size */
        methods,        /* m_methods */
    };
    )Úmethodsr   )ÚappendÚjoin)r   r   Úmethods_tableÚcodesÚfuncnameÚflagsÚcodeÚ	cfuncnameÚ	signatureÚ	func_coder   s              r   r   r   €   s  € ð €MØ€EØ!*ð  ð  Ñˆ�%˜ØÐ+Ð+ Ð+Ð+ˆ	Ø˜eÐ#Ð#ØLˆIˆIà:ˆIØ×ÒÐØ08°°¸)¸)¸)ÀUÀUÀUÐKñ	Mô 	Mð 	MðØ#ðØ%.ðð ð 
ðð ð ˆ	ð 	�Š�YÑÔÐÐà�9Š9�UÑÔð ð —i’i Ñ.Ô.¸7Ð
CÐ
CñDñ D€Dð €Kr    c                 ó   — d| ||dœz  }|S )zG Combines the code fragments into source code ready to be compiled
    zn
    #include <Python.h>

    %(body)s

    PyMODINIT_FUNC
    PyInit_%(name)s(void) {
    %(init)s
    }
    )r,   r   r   © )r,   r   r   rC   s       r   r   r   ¨   s(   € ð	ð ˜d¨Dðð ñ€Dð €Kr    c           	      óÎ   — g }t           j        dk    rdg}|                     d¦  «         n&t           j                             d¦  «        rg d¢}ng }t	          | ||||||¦  «        S )NÚwin32z/we4013z/DEBUGÚlinux)z-O0z-gz%-Werror=implicit-function-declarationz-fPIC)ÚsysÚplatformr=   Ú
startswithÚbuild)r/   r%   r   r&   r'   Ú
link_extraÚcompile_extras          r   r+   r+   º   sŠ   € à€JÝ
„|�wÒÐØ"˜ˆØ×Ò˜(Ñ#Ô#Ð#Ð#Ý	Œ×	 Ò	  Ñ	)Ô	)ð ðKð Kð Kˆˆð ˆåØˆ~Ø�zØ�i ñ/ô /ð /r    c                 óª  — | j         dz  }t          j        |d¬¦  «         t          | j         dz  d¦  «        5 }d„ |D ¦   «         }	|                     t          j        d|j        d         › d	| j        d         › d
|› d|	› d|› d�¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y   | j         dz  }
t          |
d¦  «        5 }|                     t          j        dt          j	        › d�¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y   t          j
        dk    rt          j        g d¢|¬¦  «         n0t          j        dddddt          j        |
¦  «        › �g|¬¦  «         |j        d         t          ¦   «         z   }t          j        ddg|¬¦  «         t          j        t!          ||z  ¦  «        | j         |z  ¦  «         | j         |z  S )zuse meson to buildrO   Tr#   zmeson.buildÚwtc                 ó   — g | ]}d |z   ‘ŒS )z-LrH   )Ú.0Úds     r   ú
<listcomp>zbuild.<locals>.<listcomp>Ó   s   € Ð4Ð4Ð4 !�T˜A‘XÐ4Ð4Ð4r    z“            project('foo', 'c')
            py = import('python').find_installation(pure: false)
            py.extension_module(
                'r"   z',
                'z',
                c_args: z,
                link_args: z',
                include_directories: z,
            )
        Nz.mesonpy-native-file.iniz-            [binaries]
            python = 'z
'
        rJ   )ÚmesonÚsetupz--buildtype=releaseú--vsenvú..)ÚcwdrX   rY   rZ   r[   z--native-file=Úcompile)ÚparentÚosÚmakedirsr2   r3   ÚtextwrapÚdedentÚpartsrL   Ú
executablerM   Ú
subprocessÚ
check_callÚfspathÚget_so_suffixÚrenamer4   )r/   r%   rQ   rP   r   r&   r'   r   ÚfidÚ	link_dirsÚnative_file_nameÚso_names               r   rO   rO   Ì   sÄ  € ð ”˜wÑ&€IÝ„K�	 DÐ)Ñ)Ô)Ð)Ý	ˆeŒl˜]Ñ*¨DÑ	1Ô	1ð °SØ4Ð4 |Ð4Ñ4Ô4ˆ	Ø�	Š	•(”/ð 
#ð !Ô& rÔ*ð	
#ð 
#ð
 ”+˜b”/ð
#ð 
#ð 'ð
#ð 
#ð &ð
#ð 
#ð '3ð
#ð 
#ð 
#ñ 
ô 
ñ 
	ô 
	ð 
	ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð ”|Ð&@Ñ@ÐÝ	Ð Ñ	%Ô	%ð ¨Ø�	Š	•(”/ð #å”~ð#ð #ð #ñ ô ñ 	ô 	ð 	ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ
 „|�wÒÐÝÔð 0ð 0ð 0ð #,ð	 ñ 	 ô 	 ð 	 ð 	 õ 	Ô˜w¨°Ø#Ð%Sµb´iÐ@PÑ6QÔ6QÐ%SÐ%SðUà"+ð	 ñ 	 ô 	 ð 	 ð
 Ô" 2Ô&­©¬Ñ8€GÝÔ˜7 IÐ.°IÐ>Ñ>Ô>Ð>Ý„I�c�)˜gÑ%Ñ&Ô&¨¬°wÑ(>Ñ?Ô?Ð?ØŒ<˜'Ñ!Ð!s$   ¹ABÂB#Â&B#Ã6DÄD
ÄD
c                  ó6   — t          j        d¦  «        } | sJ ‚| S )NÚ
EXT_SUFFIX)Ú	sysconfigÚget_config_var)Úrets    r   rh   rh   ÷   s    € Ý
Ô
" <Ñ
0Ô
0€CØ€J€Jˆ3Ø€Jr    )NN)Ú__doc__r_   r   re   rL   rp   ra   Ú__all__r   r   r*   r   r   r+   rO   rh   rH   r    r   ú<module>ru      sþ   ððð ð 
€	€	€	Ø €€€Ø Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ø €€€à'Ð)CÐ
D€ð )+°dØ Rð>ð >ð >ð >ð >ðF 59ð!
ð !
ð !
ð !
ðHð ð ð%ð %ð %ðPð ð ð$/ð /ð /ð$("ð ("ð ("ðVð ð ð ð r    