Commit 58f2af44 authored by Kirill Smelkov's avatar Kirill Smelkov

setup: Teach cython to resolve `cimport wendelin.*` starting from top-level

This is similar to e870781d (Top-level in-tree import redirector) but
for upcoming pyx modules.
parent d95b6635
...@@ -28,6 +28,18 @@ import os ...@@ -28,6 +28,18 @@ import os
import sys import sys
# tell cython to resolve `cimport wendelin.*` modules hierarchy starting at top-level.
# see wendelin.py for details.
from Cython.Compiler.Main import Context as CyContext
cy_search_inc_dirs = CyContext.search_include_directories
def wendelin_cy_searh_in_dirs(self, qualified_name, suffix, pos, include=False, sys_path=False):
_ = qualified_name.split('.')
if len(_) >= 1 and _[0] == "wendelin":
qualified_name = '.'.join(_[1:])
return cy_search_inc_dirs(self, qualified_name, suffix, pos, include, sys_path)
CyContext.search_include_directories = wendelin_cy_searh_in_dirs
# _with_defaults calls what(*argv, **kw) with kw amended with default build flags. # _with_defaults calls what(*argv, **kw) with kw amended with default build flags.
# e.g. _with_defaults(_DSO, *argv, **kw) # e.g. _with_defaults(_DSO, *argv, **kw)
def _with_defaults(what, *argv, **kw): def _with_defaults(what, *argv, **kw):
......
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