Invoking setup.py in sub-packages

Francesc faltet at gmail.com
Thu May 13 08:48:38 EDT 2010


Hi,

I'd like to setup a package that is make of other sub-packages,
modules and other extensions.  What I have is something like (this is
very simplified indeed):

<foo>/
    __init__.py
    setup.py
    foo1/
        __init__.py
        foo1.c
        [...]
    foo2/
        setup.py
        __init__.py
        foo2.c
        [...]

Now, I'd like to make a setup.py for package 'foo' that is able to
compile the 'foo1' extension directly, but invoke 'foo2/setup.py' in
order to generate the 'foo2' sub-package (which contains an extension
itself).

I'm currently trying:

setup(name = "foo",
      ...
      ext_modules = [ Extension( "foo.foo1", sources=["foo1.c"] ) ],
      packages = ["foo.foo1", "foo.foo2"],
      ...
      )

Of course, the foo2 package is not made at all.  Is there a way to get
the 'foo2/setup.py' invoked automagically and generate the desired
extensions?  Or all the instructions to generate the extension in
sub-packages have to be hard-wired in main 'foo/setup.py'?

Thanks!



More information about the Python-list mailing list