Commit ed25f12b authored by Fedor Alekseev's avatar Fedor Alekseev Committed by GitHub

Support namespace packages inside regular packages (GH-3905)

parent c3121126
......@@ -156,9 +156,7 @@ def check_package_dir(dir_path, package_names):
for dirname in package_names:
dir_path = os.path.join(dir_path, dirname)
has_init = contains_init(dir_path)
if not namespace and not has_init:
return None, False
elif has_init:
if has_init:
namespace = False
return dir_path, namespace
......
......@@ -10,7 +10,8 @@ from distutils.core import setup, Extension
setup(
ext_modules=cythonize([
Extension("nsp.m1.a", ["nsp/m1/a.pyx"]),
Extension("nsp.m2.b", ["nsp/m2/b.pyx"])
Extension("nsp.m2.b", ["nsp/m2/b.pyx"]),
Extension("nsp.m3.c.d", ["nsp/m3/c/d.pyx"]),
]),
)
......@@ -31,14 +32,28 @@ cdef class A:
######## nsp/m2/b.pyx ########
from nsp.m1.a cimport A
from nsp.m3.c.d cimport D
cdef class B(A):
pass
######## nsp/m3/__init__.py ########
######## nsp/m3/c/d.pyx ########
cdef class D:
pass
######## nsp/m3/c/d.pxd ########
cdef class D:
pass
######## runner.py ########
from nsp.m1.a import A
from nsp.m2.b import B
from nsp.m3.c.d import D
a = A()
b = B()
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