Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / dist / single-ext.html
CommitLineData
920dae64
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="prev" href="pure-pkg.html" />
12<link rel="parent" href="examples.html" />
13<link rel="next" href="extending.html" />
14<meta name='aesop' content='information' />
15<title>7.3 Single extension module</title>
16</head>
17<body>
18<DIV CLASS="navigation">
19<div id='top-navigation-panel' xml:id='top-navigation-panel'>
20<table align="center" width="100%" cellpadding="0" cellspacing="2">
21<tr>
22<td class='online-navigation'><a rel="prev" title="7.2 Pure Python distribution"
23 href="pure-pkg.html"><img src='../icons/previous.png'
24 border='0' height='32' alt='Previous Page' width='32' /></A></td>
25<td class='online-navigation'><a rel="parent" title="7. Examples"
26 href="examples.html"><img src='../icons/up.png'
27 border='0' height='32' alt='Up One Level' width='32' /></A></td>
28<td class='online-navigation'><a rel="next" title="8. Extending Distutils"
29 href="extending.html"><img src='../icons/next.png'
30 border='0' height='32' alt='Next Page' width='32' /></A></td>
31<td align="center" width="100%">Distributing Python Modules</td>
32<td class='online-navigation'><img src='../icons/blank.png'
33 border='0' height='32' alt='' width='32' /></td>
34<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
35 border='0' height='32' alt='Module Index' width='32' /></a></td>
36<td class='online-navigation'><a rel="index" title="Index"
37 href="genindex.html"><img src='../icons/index.png'
38 border='0' height='32' alt='Index' width='32' /></A></td>
39</tr></table>
40<div class='online-navigation'>
41<b class="navlabel">Previous:</b>
42<a class="sectref" rel="prev" href="pure-pkg.html">7.2 Pure Python distribution</A>
43<b class="navlabel">Up:</b>
44<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
45<b class="navlabel">Next:</b>
46<a class="sectref" rel="next" href="extending.html">8. Extending Distutils</A>
47</div>
48<hr /></div>
49</DIV>
50<!--End of Navigation Panel-->
51
52<H1><A NAME="SECTION007300000000000000000"></A>
53<A NAME="single-ext"></A>
54<BR>
557.3 Single extension module
56</H1>
57
58<P>
59Extension modules are specified using the <span class="du-option">ext_modules</span> option.
60<span class="du-option">package_dir</span> has no effect on where extension source files are
61found; it only affects the source for pure Python modules. The simplest
62case, a single extension module in a single C source file, is:
63<div class="verbatim"><pre>
64&lt;root&gt;/
65 setup.py
66 foo.c
67</pre></div>
68If the <tt class="module">foo</tt> extension belongs in the root package, the setup
69script for this could be
70<div class="verbatim"><pre>
71from distutils.core import setup
72setup(name='foobar',
73 version='1.0',
74 ext_modules=[Extension('foo', ['foo.c'])],
75 )
76</pre></div>
77
78<P>
79If the extension actually belongs in a package, say <tt class="module">foopkg</tt>,
80then
81
82<P>
83With exactly the same source tree layout, this extension can be put in
84the <tt class="module">foopkg</tt> package simply by changing the name of the
85extension:
86<div class="verbatim"><pre>
87from distutils.core import setup
88setup(name='foobar',
89 version='1.0',
90 ext_modules=[Extension('foopkg.foo', ['foo.c'])],
91 )
92</pre></div>
93
94<P>
95
96<DIV CLASS="navigation">
97<div class='online-navigation'>
98<p></p><hr />
99<table align="center" width="100%" cellpadding="0" cellspacing="2">
100<tr>
101<td class='online-navigation'><a rel="prev" title="7.2 Pure Python distribution"
102 href="pure-pkg.html"><img src='../icons/previous.png'
103 border='0' height='32' alt='Previous Page' width='32' /></A></td>
104<td class='online-navigation'><a rel="parent" title="7. Examples"
105 href="examples.html"><img src='../icons/up.png'
106 border='0' height='32' alt='Up One Level' width='32' /></A></td>
107<td class='online-navigation'><a rel="next" title="8. Extending Distutils"
108 href="extending.html"><img src='../icons/next.png'
109 border='0' height='32' alt='Next Page' width='32' /></A></td>
110<td align="center" width="100%">Distributing Python Modules</td>
111<td class='online-navigation'><img src='../icons/blank.png'
112 border='0' height='32' alt='' width='32' /></td>
113<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
114 border='0' height='32' alt='Module Index' width='32' /></a></td>
115<td class='online-navigation'><a rel="index" title="Index"
116 href="genindex.html"><img src='../icons/index.png'
117 border='0' height='32' alt='Index' width='32' /></A></td>
118</tr></table>
119<div class='online-navigation'>
120<b class="navlabel">Previous:</b>
121<a class="sectref" rel="prev" href="pure-pkg.html">7.2 Pure Python distribution</A>
122<b class="navlabel">Up:</b>
123<a class="sectref" rel="parent" href="examples.html">7. Examples</A>
124<b class="navlabel">Next:</b>
125<a class="sectref" rel="next" href="extending.html">8. Extending Distutils</A>
126</div>
127</div>
128<hr />
129<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
130</DIV>
131<!--End of Navigation Panel-->
132<ADDRESS>
133See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
134</ADDRESS>
135</BODY>
136</HTML>