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="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="postinstallation-script.html" /> | |
12 | <link rel="prev" href="creating-dumb.html" /> | |
13 | <link rel="parent" href="built-dist.html" /> | |
14 | <link rel="next" href="postinstallation-script.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>5.2 Creating RPM packages</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="5.1 Creating dumb built" | |
24 | href="creating-dumb.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="5. Creating Built Distributions" | |
27 | href="built-dist.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="5.3 Creating Windows Installers" | |
30 | href="postinstallation-script.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="creating-dumb.html">5.1 Creating dumb built</A> | |
44 | <b class="navlabel">Up:</b> | |
45 | <a class="sectref" rel="parent" href="built-dist.html">5. Creating Built Distributions</A> | |
46 | <b class="navlabel">Next:</b> | |
47 | <a class="sectref" rel="next" href="postinstallation-script.html">5.3 Creating Windows Installers</A> | |
48 | </div> | |
49 | <hr /></div> | |
50 | </DIV> | |
51 | <!--End of Navigation Panel--> | |
52 | ||
53 | <H1><A NAME="SECTION005200000000000000000"></A> | |
54 | <A NAME="creating-rpms"></A> | |
55 | <BR> | |
56 | 5.2 Creating RPM packages | |
57 | </H1> | |
58 | ||
59 | <P> | |
60 | The RPM format is used by many popular Linux distributions, including | |
61 | Red Hat, SuSE, and Mandrake. If one of these (or any of the other | |
62 | RPM-based Linux distributions) is your usual environment, creating RPM | |
63 | packages for other users of that same distribution is trivial. | |
64 | Depending on the complexity of your module distribution and differences | |
65 | between Linux distributions, you may also be able to create RPMs that | |
66 | work on different RPM-based distributions. | |
67 | ||
68 | <P> | |
69 | The usual way to create an RPM of your module distribution is to run the | |
70 | <code class="du-command">bdist_rpm</code> command: | |
71 | ||
72 | <P> | |
73 | <div class="verbatim"><pre> | |
74 | python setup.py bdist_rpm | |
75 | </pre></div> | |
76 | ||
77 | <P> | |
78 | or the <code class="du-command">bdist</code> command with the <b class="programopt">--format</b> option: | |
79 | ||
80 | <P> | |
81 | <div class="verbatim"><pre> | |
82 | python setup.py bdist --formats=rpm | |
83 | </pre></div> | |
84 | ||
85 | <P> | |
86 | The former allows you to specify RPM-specific options; the latter allows | |
87 | you to easily specify multiple formats in one run. If you need to do | |
88 | both, you can explicitly specify multiple <code class="du-command">bdist_*</code> commands | |
89 | and their options: | |
90 | ||
91 | <P> | |
92 | <div class="verbatim"><pre> | |
93 | python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>" \ | |
94 | bdist_wininst --target_version="2.0" | |
95 | </pre></div> | |
96 | ||
97 | <P> | |
98 | Creating RPM packages is driven by a <span class="file">.spec</span> file, much as using | |
99 | the Distutils is driven by the setup script. To make your life easier, | |
100 | the <code class="du-command">bdist_rpm</code> command normally creates a <span class="file">.spec</span> file | |
101 | based on the information you supply in the setup script, on the command | |
102 | line, and in any Distutils configuration files. Various options and | |
103 | sections in the <span class="file">.spec</span> file are derived from options in the setup | |
104 | script as follows: | |
105 | ||
106 | <P> | |
107 | <div class="center"><table class="realtable"> | |
108 | <thead> | |
109 | <tr> | |
110 | <th class="left" >RPM <span class="file">.spec</span> file option or section</th> | |
111 | <th class="left" >Distutils setup script option</th> | |
112 | </tr> | |
113 | </thead> | |
114 | <tbody> | |
115 | <tr><td class="left" valign="baseline">Name</td> | |
116 | <td class="left" ><span class="du-option">name</span></td></tr> | |
117 | <tr><td class="left" valign="baseline">Summary (in preamble)</td> | |
118 | <td class="left" ><span class="du-option">description</span></td></tr> | |
119 | <tr><td class="left" valign="baseline">Version</td> | |
120 | <td class="left" ><span class="du-option">version</span></td></tr> | |
121 | <tr><td class="left" valign="baseline">Vendor</td> | |
122 | <td class="left" ><span class="du-option">author</span> and <span class="du-option">author_email</span>, or | |
123 | <BR>& | |
124 | <span class="du-option">maintainer</span> and <span class="du-option">maintainer_email</span></td></tr> | |
125 | <tr><td class="left" valign="baseline">Copyright</td> | |
126 | <td class="left" ><span class="du-option">licence</span></td></tr> | |
127 | <tr><td class="left" valign="baseline">Url</td> | |
128 | <td class="left" ><span class="du-option">url</span></td></tr> | |
129 | <tr><td class="left" valign="baseline">%description (section)</td> | |
130 | <td class="left" ><span class="du-option">long_description</span></td></tr></tbody> | |
131 | </table></div> | |
132 | ||
133 | <P> | |
134 | Additionally, there many options in <span class="file">.spec</span> files that don't have | |
135 | corresponding options in the setup script. Most of these are handled | |
136 | through options to the <code class="du-command">bdist_rpm</code> command as follows: | |
137 | ||
138 | <P> | |
139 | <div class="center"><table class="realtable"> | |
140 | <thead> | |
141 | <tr> | |
142 | <th class="left" >RPM <span class="file">.spec</span> file option or section</th> | |
143 | <th class="left" ><code class="du-command">bdist_rpm</code> option</th> | |
144 | <th class="left" >default value</th> | |
145 | </tr> | |
146 | </thead> | |
147 | <tbody> | |
148 | <tr><td class="left" valign="baseline">Release</td> | |
149 | <td class="left" ><span class="du-option">release</span></td> | |
150 | <td class="left" >``1''</td></tr> | |
151 | <tr><td class="left" valign="baseline">Group</td> | |
152 | <td class="left" ><span class="du-option">group</span></td> | |
153 | <td class="left" >``Development/Libraries''</td></tr> | |
154 | <tr><td class="left" valign="baseline">Vendor</td> | |
155 | <td class="left" ><span class="du-option">vendor</span></td> | |
156 | <td class="left" >(see above)</td></tr> | |
157 | <tr><td class="left" valign="baseline">Packager</td> | |
158 | <td class="left" ><span class="du-option">packager</span></td> | |
159 | <td class="left" >(none)</td></tr> | |
160 | <tr><td class="left" valign="baseline">Provides</td> | |
161 | <td class="left" ><span class="du-option">provides</span></td> | |
162 | <td class="left" >(none)</td></tr> | |
163 | <tr><td class="left" valign="baseline">Requires</td> | |
164 | <td class="left" ><span class="du-option">requires</span></td> | |
165 | <td class="left" >(none)</td></tr> | |
166 | <tr><td class="left" valign="baseline">Conflicts</td> | |
167 | <td class="left" ><span class="du-option">conflicts</span></td> | |
168 | <td class="left" >(none)</td></tr> | |
169 | <tr><td class="left" valign="baseline">Obsoletes</td> | |
170 | <td class="left" ><span class="du-option">obsoletes</span></td> | |
171 | <td class="left" >(none)</td></tr> | |
172 | <tr><td class="left" valign="baseline">Distribution</td> | |
173 | <td class="left" ><span class="du-option">distribution_name</span></td> | |
174 | <td class="left" >(none)</td></tr> | |
175 | <tr><td class="left" valign="baseline">BuildRequires</td> | |
176 | <td class="left" ><span class="du-option">build_requires</span></td> | |
177 | <td class="left" >(none)</td></tr> | |
178 | <tr><td class="left" valign="baseline">Icon</td> | |
179 | <td class="left" ><span class="du-option">icon</span></td> | |
180 | <td class="left" >(none)</td></tr></tbody> | |
181 | </table></div> | |
182 | ||
183 | <P> | |
184 | Obviously, supplying even a few of these options on the command-line | |
185 | would be tedious and error-prone, so it's usually best to put them in | |
186 | the setup configuration file, <span class="file">setup.cfg</span>--see | |
187 | section <A href="setup-config.html#setup-config">3</A>. If you distribute or package many Python | |
188 | module distributions, you might want to put options that apply to all of | |
189 | them in your personal Distutils configuration file | |
190 | (<span class="file">~/.pydistutils.cfg</span>). | |
191 | ||
192 | <P> | |
193 | There are three steps to building a binary RPM package, all of which are | |
194 | handled automatically by the Distutils: | |
195 | ||
196 | <P> | |
197 | ||
198 | <OL> | |
199 | <LI>create a <span class="file">.spec</span> file, which describes the package (analogous | |
200 | to the Distutils setup script; in fact, much of the information in the | |
201 | setup script winds up in the <span class="file">.spec</span> file) | |
202 | </LI> | |
203 | <LI>create the source RPM | |
204 | </LI> | |
205 | <LI>create the ``binary'' RPM (which may or may not contain binary | |
206 | code, depending on whether your module distribution contains Python | |
207 | extensions) | |
208 | </LI> | |
209 | </OL> | |
210 | ||
211 | <P> | |
212 | Normally, RPM bundles the last two steps together; when you use the | |
213 | Distutils, all three steps are typically bundled together. | |
214 | ||
215 | <P> | |
216 | If you wish, you can separate these three steps. You can use the | |
217 | <b class="programopt">--spec-only</b> option to make <code class="du-command">bdist_rpm</code> just | |
218 | create the <span class="file">.spec</span> file and exit; in this case, the <span class="file">.spec</span> | |
219 | file will be written to the ``distribution directory''--normally | |
220 | <span class="file">dist/</span>, but customizable with the <b class="programopt">--dist-dir</b> | |
221 | option. (Normally, the <span class="file">.spec</span> file winds up deep in the ``build | |
222 | tree,'' in a temporary directory created by <code class="du-command">bdist_rpm</code>.) | |
223 | ||
224 | <P> | |
225 | ||
226 | <DIV CLASS="navigation"> | |
227 | <div class='online-navigation'> | |
228 | <p></p><hr /> | |
229 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
230 | <tr> | |
231 | <td class='online-navigation'><a rel="prev" title="5.1 Creating dumb built" | |
232 | href="creating-dumb.html"><img src='../icons/previous.png' | |
233 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
234 | <td class='online-navigation'><a rel="parent" title="5. Creating Built Distributions" | |
235 | href="built-dist.html"><img src='../icons/up.png' | |
236 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
237 | <td class='online-navigation'><a rel="next" title="5.3 Creating Windows Installers" | |
238 | href="postinstallation-script.html"><img src='../icons/next.png' | |
239 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
240 | <td align="center" width="100%">Distributing Python Modules</td> | |
241 | <td class='online-navigation'><img src='../icons/blank.png' | |
242 | border='0' height='32' alt='' width='32' /></td> | |
243 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
244 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
245 | <td class='online-navigation'><a rel="index" title="Index" | |
246 | href="genindex.html"><img src='../icons/index.png' | |
247 | border='0' height='32' alt='Index' width='32' /></A></td> | |
248 | </tr></table> | |
249 | <div class='online-navigation'> | |
250 | <b class="navlabel">Previous:</b> | |
251 | <a class="sectref" rel="prev" href="creating-dumb.html">5.1 Creating dumb built</A> | |
252 | <b class="navlabel">Up:</b> | |
253 | <a class="sectref" rel="parent" href="built-dist.html">5. Creating Built Distributions</A> | |
254 | <b class="navlabel">Next:</b> | |
255 | <a class="sectref" rel="next" href="postinstallation-script.html">5.3 Creating Windows Installers</A> | |
256 | </div> | |
257 | </div> | |
258 | <hr /> | |
259 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
260 | </DIV> | |
261 | <!--End of Navigation Panel--> | |
262 | <ADDRESS> | |
263 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
264 | </ADDRESS> | |
265 | </BODY> | |
266 | </HTML> |