Blame tests/run/cimport_from_pyx.srctree

Packit 562c7a
PYTHON setup.py build_ext --inplace
Packit 562c7a
PYTHON -c "import a"
Packit 562c7a
Packit 562c7a
######## setup.py ########
Packit 562c7a
Packit 562c7a
from Cython.Build.Dependencies import cythonize
Packit 562c7a
import Cython.Compiler.Options
Packit 562c7a
Cython.Compiler.Options.cimport_from_pyx = True
Packit 562c7a
Packit 562c7a
from distutils.core import setup
Packit 562c7a
Packit 562c7a
setup(
Packit 562c7a
  ext_modules = cythonize("*.pyx"),
Packit 562c7a
)
Packit 562c7a
Packit 562c7a
######## a.pyx ########
Packit 562c7a
Packit 562c7a
from b cimport Bclass, Bfunc, Bstruct, Benum, Benum_value, Btypedef, Py_EQ, Py_NE
Packit 562c7a
cdef Bclass b = Bclass(5)
Packit 562c7a
assert Bfunc(&b.value) == b.value
Packit 562c7a
assert b.asStruct().value == b.value
Packit 562c7a
cdef Btypedef b_type = &b.value
Packit 562c7a
cdef Benum b_enum = Benum_value
Packit 562c7a
cdef int tmp = Py_EQ
Packit 562c7a
Packit 562c7a
#from c cimport ClassC
Packit 562c7a
#cdef ClassC c = ClassC()
Packit 562c7a
#print c.value
Packit 562c7a
Packit 562c7a
######## b.pyx ########
Packit 562c7a
Packit 562c7a
from cpython.object cimport Py_EQ, Py_NE
Packit 562c7a
Packit 562c7a
cdef enum Benum:
Packit 562c7a
    Benum_value
Packit 562c7a
Packit 562c7a
cdef struct Bstruct:
Packit 562c7a
    int value
Packit 562c7a
Packit 562c7a
ctypedef long *Btypedef
Packit 562c7a
Packit 562c7a
cdef class Bclass:
Packit 562c7a
    cdef long value
Packit 562c7a
    def __init__(self, value):
Packit 562c7a
        self.value = value
Packit 562c7a
    cdef Bstruct asStruct(self):
Packit 562c7a
        return Bstruct(value=self.value)
Packit 562c7a
Packit 562c7a
cdef long Bfunc(Btypedef x):
Packit 562c7a
    return x[0]
Packit 562c7a
Packit 562c7a
######## c.pxd ########
Packit 562c7a
Packit 562c7a
cdef class ClassC:
Packit 562c7a
    cdef int value