Name
Extension
Synopsis
class Extension(name,sources, **kwds)
name is the module name string for the
C-coded extension. name may include dots
to indicate that the extension module resides within a package.
sources is the list of source files that
the distutils must compile and link in order to
build the extension. Each item of sources
is a string giving a source file’s path relative to
the distribution root directory, complete with file extension
.c. kwds lets you
pass other, optional arguments to Extension, as
covered later in this section.
The Extension class
also supports other file extensions besides .c,
indicating other languages you may use to code Python extensions. On
platforms having a C++ compiler, file extension .cpp
indicates C++ source files. Other file extensions that may
be supported, depending on the platform and on add-ons to the
distutils that are still in experimental stages at
the time of this writing, include .f for
Fortran, .i for SWIG, and
.pyx for Pyrex files. See Chapter 24 for information about using different
languages to extend Python.
In some cases, your extension needs no further information besides
mandatory arguments name and
sources. The distutils
implicitly perform all that is necessary to make the Python headers
directory and the Python library available for your
extension’s compilation and linking, and also
provide whatever compiler or linker flags or options are needed to
build extensions on a given platform.
When it takes additional information ...