Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/numpy/testing/_private/__pycache__/extbuild.cpython-39.pyc
Ðазад
a e�hQ � @ s� d Z ddlZddlZddlZddlZddlZddlZddgZddg dd�dd�Zg g fdd�Z d d � Z dd� Zd d� Zg g g fdd�Z dd� Zdd� ZdS )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 C s� |t || � }d}|s t�d�}|r4|d7 }||7 }|d7 }t| ||�}zt| |||�} W n6 ty� } ztd|� d��| �W Y d} ~ n d} ~ 0 0 ddl}|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(u'abc') >>> assert mod.test_bytes(b'abc') z8PyObject *mod = PyModule_Create(&moduledef); �.z.#define INITERROR return NULL z return mod;zcould not compile in �:Nr ) � _make_methods�pathlib�Path�_make_sourcer � Exception�RuntimeError�importlib.util�util�spec_from_file_location�module_from_spec�loader�exec_module)�modname� functionsr r r r �body�init� source_stringZmod_so�e� importlib�specZfoo� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/numpy/testing/_private/extbuild.pyr s( ' �(c C sR | � d�d }|| }|jdd� t||�}|t�d�g }t||| |g g d�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� INCLUDEPY)�outputfilenamer � libraries�library_dirs)�split�mkdir�_convert_str_to_file� sysconfig�get_config_var� _c_compile) �nameZbuilddirr r r&