Commit 657de8b7 authored by R. Andrew Ohana's avatar R. Andrew Ohana

add fix for in-tree symlinks, with updated test

parent d5743eb3
...@@ -671,8 +671,10 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -671,8 +671,10 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
if build_dir: if build_dir:
root = os.path.realpath(os.path.abspath(find_root_package_dir(m.sources[0]))) root = os.path.realpath(os.path.abspath(find_root_package_dir(m.sources[0])))
def copy_to_build_dir(filepath, root=root): def copy_to_build_dir(filepath, root=root):
filepath = os.path.realpath(os.path.abspath(filepath)) filepath_abs = os.path.realpath(os.path.abspath(filepath))
if filepath.startswith(root): if os.path.isabs(filepath):
filepath = filepath_abs
if filepath_abs.startswith(root):
mod_dir = os.path.join(build_dir, mod_dir = os.path.join(build_dir,
os.path.dirname(_relpath(filepath, root))) os.path.dirname(_relpath(filepath, root)))
if not os.path.isdir(mod_dir): if not os.path.isdir(mod_dir):
......
PYTHON -c "import os; os.symlink('subdir', 'fake')"
PYTHON setup.py build_ext --inplace PYTHON setup.py build_ext --inplace
PYTHON -c "import a" PYTHON -c "import a"
PYTHON -c "import pkg.b" PYTHON -c "import pkg.b"
...@@ -43,12 +44,16 @@ int value2 = 200; ...@@ -43,12 +44,16 @@ int value2 = 200;
######## pkg/b.pyx ######## ######## pkg/b.pyx ########
cdef extern from "../fake/helper.h":
int value2
cdef extern from "pkg_helper.h": cdef extern from "pkg_helper.h":
int value3 int value3
cdef extern from "subdir/pkg_helper.h": cdef extern from "subdir/pkg_helper.h":
int value4 int value4
assert value2 == 200
assert value3 == 300 assert value3 == 300
assert value4 == 400 assert value4 == 400
...@@ -72,5 +77,6 @@ assert not os.path.exists("a.c") ...@@ -72,5 +77,6 @@ assert not os.path.exists("a.c")
assert os.path.exists("scratchB/pkg/b.c") assert os.path.exists("scratchB/pkg/b.c")
assert os.path.exists("scratchB/pkg/pkg_helper.h") assert os.path.exists("scratchB/pkg/pkg_helper.h")
assert os.path.exists("scratchB/pkg/subdir/pkg_helper.h") assert os.path.exists("scratchB/pkg/subdir/pkg_helper.h")
assert os.path.exists("scratchB/fake/helper.h")
assert not os.path.exists("b.c") assert not os.path.exists("b.c")
assert not os.path.exists("pkg/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