summaryrefslogtreecommitdiff
path: root/sys/src/cmd/python/Doc/lib/libcompileall.tex
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:25:13 +0000
commit458120dd40db6b4df55a4e96b650e16798ef06a0 (patch)
tree8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/src/cmd/python/Doc/lib/libcompileall.tex
parent3a742c699f6806c1145aea5149bf15de15a0afd7 (diff)
add hg and python
Diffstat (limited to 'sys/src/cmd/python/Doc/lib/libcompileall.tex')
-rw-r--r--sys/src/cmd/python/Doc/lib/libcompileall.tex63
1 files changed, 63 insertions, 0 deletions
diff --git a/sys/src/cmd/python/Doc/lib/libcompileall.tex b/sys/src/cmd/python/Doc/lib/libcompileall.tex
new file mode 100644
index 000000000..3e9667d9e
--- /dev/null
+++ b/sys/src/cmd/python/Doc/lib/libcompileall.tex
@@ -0,0 +1,63 @@
+\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\optional{,
+ rx\optional{, quiet}}}}}}
+ 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.
+
+ If \var{rx} is given, it specifies a regular expression of file
+ names to exclude from the search; that expression is searched for in
+ the full path.
+
+ If \var{quiet} is true, nothing is printed to the standard output
+ in normal operation.
+\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}
+
+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.}
+\end{seealso}