GNU Info

Info Node: (python2.1-dist.info)Extension names and packages

(python2.1-dist.info)Extension names and packages


Next: Extension source files Prev: Describing extension modules Up: Describing extension modules
Enter node , (file) or (file)node

Extension names and packages
----------------------------

The first argument to the `Extension' constructor is always the name of
the extension, including any package names.  For example,

     Extension("foo", ["src/foo1.c", "src/foo2.c"])

describes an extension that lives in the root package, while

     Extension("pkg.foo", ["src/foo1.c", "src/foo2.c"])

describes the same extension in the `pkg' package.  The source files
and resulting object code are identical in both cases; the only
difference is where in the filesystem (and therefore where in Python's
namespace hierarchy) the resulting extension lives.

If you have a number of extensions all in the same package (or all under
the same base package), use the `ext_package' keyword argument to
`setup()'.  For example,

     setup(...
           ext_package="pkg",
           ext_modules=[Extension("foo", ["foo.c"]),
                        Extension("subpkg.bar", ["bar.c"])]
          )

will compile `foo.c' to the extension `pkg.foo', and `bar.c' to
`pkg.subpkg.bar'.


automatically generated by info2www version 1.2.2.9