Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-dis.html" /> | |
13 | <link rel="prev" href="module-pycompile.html" /> | |
14 | <link rel="parent" href="language.html" /> | |
15 | <link rel="next" href="module-dis.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>18.9 compileall -- Byte-compile Python libraries</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="18.8 py_compile " | |
25 | href="module-pycompile.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="18. Python Language Services" | |
28 | href="language.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="18.10 dis " | |
31 | href="module-dis.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-pycompile.html">18.8 py_compile </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="language.html">18. Python Language Services</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-dis.html">18.10 dis </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0020900000000000000000"> | |
56 | 18.9 <tt class="module">compileall</tt> -- | |
57 | Byte-compile Python libraries</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-compileall"></A> | |
62 | ||
63 | <P> | |
64 | This module provides some utility functions to support installing | |
65 | Python libraries. These functions compile Python source files in a | |
66 | directory tree, allowing users without permission to write to the | |
67 | libraries to take advantage of cached byte-code files. | |
68 | ||
69 | <P> | |
70 | The source file for this module may also be used as a script to | |
71 | compile Python sources in directories named on the command line or in | |
72 | <code>sys.path</code>. | |
73 | ||
74 | <P> | |
75 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
76 | <td><nobr><b><tt id='l2h-4998' xml:id='l2h-4998' class="function">compile_dir</tt></b>(</nobr></td> | |
77 | <td><var>dir</var><big>[</big><var>, maxlevels</var><big>[</big><var>, | |
78 | ddir</var><big>[</big><var>, force</var><big>[</big><var>, | |
79 | rx</var><big>[</big><var>, quiet</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> | |
80 | <dd> | |
81 | Recursively descend the directory tree named by <var>dir</var>, compiling | |
82 | all <span class="file">.py</span> files along the way. The <var>maxlevels</var> parameter | |
83 | is used to limit the depth of the recursion; it defaults to | |
84 | <code>10</code>. If <var>ddir</var> is given, it is used as the base path from | |
85 | which the filenames used in error messages will be generated. If | |
86 | <var>force</var> is true, modules are re-compiled even if the timestamps | |
87 | are up to date. | |
88 | ||
89 | <P> | |
90 | If <var>rx</var> is given, it specifies a regular expression of file | |
91 | names to exclude from the search; that expression is searched for in | |
92 | the full path. | |
93 | ||
94 | <P> | |
95 | If <var>quiet</var> is true, nothing is printed to the standard output | |
96 | in normal operation. | |
97 | </dl> | |
98 | ||
99 | <P> | |
100 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
101 | <td><nobr><b><tt id='l2h-4999' xml:id='l2h-4999' class="function">compile_path</tt></b>(</nobr></td> | |
102 | <td><var></var><big>[</big><var>skip_curdir</var><big>[</big><var>, | |
103 | maxlevels</var><big>[</big><var>, force</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> | |
104 | <dd> | |
105 | Byte-compile all the <span class="file">.py</span> files found along <code>sys.path</code>. | |
106 | If <var>skip_curdir</var> is true (the default), the current directory is | |
107 | not included in the search. The <var>maxlevels</var> and | |
108 | <var>force</var> parameters default to <code>0</code> and are passed to the | |
109 | <tt class="function">compile_dir()</tt> function. | |
110 | </dl> | |
111 | ||
112 | <P> | |
113 | <div class="seealso"> | |
114 | <p class="heading">See Also:</p> | |
115 | ||
116 | <dl compact="compact" class="seemodule"> | |
117 | <dt>Module <b><tt class="module"><a href="module-pycompile.html">py_compile</a></tt>:</b> | |
118 | <dd>Byte-compile a single source file. | |
119 | </dl> | |
120 | </div> | |
121 | ||
122 | <DIV CLASS="navigation"> | |
123 | <div class='online-navigation'> | |
124 | <p></p><hr /> | |
125 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
126 | <tr> | |
127 | <td class='online-navigation'><a rel="prev" title="18.8 py_compile " | |
128 | href="module-pycompile.html"><img src='../icons/previous.png' | |
129 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
130 | <td class='online-navigation'><a rel="parent" title="18. Python Language Services" | |
131 | href="language.html"><img src='../icons/up.png' | |
132 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
133 | <td class='online-navigation'><a rel="next" title="18.10 dis " | |
134 | href="module-dis.html"><img src='../icons/next.png' | |
135 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
136 | <td align="center" width="100%">Python Library Reference</td> | |
137 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
138 | href="contents.html"><img src='../icons/contents.png' | |
139 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
140 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
141 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
142 | <td class='online-navigation'><a rel="index" title="Index" | |
143 | href="genindex.html"><img src='../icons/index.png' | |
144 | border='0' height='32' alt='Index' width='32' /></A></td> | |
145 | </tr></table> | |
146 | <div class='online-navigation'> | |
147 | <b class="navlabel">Previous:</b> | |
148 | <a class="sectref" rel="prev" href="module-pycompile.html">18.8 py_compile </A> | |
149 | <b class="navlabel">Up:</b> | |
150 | <a class="sectref" rel="parent" href="language.html">18. Python Language Services</A> | |
151 | <b class="navlabel">Next:</b> | |
152 | <a class="sectref" rel="next" href="module-dis.html">18.10 dis </A> | |
153 | </div> | |
154 | </div> | |
155 | <hr /> | |
156 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
157 | </DIV> | |
158 | <!--End of Navigation Panel--> | |
159 | <ADDRESS> | |
160 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
161 | </ADDRESS> | |
162 | </BODY> | |
163 | </HTML> |