[Pyrex] using .pxds from inside packages

Itamar Shtull-Trauring itamar at itamarst.org
Tue Jul 13 18:39:17 CEST 2004


I'm trying to use a .pxd that is inside a package, so I need to add its
directory to the list of includes for pyrexc. Pyrex Distutils doesn't
support include_dirs from the Extension at the moment.

There are two ways to solve this:

1. extend cimport so you can do e.g.

   from package cimport pyxmodule

and it will look for package/pyxmodule.pxd

2. Distutils improvement so it is possible to pass include dirs. What I
did was:

class build_ext(build_ext):

    def pyrex_compile(self, source):
        result = Main.compile(source, Main.CompilationOptions(include_path=["package"]))
        if result.num_errors <> 0:
            sys.exit(1)

-- 
Itamar Shtull-Trauring    http://itamarst.org






More information about the Pyrex mailing list