Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-pkgutil.html
CommitLineData
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-modulefinder.html" />
13<link rel="prev" href="module-zipimport.html" />
14<link rel="parent" href="python.html" />
15<link rel="next" href="module-modulefinder.html" />
16<meta name='aesop' content='information' />
17<title>3.23 pkgutil -- Package extension utility</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="3.22.2 Examples"
25 href="node88.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="3. Python Runtime Services"
28 href="python.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="3.24 modulefinder "
31 href="module-modulefinder.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="node88.html">3.22.2 Examples</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-modulefinder.html">3.24 modulefinder </A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0052300000000000000000">
563.23 <tt class="module">pkgutil</tt> --
57 Package extension utility</A>
58</H1>
59
60<P>
61<A NAME="module-pkgutil"></A>
62
63<P>
64
65<span class="versionnote">New in version 2.3.</span>
66
67<P>
68This module provides a single function:
69
70<P>
71<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
72 <td><nobr><b><tt id='l2h-736' xml:id='l2h-736' class="function">extend_path</tt></b>(</nobr></td>
73 <td><var>path, name</var>)</td></tr></table></dt>
74<dd>
75 Extend the search path for the modules which comprise a package.
76 Intended use is to place the following code in a package's
77 <span class="file">__init__.py</span>:
78
79<P>
80<div class="verbatim"><pre>
81from pkgutil import extend_path
82__path__ = extend_path(__path__, __name__)
83</pre></div>
84
85<P>
86This will add to the package's <code>__path__</code> all subdirectories of
87 directories on <code>sys.path</code> named after the package. This is
88 useful if one wants to distribute different parts of a single
89 logical package as multiple directories.
90
91<P>
92It also looks for <span class="file">*.pkg</span> files beginning where <code>*</code>
93 matches the <var>name</var> argument. This feature is similar to
94 <span class="file">*.pth</span> files (see the <tt class="module"><a href="module-site.html">site</a></tt> module for more
95 information), except that it doesn't special-case lines starting
96 with <code>import</code>. A <span class="file">*.pkg</span> file is trusted at face value:
97 apart from checking for duplicates, all entries found in a
98 <span class="file">*.pkg</span> file are added to the path, regardless of whether they
99 exist the filesystem. (This is a feature.)
100
101<P>
102If the input path is not a list (as is the case for frozen
103 packages) it is returned unchanged. The input path is not
104 modified; an extended copy is returned. Items are only appended
105 to the copy at the end.
106
107<P>
108It is assumed that <code>sys.path</code> is a sequence. Items of
109 <code>sys.path</code> that are not (Unicode or 8-bit) strings referring to
110 existing directories are ignored. Unicode items on <code>sys.path</code>
111 that cause errors when used as filenames may cause this function to
112 raise an exception (in line with <tt class="function">os.path.isdir()</tt> behavior).
113</dl>
114
115<DIV CLASS="navigation">
116<div class='online-navigation'>
117<p></p><hr />
118<table align="center" width="100%" cellpadding="0" cellspacing="2">
119<tr>
120<td class='online-navigation'><a rel="prev" title="3.22.2 Examples"
121 href="node88.html"><img src='../icons/previous.png'
122 border='0' height='32' alt='Previous Page' width='32' /></A></td>
123<td class='online-navigation'><a rel="parent" title="3. Python Runtime Services"
124 href="python.html"><img src='../icons/up.png'
125 border='0' height='32' alt='Up One Level' width='32' /></A></td>
126<td class='online-navigation'><a rel="next" title="3.24 modulefinder "
127 href="module-modulefinder.html"><img src='../icons/next.png'
128 border='0' height='32' alt='Next Page' width='32' /></A></td>
129<td align="center" width="100%">Python Library Reference</td>
130<td class='online-navigation'><a rel="contents" title="Table of Contents"
131 href="contents.html"><img src='../icons/contents.png'
132 border='0' height='32' alt='Contents' width='32' /></A></td>
133<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
134 border='0' height='32' alt='Module Index' width='32' /></a></td>
135<td class='online-navigation'><a rel="index" title="Index"
136 href="genindex.html"><img src='../icons/index.png'
137 border='0' height='32' alt='Index' width='32' /></A></td>
138</tr></table>
139<div class='online-navigation'>
140<b class="navlabel">Previous:</b>
141<a class="sectref" rel="prev" href="node88.html">3.22.2 Examples</A>
142<b class="navlabel">Up:</b>
143<a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A>
144<b class="navlabel">Next:</b>
145<a class="sectref" rel="next" href="module-modulefinder.html">3.24 modulefinder </A>
146</div>
147</div>
148<hr />
149<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
150</DIV>
151<!--End of Navigation Panel-->
152<ADDRESS>
153See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
154</ADDRESS>
155</BODY>
156</HTML>