Add example

This commit is contained in:
Andrew M. Kuchling 2006-07-29 13:56:48 +00:00
parent 5391216050
commit 35f64c12d3
1 changed files with 13 additions and 0 deletions

View File

@ -44,6 +44,19 @@ compile Python sources in directories named on the command line or in
\function{compile_dir()} function.
\end{funcdesc}
To force a recompile of all the \file{.py} files in the \file{Lib/}
subdirectory and all its subdirectories:
\begin{verbatim}
import compileall
compileall.compile_dir('Lib/', force=True)
# Perform same compilation, excluding files in .svn directories.
import re
compileall.compile_dir('Lib/', rx=re.compile('/[.]svn'), force=True)
\end{verbatim}
\begin{seealso}
\seemodule[pycompile]{py_compile}{Byte-compile a single source file.}