1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
"""
CYTHONIZE -i pkg --depfile
PYTHON package_test.py
"""
######## package_test.py ########
import os.path
with open(os.path.join("pkg", "test.c.dep"), "r") as f:
contents = f.read().replace("\\\n", " ").replace("\n", " ")
assert sorted(contents.split()) == sorted(['test.c:', os.path.join('sub', 'incl.pxi'), 'test.pxd', 'test.pyx']), contents
with open(os.path.join("pkg", "sub", "test.c.dep"), "r") as f:
contents = f.read().replace("\\\n", " ").replace("\n", " ")
contents = [os.path.relpath(entry, '.')
if os.path.isabs(entry) else entry for entry in contents.split()]
assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx', os.path.join('pkg', 'test.pxd')]), contents # last is really one level up
######## pkg/__init__.py ########
######## pkg/test.pyx ########
TEST = "pkg.test"
include "sub/incl.pxi"
cdef object get_str():
return TEST
######## pkg/test.pxd ########
cdef object get_str()
######## pkg/sub/__init__.py ########
######## pkg/sub/test.pyx ########
# cython: language_level=3
from ..test cimport get_str
include 'incl.pxi'
TEST = 'pkg.sub.test'
######## pkg/sub/incl.pxi ########
pass
|