Automake provides support for Python compilation with the PYTHON
primary.
Any files listed in a _PYTHON
variable will be byte-compiled with
py-compile
at install time. py-compile
actually creates
both standard (.pyc
) and byte-compiled (.pyo
) versions of
the source files. Note that because byte-compilation occurs at install
time, any files listed in noinst_PYTHON
will not be compiled.
Python source files are included in the distribution by default.
Automake ships with an Autoconf macro called AM_PATH_PYTHON
which
will determine some Python-related directory variables (see below). If
you have called AM_PATH_PYTHON
from configure.in
, then you
may use the following variables to list you Python source files in your
variables: python_PYTHON
, pkgpython_PYTHON
,
pyexecdir_PYTHON
, pkgpyexecdir_PYTHON
, depending where you
want your files installed.
AM_PATH_PYTHON
takes a single optional argument. This argument,
if present, is the minimum version of Python which can be used for this
package. If the version of Python found on the system is older than the
required version, then AM_PATH_PYTHON
will cause an error.
AM_PATH_PYTHON
creates several output variables based on the
Python installation found during configuration.
PYTHON
PYTHON_VERSION
1.5
). This is currently the value of
sys.version[:3]
.
PYTHON_PREFIX
${prefix}
. This term may be used in future work
which needs the contents of Python's sys.prefix
, but general
consensus is to always use the value from configure.
PYTHON_EXEC_PREFIX
${exec_prefix}
. This term may be used in future work
which needs the contents of Python's sys.exec_prefix
, but general
consensus is to always use the value from configure.
PYTHON_PLATFORM
sys.platform
. This value is sometimes needed when
building Python extensions.
pythondir
site-packages
subdirectory of the
standard Python install tree.
pkgpythondir
pythondir
which is named after the
package. That is, it is $(pythondir)/$(PACKAGE)
. It is provided
as a convenience.
pyexecdir
pkgpyexecdir
$(pyexecdir)/$(PACKAGE)
.
All these directory variables have values that start with either
${prefix}
or ${exec_prefix}
unexpanded. This works
fine in Makefiles
, but it makes these variables hard to use in
configure
. This is mandated by the GNU coding standards, so
that the user can run make prefix=/foo install
. The Autoconf
manual has a section with more details on this topic
(see Installation Directory Variables).