On Jun 5, 2009, at 8:46 AM, Sébastien Barthélemy wrote:

> Hello all,
>
> I have a project involving cython files with the following file  
> hierarchy.
>
> /setup.py
> /src/homogeneousmatrix.pyx
> /src/homogeneousmatrix.pxd
> /src/__init__.py
> /src/...
>
> However, I have some trouble writing a working  setup.py. With the
> version below, generating src/homogeneousmatrix.c fails, apparently
> because it does not use the corresponding pxd file, where some
> necessary ctypedef are made.
>
>
> I can compile everything with this setup.py:
>
> from distutils.core import setup
> from distutils.extension import Extension
> from Cython.Distutils import build_ext
>
> setup(
>     name='arboris',
>     packages=['arboris',
>                 'arboris.robots'],
>     package_dir = {'arboris':'src'},
>     cmdclass = {'build_ext': build_ext},
>     ext_package='arboris',
>     ext_modules = [Extension("homogeneousmatrix",
>                              ["src/homogeneousmatrix.pyx"])]
> )
>
>
> However, with the following one,  generating src/homogeneousmatrix.c
> fails, apparently because cython does not find/use the corresponding
> pxd file
>
> from distutils.core import setup
> from distutils.extension import Extension
> from Cython.Distutils import build_ext
>
> setup(
>     name='arboris',
>     packages=['arboris',
>                   'arboris.robots'],
>     package_dir = {'arboris':'src'},
>     cmdclass = {'build_ext': build_ext},
>     ext_modules = [Extension("arboris.homogeneousmatrix",
>                              ["src/homogeneousmatrix.pyx"])]
> )
>
> I was wondering if this was an expected behaviour or a bug.

If you don't want to specify ext_package, you should probably lay out  
your sources as you would for normal .py files, e.g. put everything  
in the arboris package in an "arboris" directory rather than a "src"  
directory. Perhaps Cython should be inspecting package_dir?

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to