Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / dist / pure-mod.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="dist.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="dist.html" title='Distributing Python Modules' />
8<link rel='index' href='genindex.html' title='Index' />
9<link rel='last' href='about.html' title='About this document...' />
10<link rel='help' href='about.html' title='About this document...' />
11<link rel="next" href="pure-pkg.html" />
12<link rel="prev" href="examples.html" />
13<link rel="parent" href="examples.html" />
14<link rel="next" href="pure-pkg.html" />
15<meta name='aesop' content='information' />
16<title>7.1 Pure Python distribution (by module)</title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="7. Examples"
24 href="examples.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="7. Examples"
27 href="examples.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="7.2 Pure Python distribution"
30 href="pure-pkg.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Distributing Python Modules</td>
33<td class='online-navigation'><img src='../icons/blank.png'
34 border='0' height='32' alt='' width='32' /></td>
35<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
36 border='0' height='32' alt='Module Index' width='32' /></a></td>
37<td class='online-navigation'><a rel="index" title="Index"
38 href="genindex.html"><img src='../icons/index.png'
39 border='0' height='32' alt='Index' width='32' /></A></td>
40</tr></table>
41<div class='online-navigation'>
42<b class="navlabel">Previous:</b>
43<a class="sectref" rel="prev" href="examples.html">7. Examples</A>
44<b class="navlabel">Up:</b>
45<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
46<b class="navlabel">Next:</b>
47<a class="sectref" rel="next" href="pure-pkg.html">7.2 Pure Python distribution</A>
48</div>
49<hr /></div>
50</DIV>
51<!--End of Navigation Panel-->
52
53<H1><A NAME="SECTION007100000000000000000"></A>
54<A NAME="pure-mod"></A>
55<BR>
567.1 Pure Python distribution (by module)
57</H1>
58
59<P>
60If you're just distributing a couple of modules, especially if they
61don't live in a particular package, you can specify them individually
62using the <span class="du-option">py_modules</span> option in the setup script.
63
64<P>
65In the simplest case, you'll have two files to worry about: a setup
66script and the single module you're distributing, <span class="file">foo.py</span> in this
67example:
68<div class="verbatim"><pre>
69&lt;root&gt;/
70 setup.py
71 foo.py
72</pre></div>
73(In all diagrams in this section, <code>&lt;root&gt;</code> will refer to the
74distribution root directory.) A minimal setup script to describe this
75situation would be:
76<div class="verbatim"><pre>
77from distutils.core import setup
78setup(name='foo',
79 version='1.0',
80 py_modules=['foo'],
81 )
82</pre></div>
83Note that the name of the distribution is specified independently with
84the <span class="du-option">name</span> option, and there's no rule that says it has to be the
85same as the name of the sole module in the distribution (although that's
86probably a good convention to follow). However, the distribution name
87is used to generate filenames, so you should stick to letters, digits,
88underscores, and hyphens.
89
90<P>
91Since <span class="du-option">py_modules</span> is a list, you can of course specify multiple
92modules, eg. if you're distributing modules <tt class="module">foo</tt> and
93<tt class="module">bar</tt>, your setup might look like this:
94<div class="verbatim"><pre>
95&lt;root&gt;/
96 setup.py
97 foo.py
98 bar.py
99</pre></div>
100and the setup script might be
101<div class="verbatim"><pre>
102from distutils.core import setup
103setup(name='foobar',
104 version='1.0',
105 py_modules=['foo', 'bar'],
106 )
107</pre></div>
108
109<P>
110You can put module source files into another directory, but if you have
111enough modules to do that, it's probably easier to specify modules by
112package rather than listing them individually.
113
114<P>
115
116<DIV CLASS="navigation">
117<div class='online-navigation'>
118<p></p><hr />
119<table align="center" width="100%" cellpadding="0" cellspacing="2">
120<tr>
121<td class='online-navigation'><a rel="prev" title="7. Examples"
122 href="examples.html"><img src='../icons/previous.png'
123 border='0' height='32' alt='Previous Page' width='32' /></A></td>
124<td class='online-navigation'><a rel="parent" title="7. Examples"
125 href="examples.html"><img src='../icons/up.png'
126 border='0' height='32' alt='Up One Level' width='32' /></A></td>
127<td class='online-navigation'><a rel="next" title="7.2 Pure Python distribution"
128 href="pure-pkg.html"><img src='../icons/next.png'
129 border='0' height='32' alt='Next Page' width='32' /></A></td>
130<td align="center" width="100%">Distributing Python Modules</td>
131<td class='online-navigation'><img src='../icons/blank.png'
132 border='0' height='32' alt='' width='32' /></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="examples.html">7. Examples</A>
142<b class="navlabel">Up:</b>
143<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
144<b class="navlabel">Next:</b>
145<a class="sectref" rel="next" href="pure-pkg.html">7.2 Pure Python distribution</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>