I'm trying to build a Python extension and package it up using distutils but the extension installs in the root package no matter how I name it. My directory layout looks like this:
foo/bar/extension.c
My setup.py
looks like this:
from distutils.core import setup
from distutils.extension import Extension
setup(name='foo.bar.extension',
cmdclass={'build_ext': build_ext},
ext_modules=[Extension('foo.bar.extension',
sources=['foo/bar/extension.c'])]
)
I set up a virtualenv
and run
python setup.py install
Then in my Python shell:
>>> import foo.bar.extension
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named invest_cython_core
>>> import extension #This works!
What can I change so that the first import statement to works and the second one to fails?