Commit d905deb9 authored by Stefan Behnel's avatar Stefan Behnel

extend build_dir test in a way that I think should work but doesn't

parent 3dfac3e2
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
PYTHON -c "import pkg.b"
PYTHON check_paths.py
######## setup.py ########
......@@ -11,23 +12,65 @@ from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx", build_dir="scratch"),
ext_modules = (cythonize("*.pyx", build_dir="scratchA") +
cythonize("pkg/*.pyx", build_dir="scratchB")),
)
######## a.pyx ########
cdef extern from "a_helper.h":
int value
cdef extern from "helper.h":
int value1
assert value == 100
cdef extern from "subdir/helper.h":
int value2
######## a_helper.h ########
cdef extern from "pkg/pkg_helper.h":
int value3
int value = 100;
assert value1 == 100
assert value2 == 200
assert value3 == 300
######## helper.h ########
int value1 = 100;
######## subdir/helper.h ########
int value2 = 200;
######## pkg/__init__.py ########
######## pkg/b.pyx ########
cdef extern from "pkg_helper.h":
int value3
cdef extern from "subdir/pkg_helper.h":
int value4
assert value3 == 300
assert value4 == 400
######## pkg/pkg_helper.h ########
int value3 = 300;
######## pkg/subdir/pkg_helper.h ########
int value4 = 400;
######## check_paths.py ########
import os
assert os.path.exists("scratch/a.c")
assert os.path.exists("scratch/a_helper.h")
assert os.path.exists("scratchA/a.c")
assert os.path.exists("scratchA/helper.h")
assert os.path.exists("scratchA/subdir/helper.h")
assert os.path.exists("scratchA/pkg/pkg_helper.h")
assert not os.path.exists("a.c")
assert os.path.exists("scratchB/pkg/b.c")
assert os.path.exists("scratchB/pkg/pkg_helper.h")
assert os.path.exists("scratchB/pkg/subdir/pkg_helper.h")
assert not os.path.exists("b.c")
assert not os.path.exists("pkg/b.c")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment