Merged release21-maint changes.
[python/dscho.git] / Doc / lib / libpycompile.tex
blobebbc9b907b81308671d522e0104379a8681043dc
1 \section{\module{py_compile} ---
2 Compile Python source files}
4 % Documentation based on module docstrings, by Fred L. Drake, Jr.
5 % <fdrake@acm.org>
7 \declaremodule[pycompile]{standard}{py_compile}
9 \modulesynopsis{Compile Python source files to byte-code files.}
12 \indexii{file}{byte-code}
13 The \module{py_compile} module provides a single function to generate
14 a byte-code file from a source file.
16 Though not often needed, this function can be useful when installing
17 modules for shared use, especially if some of the users may not have
18 permission to write the byte-code cache files in the directory
19 containing the source code.
22 \begin{funcdesc}{compile}{file\optional{, cfile\optional{, dfile}}}
23 Compile a source file to byte-code and write out the byte-code cache
24 file. The source code is loaded from the file name \var{file}. The
25 byte-code is written to \var{cfile}, which defaults to \var{file}
26 \code{+} \code{'c'} (\code{'o'} if optimization is enabled in the
27 current interpreter). If \var{dfile} is specified, it is used as
28 the name of the source file in error messages instead of \var{file}.
29 \end{funcdesc}
32 \begin{seealso}
33 \seemodule{compileall}{Utilities to compile all Python source files
34 in a directory tree.}
35 \end{seealso}