| 1 |
""" |
| 2 |
CYTHONIZE -M foo.pyx |
| 3 |
PYTHON check.py |
| 4 |
""" |
| 5 |
|
| 6 |
######## foo.pyx ######## |
| 7 |
|
| 8 |
from bar cimport empty |
| 9 |
|
| 10 |
include "baz.pxi" |
| 11 |
|
| 12 |
empty() |
| 13 |
print(foo()) |
| 14 |
|
| 15 |
|
| 16 |
######## baz.pxi ######## |
| 17 |
|
| 18 |
from cython.cimports.libc.math import sin |
| 19 |
|
| 20 |
def foo(): |
| 21 |
return "foo" |
| 22 |
|
| 23 |
print(sin(0)) |
| 24 |
|
| 25 |
######## bar.pxd ######## |
| 26 |
|
| 27 |
cdef inline void empty(): |
| 28 |
print("empty") |
| 29 |
|
| 30 |
|
| 31 |
######## check.py ######## |
| 32 |
|
| 33 |
with open("foo.c.dep", "r") as f: |
| 34 |
contents = f.read().replace("\\\n", " ").replace('\\', '/').replace('../', '') |
| 35 |
|
| 36 |
assert sorted(contents.split()) == [ |
| 37 |
'Cython/Includes/libc/math.pxd', 'bar.pxd', 'baz.pxi', 'foo.c:', 'foo.pyx'], contents |