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="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="node366.html" /> | |
13 | <link rel="prev" href="module-platform.html" /> | |
14 | <link rel="parent" href="module-platform.html" /> | |
15 | <link rel="next" href="node366.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>6.30.1 Cross Platform</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="6.30 platform " | |
25 | href="module-platform.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="6.30 platform " | |
28 | href="module-platform.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="6.30.2 Java Platform" | |
31 | href="node366.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="module-platform.html">6.30 platform </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-platform.html">6.30 platform </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="node366.html">6.30.2 Java Platform</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION0083010000000000000000"> | |
56 | 6.30.1 Cross Platform</A> | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
61 | <td><nobr><b><tt id='l2h-2567' xml:id='l2h-2567' class="function">architecture</tt></b>(</nobr></td> | |
62 | <td><var>executable=sys.executable, bits='', linkage=''</var>)</td></tr></table></dt> | |
63 | <dd> | |
64 | Queries the given executable (defaults to the Python interpreter | |
65 | binary) for various architecture information. | |
66 | ||
67 | <P> | |
68 | Returns a tuple <code>(bits, linkage)</code> which contain information about | |
69 | the bit architecture and the linkage format used for the | |
70 | executable. Both values are returned as strings. | |
71 | ||
72 | <P> | |
73 | Values that cannot be determined are returned as given by the | |
74 | parameter presets. If bits is given as <code>''</code>, the | |
75 | <tt class="cfunction">sizeof(pointer)</tt> | |
76 | (or <tt class="cfunction">sizeof(long)</tt> on Python version < 1.5.2) is used as | |
77 | indicator for the supported pointer size. | |
78 | ||
79 | <P> | |
80 | The function relies on the system's <span class="file">file</span> command to do the | |
81 | actual work. This is available on most if not all <span class="Unix">Unix</span> | |
82 | platforms and some non-<span class="Unix">Unix</span> platforms and then only if the | |
83 | executable points to the Python interpreter. Reasonable defaults | |
84 | are used when the above needs are not met. | |
85 | </dl> | |
86 | ||
87 | <P> | |
88 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
89 | <td><nobr><b><tt id='l2h-2568' xml:id='l2h-2568' class="function">machine</tt></b>(</nobr></td> | |
90 | <td><var></var>)</td></tr></table></dt> | |
91 | <dd> | |
92 | Returns the machine type, e.g. <code>'i386'</code>. | |
93 | An empty string is returned if the value cannot be determined. | |
94 | </dl> | |
95 | ||
96 | <P> | |
97 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
98 | <td><nobr><b><tt id='l2h-2569' xml:id='l2h-2569' class="function">node</tt></b>(</nobr></td> | |
99 | <td><var></var>)</td></tr></table></dt> | |
100 | <dd> | |
101 | Returns the computer's network name (may not be fully qualified!). | |
102 | An empty string is returned if the value cannot be determined. | |
103 | </dl> | |
104 | ||
105 | <P> | |
106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
107 | <td><nobr><b><tt id='l2h-2570' xml:id='l2h-2570' class="function">platform</tt></b>(</nobr></td> | |
108 | <td><var>aliased=0, terse=0</var>)</td></tr></table></dt> | |
109 | <dd> | |
110 | Returns a single string identifying the underlying platform | |
111 | with as much useful information as possible. | |
112 | ||
113 | <P> | |
114 | The output is intended to be <em>human readable</em> rather than | |
115 | machine parseable. It may look different on different platforms and | |
116 | this is intended. | |
117 | ||
118 | <P> | |
119 | If <var>aliased</var> is true, the function will use aliases for various | |
120 | platforms that report system names which differ from their common | |
121 | names, for example SunOS will be reported as Solaris. The | |
122 | <tt class="function">system_alias()</tt> function is used to implement this. | |
123 | ||
124 | <P> | |
125 | Setting <var>terse</var> to true causes the function to return only the | |
126 | absolute minimum information needed to identify the platform. | |
127 | </dl> | |
128 | ||
129 | <P> | |
130 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
131 | <td><nobr><b><tt id='l2h-2571' xml:id='l2h-2571' class="function">processor</tt></b>(</nobr></td> | |
132 | <td><var></var>)</td></tr></table></dt> | |
133 | <dd> | |
134 | Returns the (real) processor name, e.g. <code>'amdk6'</code>. | |
135 | ||
136 | <P> | |
137 | An empty string is returned if the value cannot be determined. Note | |
138 | that many platforms do not provide this information or simply return | |
139 | the same value as for <tt class="function">machine()</tt>. NetBSD does this. | |
140 | </dl> | |
141 | ||
142 | <P> | |
143 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
144 | <td><nobr><b><tt id='l2h-2572' xml:id='l2h-2572' class="function">python_build</tt></b>(</nobr></td> | |
145 | <td><var></var>)</td></tr></table></dt> | |
146 | <dd> | |
147 | Returns a tuple <code>(<var>buildno</var>, <var>builddate</var>)</code> stating the | |
148 | Python build number and date as strings. | |
149 | </dl> | |
150 | ||
151 | <P> | |
152 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
153 | <td><nobr><b><tt id='l2h-2573' xml:id='l2h-2573' class="function">python_compiler</tt></b>(</nobr></td> | |
154 | <td><var></var>)</td></tr></table></dt> | |
155 | <dd> | |
156 | Returns a string identifying the compiler used for compiling Python. | |
157 | </dl> | |
158 | ||
159 | <P> | |
160 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
161 | <td><nobr><b><tt id='l2h-2574' xml:id='l2h-2574' class="function">python_version</tt></b>(</nobr></td> | |
162 | <td><var></var>)</td></tr></table></dt> | |
163 | <dd> | |
164 | Returns the Python version as string <code>'major.minor.patchlevel'</code> | |
165 | ||
166 | <P> | |
167 | Note that unlike the Python <code>sys.version</code>, the returned value | |
168 | will always include the patchlevel (it defaults to 0). | |
169 | </dl> | |
170 | ||
171 | <P> | |
172 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
173 | <td><nobr><b><tt id='l2h-2575' xml:id='l2h-2575' class="function">python_version_tuple</tt></b>(</nobr></td> | |
174 | <td><var></var>)</td></tr></table></dt> | |
175 | <dd> | |
176 | Returns the Python version as tuple <code>(<var>major</var>, <var>minor</var>, | |
177 | <var>patchlevel</var>)</code> of strings. | |
178 | ||
179 | <P> | |
180 | Note that unlike the Python <code>sys.version</code>, the returned value | |
181 | will always include the patchlevel (it defaults to <code>'0'</code>). | |
182 | </dl> | |
183 | ||
184 | <P> | |
185 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
186 | <td><nobr><b><tt id='l2h-2576' xml:id='l2h-2576' class="function">release</tt></b>(</nobr></td> | |
187 | <td><var></var>)</td></tr></table></dt> | |
188 | <dd> | |
189 | Returns the system's release, e.g. <code>'2.2.0'</code> or <code>'NT'</code> | |
190 | An empty string is returned if the value cannot be determined. | |
191 | </dl> | |
192 | ||
193 | <P> | |
194 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
195 | <td><nobr><b><tt id='l2h-2577' xml:id='l2h-2577' class="function">system</tt></b>(</nobr></td> | |
196 | <td><var></var>)</td></tr></table></dt> | |
197 | <dd> | |
198 | Returns the system/OS name, e.g. <code>'Linux'</code>, <code>'Windows'</code>, | |
199 | or <code>'Java'</code>. | |
200 | An empty string is returned if the value cannot be determined. | |
201 | </dl> | |
202 | ||
203 | <P> | |
204 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
205 | <td><nobr><b><tt id='l2h-2578' xml:id='l2h-2578' class="function">system_alias</tt></b>(</nobr></td> | |
206 | <td><var>system, release, version</var>)</td></tr></table></dt> | |
207 | <dd> | |
208 | Returns <code>(<var>system</var>, <var>release</var>, <var>version</var>)</code> aliased | |
209 | to common marketing names used for some systems. It also does some | |
210 | reordering of the information in some cases where it would otherwise | |
211 | cause confusion. | |
212 | </dl> | |
213 | ||
214 | <P> | |
215 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
216 | <td><nobr><b><tt id='l2h-2579' xml:id='l2h-2579' class="function">version</tt></b>(</nobr></td> | |
217 | <td><var></var>)</td></tr></table></dt> | |
218 | <dd> | |
219 | Returns the system's release version, e.g. <code>'#3 on degas'</code>. | |
220 | An empty string is returned if the value cannot be determined. | |
221 | </dl> | |
222 | ||
223 | <P> | |
224 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
225 | <td><nobr><b><tt id='l2h-2580' xml:id='l2h-2580' class="function">uname</tt></b>(</nobr></td> | |
226 | <td><var></var>)</td></tr></table></dt> | |
227 | <dd> | |
228 | Fairly portable uname interface. Returns a tuple of strings | |
229 | <code>(<var>system</var>, <var>node</var>, <var>release</var>, <var>version</var>, | |
230 | <var>machine</var>, <var>processor</var>)</code> identifying the underlying | |
231 | platform. | |
232 | ||
233 | <P> | |
234 | Note that unlike the <tt class="function">os.uname()</tt> function this also returns | |
235 | possible processor information as additional tuple entry. | |
236 | ||
237 | <P> | |
238 | Entries which cannot be determined are set to <code>''</code>. | |
239 | </dl> | |
240 | ||
241 | <P> | |
242 | ||
243 | <DIV CLASS="navigation"> | |
244 | <div class='online-navigation'> | |
245 | <p></p><hr /> | |
246 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
247 | <tr> | |
248 | <td class='online-navigation'><a rel="prev" title="6.30 platform " | |
249 | href="module-platform.html"><img src='../icons/previous.png' | |
250 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
251 | <td class='online-navigation'><a rel="parent" title="6.30 platform " | |
252 | href="module-platform.html"><img src='../icons/up.png' | |
253 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
254 | <td class='online-navigation'><a rel="next" title="6.30.2 Java Platform" | |
255 | href="node366.html"><img src='../icons/next.png' | |
256 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
257 | <td align="center" width="100%">Python Library Reference</td> | |
258 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
259 | href="contents.html"><img src='../icons/contents.png' | |
260 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
261 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
262 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
263 | <td class='online-navigation'><a rel="index" title="Index" | |
264 | href="genindex.html"><img src='../icons/index.png' | |
265 | border='0' height='32' alt='Index' width='32' /></A></td> | |
266 | </tr></table> | |
267 | <div class='online-navigation'> | |
268 | <b class="navlabel">Previous:</b> | |
269 | <a class="sectref" rel="prev" href="module-platform.html">6.30 platform </A> | |
270 | <b class="navlabel">Up:</b> | |
271 | <a class="sectref" rel="parent" href="module-platform.html">6.30 platform </A> | |
272 | <b class="navlabel">Next:</b> | |
273 | <a class="sectref" rel="next" href="node366.html">6.30.2 Java Platform</A> | |
274 | </div> | |
275 | </div> | |
276 | <hr /> | |
277 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
278 | </DIV> | |
279 | <!--End of Navigation Panel--> | |
280 | <ADDRESS> | |
281 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
282 | </ADDRESS> | |
283 | </BODY> | |
284 | </HTML> |