Your IP : 216.73.216.52
B
Z��Z�Z � @ s" d Z ddlZddlZddlZddlZddlmZmZ dZdZ dZ
dZdZd d
� Z
dd� Zd
d� Zdd� Zd/dd�Zdd� Zdd� Zd0dd�Zd1dd�ZG dd� de�ZG dd� de�ZG dd � d e�Ze� ZG d!d"� d"e�ZG d#d$� d$e�Zd%d&� Zd2d(d)�Zd*d+� Zd,d-� Z e!d.k�re � dS )3a0
Import hooks; when installed with the install() function, these hooks
allow importing .pyx files as if they were Python modules.
If you want the hook installed every time you run Python
you can add it to your Python version by adding these lines to
sitecustomize.py (which you can create from scratch in site-packages
if it doesn't exist there or somewhere else on your python path)::
import pyximport
pyximport.install()
For instance on the Mac with a non-system Python 2.3, you could create
sitecustomize.py with only those two lines at
/usr/local/lib/python2.3/site-packages/sitecustomize.py .
A custom distutils.core.Extension instance and setup() args
(Distribution) for for the build can be defined by a <modulename>.pyxbld
file like:
# examplemod.pyxbld
def make_ext(modname, pyxfilename):
from distutils.extension import Extension
return Extension(name = modname,
sources=[pyxfilename, 'hello.c'],
include_dirs=['/myinclude'] )
def make_setup_args():
return dict(script_args=["--compiler=mingw32"])
Extra dependencies can be defined by a <modulename>.pyxdep .
See README.
Since Cython 0.11, the :mod:`pyximport` module also has experimental
compilation support for normal Python modules. This allows you to
automatically run Cython on every .pyx and .py module that Python
imports, including parts of the standard library and installed
packages. Cython will still fail to compile a lot of Python modules,
in which case the import mechanism will fall back to loading the
Python source modules instead. The .py import mechanism is installed
like this::
pyximport.install(pyimport = True)
Running this module as a top-level script will run a test and then print
the documentation.
This code is based on the Py2.3+ import protocol as described in PEP 302.
� N)�zipimporter�ZipImportError� pyximportz.pyxz.pyxdepz.pyxbldFc C s |r| | } t | � d S )N)�print)�message�args� r �F/opt/alt/python37/lib64/python3.7/site-packages/pyximport/pyximport.py�_printA s r
c G s t rt| |� d S )N)�DEBUG_IMPORTr
)r r r r r �_debugG s r c G s t | |� d S )N)r
)r r r r r �_infoL s r
c C s dS )z,Load a pyrex file given a name and filename.Nr )�name�filenamer r r �_load_pyrexW s r c C s^ t | |�\}}|sVt|t�s*|�t�� �}ddlm} || |gd�}|d k rVd|i|_||fS )Nr )� Extension)r �sources�language_level) �handle_special_build�
isinstance�str�encode�sys�getfilesystemencoding�distutils.extensionr �cython_directives)�modname�pyxfilenamer �
extension_mod�
setup_argsr r r r �get_distutils_extension[ s
r c s� t j�|�d t � d }i }t j�� �r�t�d� t� ��}t|dd �}|rj|| |�}|r^|j sjt
d� ��t|dd �}|r�|� }t|t�s�t
d� ��t
s�|s�t
d� ��� fdd �|j D �|_ ||fS )
Nr ZXXXX�make_extz'make_ext in %s did not return Extension�make_setup_argsz+make_setup_args in %s did not return a dictz'neither make_ext nor make_setup_args %sc s"