Commit 2bf8ee0d authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: c extension uses namespace without directories

Solution: check for existence of namespace directories
parent b2ee66db
Fix when c extension implements namespace packages without the corresponding directories.
...@@ -1728,10 +1728,14 @@ def make_egg_after_pip_install(dest, distinfo_dir): ...@@ -1728,10 +1728,14 @@ def make_egg_after_pip_install(dest, distinfo_dir):
] ]
for namespace_package in namespace_packages: for namespace_package in namespace_packages:
init_py_file = os.path.join(dest, namespace_package, '__init__.py') namespace_package_dir = os.path.join(dest, namespace_package)
if os.path.isdir(namespace_package_dir):
init_py_file = os.path.join(
namespace_package_dir, '__init__.py')
with open(init_py_file, 'w') as f: with open(init_py_file, 'w') as f:
f.write( f.write(
"__import__('pkg_resources').declare_namespace(__name__)" "__import__('pkg_resources')."
"declare_namespace(__name__)"
) )
# Remove `bin` directory if needed # Remove `bin` directory if needed
......
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