Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / dist / pure-mod.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="dist.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="dist.html" title='Distributing Python Modules' />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="pure-pkg.html" />
<link rel="prev" href="examples.html" />
<link rel="parent" href="examples.html" />
<link rel="next" href="pure-pkg.html" />
<meta name='aesop' content='information' />
<title>7.1 Pure Python distribution (by module)</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7. Examples"
href="examples.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="7. Examples"
href="examples.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="7.2 Pure Python distribution"
href="pure-pkg.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Distributing Python Modules</td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="examples.html">7. Examples</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pure-pkg.html">7.2 Pure Python distribution</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION007100000000000000000"></A>
<A NAME="pure-mod"></A>
<BR>
7.1 Pure Python distribution (by module)
</H1>
<P>
If you're just distributing a couple of modules, especially if they
don't live in a particular package, you can specify them individually
using the <span class="du-option">py_modules</span> option in the setup script.
<P>
In the simplest case, you'll have two files to worry about: a setup
script and the single module you're distributing, <span class="file">foo.py</span> in this
example:
<div class="verbatim"><pre>
&lt;root&gt;/
setup.py
foo.py
</pre></div>
(In all diagrams in this section, <code>&lt;root&gt;</code> will refer to the
distribution root directory.) A minimal setup script to describe this
situation would be:
<div class="verbatim"><pre>
from distutils.core import setup
setup(name='foo',
version='1.0',
py_modules=['foo'],
)
</pre></div>
Note that the name of the distribution is specified independently with
the <span class="du-option">name</span> option, and there's no rule that says it has to be the
same as the name of the sole module in the distribution (although that's
probably a good convention to follow). However, the distribution name
is used to generate filenames, so you should stick to letters, digits,
underscores, and hyphens.
<P>
Since <span class="du-option">py_modules</span> is a list, you can of course specify multiple
modules, eg. if you're distributing modules <tt class="module">foo</tt> and
<tt class="module">bar</tt>, your setup might look like this:
<div class="verbatim"><pre>
&lt;root&gt;/
setup.py
foo.py
bar.py
</pre></div>
and the setup script might be
<div class="verbatim"><pre>
from distutils.core import setup
setup(name='foobar',
version='1.0',
py_modules=['foo', 'bar'],
)
</pre></div>
<P>
You can put module source files into another directory, but if you have
enough modules to do that, it's probably easier to specify modules by
package rather than listing them individually.
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7. Examples"
href="examples.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="7. Examples"
href="examples.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="7.2 Pure Python distribution"
href="pure-pkg.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Distributing Python Modules</td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="examples.html">7. Examples</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pure-pkg.html">7.2 Pure Python distribution</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>