summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libcompileall.tex
blob: a731245095768eab476449e0382df73597cfacb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\section{\module{compileall} ---
         Byte-compile Python libraries}

\declaremodule{standard}{compileall}
\modulesynopsis{Tools for byte-compiling all Python source files in a
                directory tree.}


This module provides some utility functions to support installing
Python libraries.  These functions compile Python source files in a
directory tree, allowing users without permission to write to the
libraries to take advantage of cached byte-code files.

The source file for this module may also be used as a script to
compile Python sources in directories named on the command line or in
\code{sys.path}.


\begin{funcdesc}{compile_dir}{dir\optional{, maxlevels\optional{,
                              ddir\optional{, force}}}}
  Recursively descend the directory tree named by \var{dir}, compiling
  all \file{.py} files along the way.  The \var{maxlevels} parameter
  is used to limit the depth of the recursion; it defaults to
  \code{10}.  If \var{ddir} is given, it is used as the base path from 
  which the filenames used in error messages will be generated.  If
  \var{force} is true, modules are re-compiled even if the timestamps
  are up to date.
\end{funcdesc}

\begin{funcdesc}{compile_path}{\optional{skip_curdir\optional{,
                               maxlevels\optional{, force}}}}
  Byte-compile all the \file{.py} files found along \code{sys.path}.
  If \var{skip_curdir} is true (the default), the current directory is
  not included in the search.  The \var{maxlevels} and
  \var{force} parameters default to \code{0} and are passed to the
  \function{compile_dir()} function.
\end{funcdesc}


\begin{seealso}
  \seemodule[pycompile]{py_compile}{Byte-compile a single source file.}
\end{seealso}