blob: a731245095768eab476449e0382df73597cfacb8 [file] [log] [blame]
Fred Drakee72e1e01998-08-11 15:46:42 +00001\section{\module{compileall} ---
Fred Drake38e5d272000-04-03 20:13:55 +00002 Byte-compile Python libraries}
Fred Drakee72e1e01998-08-11 15:46:42 +00003
4\declaremodule{standard}{compileall}
Fred Drakee72e1e01998-08-11 15:46:42 +00005\modulesynopsis{Tools for byte-compiling all Python source files in a
Fred Drake38e5d272000-04-03 20:13:55 +00006 directory tree.}
Fred Drakee72e1e01998-08-11 15:46:42 +00007
8
9This module provides some utility functions to support installing
10Python libraries. These functions compile Python source files in a
11directory tree, allowing users without permission to write to the
12libraries to take advantage of cached byte-code files.
13
14The source file for this module may also be used as a script to
15compile Python sources in directories named on the command line or in
16\code{sys.path}.
17
18
Fred Drake38e5d272000-04-03 20:13:55 +000019\begin{funcdesc}{compile_dir}{dir\optional{, maxlevels\optional{,
20 ddir\optional{, force}}}}
Fred Drakee72e1e01998-08-11 15:46:42 +000021 Recursively descend the directory tree named by \var{dir}, compiling
22 all \file{.py} files along the way. The \var{maxlevels} parameter
23 is used to limit the depth of the recursion; it defaults to
24 \code{10}. If \var{ddir} is given, it is used as the base path from
Fred Drake38e5d272000-04-03 20:13:55 +000025 which the filenames used in error messages will be generated. If
26 \var{force} is true, modules are re-compiled even if the timestamps
27 are up to date.
Fred Drakee72e1e01998-08-11 15:46:42 +000028\end{funcdesc}
29
Fred Drake38e5d272000-04-03 20:13:55 +000030\begin{funcdesc}{compile_path}{\optional{skip_curdir\optional{,
31 maxlevels\optional{, force}}}}
Fred Drakee72e1e01998-08-11 15:46:42 +000032 Byte-compile all the \file{.py} files found along \code{sys.path}.
Fred Drake38e5d272000-04-03 20:13:55 +000033 If \var{skip_curdir} is true (the default), the current directory is
34 not included in the search. The \var{maxlevels} and
35 \var{force} parameters default to \code{0} and are passed to the
36 \function{compile_dir()} function.
Fred Drakee72e1e01998-08-11 15:46:42 +000037\end{funcdesc}
38
39
40\begin{seealso}
41 \seemodule[pycompile]{py_compile}{Byte-compile a single source file.}
42\end{seealso}