~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.11-docs-html/library/platform.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
 
 
4
 
 
5
 
<html xmlns="http://www.w3.org/1999/xhtml">
6
 
  <head>
7
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
 
    
9
 
    <title>15.15. platform — Access to underlying platform’s identifying data &mdash; Python 2.7.11 documentation</title>
10
 
    
11
 
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
12
 
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
 
    
14
 
    <script type="text/javascript">
15
 
      var DOCUMENTATION_OPTIONS = {
16
 
        URL_ROOT:    '../',
17
 
        VERSION:     '2.7.11',
18
 
        COLLAPSE_INDEX: false,
19
 
        FILE_SUFFIX: '.html',
20
 
        HAS_SOURCE:  true
21
 
      };
22
 
    </script>
23
 
    <script type="text/javascript" src="../_static/jquery.js"></script>
24
 
    <script type="text/javascript" src="../_static/underscore.js"></script>
25
 
    <script type="text/javascript" src="../_static/doctools.js"></script>
26
 
    <script type="text/javascript" src="../_static/sidebar.js"></script>
27
 
    <link rel="search" type="application/opensearchdescription+xml"
28
 
          title="Search within Python 2.7.11 documentation"
29
 
          href="../_static/opensearch.xml"/>
30
 
    <link rel="author" title="About these documents" href="../about.html" />
31
 
    <link rel="copyright" title="Copyright" href="../copyright.html" />
32
 
    <link rel="top" title="Python 2.7.11 documentation" href="../contents.html" />
33
 
    <link rel="up" title="15. Generic Operating System Services" href="allos.html" />
34
 
    <link rel="next" title="15.16. errno — Standard errno system symbols" href="errno.html" />
35
 
    <link rel="prev" title="15.14. curses.panel — A panel stack extension for curses" href="curses.panel.html" />
36
 
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
 
    <script type="text/javascript" src="../_static/copybutton.js"></script>
38
 
    <script type="text/javascript" src="../_static/version_switch.js"></script>
39
 
 
40
 
    
41
 
 
42
 
  </head>
43
 
  <body role="document">  
44
 
    <div class="related" role="navigation" aria-label="related navigation">
45
 
      <h3>Navigation</h3>
46
 
      <ul>
47
 
        <li class="right" style="margin-right: 10px">
48
 
          <a href="../genindex.html" title="General Index"
49
 
             accesskey="I">index</a></li>
50
 
        <li class="right" >
51
 
          <a href="../py-modindex.html" title="Python Module Index"
52
 
             >modules</a> |</li>
53
 
        <li class="right" >
54
 
          <a href="errno.html" title="15.16. errno — Standard errno system symbols"
55
 
             accesskey="N">next</a> |</li>
56
 
        <li class="right" >
57
 
          <a href="curses.panel.html" title="15.14. curses.panel — A panel stack extension for curses"
58
 
             accesskey="P">previous</a> |</li>
59
 
        <li><img src="../_static/py.png" alt=""
60
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
61
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
62
 
        <li>
63
 
          <span class="version_switcher_placeholder">2.7.11</span>
64
 
          <a href="../index.html">Documentation</a> &raquo;
65
 
        </li>
66
 
 
67
 
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
68
 
          <li class="nav-item nav-item-2"><a href="allos.html" accesskey="U">15. Generic Operating System Services</a> &raquo;</li> 
69
 
      </ul>
70
 
    </div>    
71
 
 
72
 
    <div class="document">
73
 
      <div class="documentwrapper">
74
 
        <div class="bodywrapper">
75
 
          <div class="body" role="main">
76
 
            
77
 
  <div class="section" id="module-platform">
78
 
<span id="platform-access-to-underlying-platform-s-identifying-data"></span><h1>15.15. <a class="reference internal" href="#module-platform" title="platform: Retrieves as much platform identifying data as possible."><code class="xref py py-mod docutils literal"><span class="pre">platform</span></code></a> &#8212;  Access to underlying platform&#8217;s identifying data<a class="headerlink" href="#module-platform" title="Permalink to this headline">¶</a></h1>
79
 
<div class="versionadded">
80
 
<p><span class="versionmodified">New in version 2.3.</span></p>
81
 
</div>
82
 
<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/2.7/Lib/platform.py">Lib/platform.py</a></p>
83
 
<hr class="docutils" />
84
 
<div class="admonition note">
85
 
<p class="first admonition-title">Note</p>
86
 
<p class="last">Specific platforms listed alphabetically, with Linux included in the Unix
87
 
section.</p>
88
 
</div>
89
 
<div class="section" id="cross-platform">
90
 
<h2>15.15.1. Cross Platform<a class="headerlink" href="#cross-platform" title="Permalink to this headline">¶</a></h2>
91
 
<dl class="function">
92
 
<dt id="platform.architecture">
93
 
<code class="descclassname">platform.</code><code class="descname">architecture</code><span class="sig-paren">(</span><em>executable=sys.executable</em>, <em>bits=''</em>, <em>linkage=''</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.architecture" title="Permalink to this definition">¶</a></dt>
94
 
<dd><p>Queries the given executable (defaults to the Python interpreter binary) for
95
 
various architecture information.</p>
96
 
<p>Returns a tuple <code class="docutils literal"><span class="pre">(bits,</span> <span class="pre">linkage)</span></code> which contain information about the bit
97
 
architecture and the linkage format used for the executable. Both values are
98
 
returned as strings.</p>
99
 
<p>Values that cannot be determined are returned as given by the parameter presets.
100
 
If bits is given as <code class="docutils literal"><span class="pre">''</span></code>, the <code class="xref c c-func docutils literal"><span class="pre">sizeof(pointer)()</span></code> (or
101
 
<code class="xref c c-func docutils literal"><span class="pre">sizeof(long)()</span></code> on Python version &lt; 1.5.2) is used as indicator for the
102
 
supported pointer size.</p>
103
 
<p>The function relies on the system&#8217;s <code class="file docutils literal"><span class="pre">file</span></code> command to do the actual work.
104
 
This is available on most if not all Unix  platforms and some non-Unix platforms
105
 
and then only if the executable points to the Python interpreter.  Reasonable
106
 
defaults are used when the above needs are not met.</p>
107
 
<div class="admonition note">
108
 
<p class="first admonition-title">Note</p>
109
 
<p>On Mac OS X (and perhaps other platforms), executable files may be
110
 
universal files containing multiple architectures.</p>
111
 
<p>To get at the &#8220;64-bitness&#8221; of the current interpreter, it is more
112
 
reliable to query the <a class="reference internal" href="sys.html#sys.maxsize" title="sys.maxsize"><code class="xref py py-attr docutils literal"><span class="pre">sys.maxsize</span></code></a> attribute:</p>
113
 
<div class="last highlight-python"><div class="highlight"><pre><span class="n">is_64bits</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">maxsize</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="o">**</span><span class="mi">32</span>
114
 
</pre></div>
115
 
</div>
116
 
</div>
117
 
</dd></dl>
118
 
 
119
 
<dl class="function">
120
 
<dt id="platform.machine">
121
 
<code class="descclassname">platform.</code><code class="descname">machine</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.machine" title="Permalink to this definition">¶</a></dt>
122
 
<dd><p>Returns the machine type, e.g. <code class="docutils literal"><span class="pre">'i386'</span></code>. An empty string is returned if the
123
 
value cannot be determined.</p>
124
 
</dd></dl>
125
 
 
126
 
<dl class="function">
127
 
<dt id="platform.node">
128
 
<code class="descclassname">platform.</code><code class="descname">node</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.node" title="Permalink to this definition">¶</a></dt>
129
 
<dd><p>Returns the computer&#8217;s network name (may not be fully qualified!). An empty
130
 
string is returned if the value cannot be determined.</p>
131
 
</dd></dl>
132
 
 
133
 
<dl class="function">
134
 
<dt id="platform.platform">
135
 
<code class="descclassname">platform.</code><code class="descname">platform</code><span class="sig-paren">(</span><em>aliased=0</em>, <em>terse=0</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.platform" title="Permalink to this definition">¶</a></dt>
136
 
<dd><p>Returns a single string identifying the underlying platform with as much useful
137
 
information as possible.</p>
138
 
<p>The output is intended to be <em>human readable</em> rather than machine parseable. It
139
 
may look different on different platforms and this is intended.</p>
140
 
<p>If <em>aliased</em> is true, the function will use aliases for various platforms that
141
 
report system names which differ from their common names, for example SunOS will
142
 
be reported as Solaris.  The <a class="reference internal" href="#platform.system_alias" title="platform.system_alias"><code class="xref py py-func docutils literal"><span class="pre">system_alias()</span></code></a> function is used to implement
143
 
this.</p>
144
 
<p>Setting <em>terse</em> to true causes the function to return only the absolute minimum
145
 
information needed to identify the platform.</p>
146
 
</dd></dl>
147
 
 
148
 
<dl class="function">
149
 
<dt id="platform.processor">
150
 
<code class="descclassname">platform.</code><code class="descname">processor</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.processor" title="Permalink to this definition">¶</a></dt>
151
 
<dd><p>Returns the (real) processor name, e.g. <code class="docutils literal"><span class="pre">'amdk6'</span></code>.</p>
152
 
<p>An empty string is returned if the value cannot be determined. Note that many
153
 
platforms do not provide this information or simply return the same value as for
154
 
<a class="reference internal" href="#platform.machine" title="platform.machine"><code class="xref py py-func docutils literal"><span class="pre">machine()</span></code></a>.  NetBSD does this.</p>
155
 
</dd></dl>
156
 
 
157
 
<dl class="function">
158
 
<dt id="platform.python_build">
159
 
<code class="descclassname">platform.</code><code class="descname">python_build</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_build" title="Permalink to this definition">¶</a></dt>
160
 
<dd><p>Returns a tuple <code class="docutils literal"><span class="pre">(buildno,</span> <span class="pre">builddate)</span></code> stating the Python build number and
161
 
date as strings.</p>
162
 
</dd></dl>
163
 
 
164
 
<dl class="function">
165
 
<dt id="platform.python_compiler">
166
 
<code class="descclassname">platform.</code><code class="descname">python_compiler</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_compiler" title="Permalink to this definition">¶</a></dt>
167
 
<dd><p>Returns a string identifying the compiler used for compiling Python.</p>
168
 
</dd></dl>
169
 
 
170
 
<dl class="function">
171
 
<dt id="platform.python_branch">
172
 
<code class="descclassname">platform.</code><code class="descname">python_branch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_branch" title="Permalink to this definition">¶</a></dt>
173
 
<dd><p>Returns a string identifying the Python implementation SCM branch.</p>
174
 
<div class="versionadded">
175
 
<p><span class="versionmodified">New in version 2.6.</span></p>
176
 
</div>
177
 
</dd></dl>
178
 
 
179
 
<dl class="function">
180
 
<dt id="platform.python_implementation">
181
 
<code class="descclassname">platform.</code><code class="descname">python_implementation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_implementation" title="Permalink to this definition">¶</a></dt>
182
 
<dd><p>Returns a string identifying the Python implementation. Possible return values
183
 
are: &#8216;CPython&#8217;, &#8216;IronPython&#8217;, &#8216;Jython&#8217;, &#8216;PyPy&#8217;.</p>
184
 
<div class="versionadded">
185
 
<p><span class="versionmodified">New in version 2.6.</span></p>
186
 
</div>
187
 
</dd></dl>
188
 
 
189
 
<dl class="function">
190
 
<dt id="platform.python_revision">
191
 
<code class="descclassname">platform.</code><code class="descname">python_revision</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_revision" title="Permalink to this definition">¶</a></dt>
192
 
<dd><p>Returns a string identifying the Python implementation SCM revision.</p>
193
 
<div class="versionadded">
194
 
<p><span class="versionmodified">New in version 2.6.</span></p>
195
 
</div>
196
 
</dd></dl>
197
 
 
198
 
<dl class="function">
199
 
<dt id="platform.python_version">
200
 
<code class="descclassname">platform.</code><code class="descname">python_version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_version" title="Permalink to this definition">¶</a></dt>
201
 
<dd><p>Returns the Python version as string <code class="docutils literal"><span class="pre">'major.minor.patchlevel'</span></code>.</p>
202
 
<p>Note that unlike the Python <code class="docutils literal"><span class="pre">sys.version</span></code>, the returned value will always
203
 
include the patchlevel (it defaults to 0).</p>
204
 
</dd></dl>
205
 
 
206
 
<dl class="function">
207
 
<dt id="platform.python_version_tuple">
208
 
<code class="descclassname">platform.</code><code class="descname">python_version_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_version_tuple" title="Permalink to this definition">¶</a></dt>
209
 
<dd><p>Returns the Python version as tuple <code class="docutils literal"><span class="pre">(major,</span> <span class="pre">minor,</span> <span class="pre">patchlevel)</span></code> of strings.</p>
210
 
<p>Note that unlike the Python <code class="docutils literal"><span class="pre">sys.version</span></code>, the returned value will always
211
 
include the patchlevel (it defaults to <code class="docutils literal"><span class="pre">'0'</span></code>).</p>
212
 
</dd></dl>
213
 
 
214
 
<dl class="function">
215
 
<dt id="platform.release">
216
 
<code class="descclassname">platform.</code><code class="descname">release</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.release" title="Permalink to this definition">¶</a></dt>
217
 
<dd><p>Returns the system&#8217;s release, e.g. <code class="docutils literal"><span class="pre">'2.2.0'</span></code> or <code class="docutils literal"><span class="pre">'NT'</span></code> An empty string is
218
 
returned if the value cannot be determined.</p>
219
 
</dd></dl>
220
 
 
221
 
<dl class="function">
222
 
<dt id="platform.system">
223
 
<code class="descclassname">platform.</code><code class="descname">system</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.system" title="Permalink to this definition">¶</a></dt>
224
 
<dd><p>Returns the system/OS name, e.g. <code class="docutils literal"><span class="pre">'Linux'</span></code>, <code class="docutils literal"><span class="pre">'Windows'</span></code>, or <code class="docutils literal"><span class="pre">'Java'</span></code>. An
225
 
empty string is returned if the value cannot be determined.</p>
226
 
</dd></dl>
227
 
 
228
 
<dl class="function">
229
 
<dt id="platform.system_alias">
230
 
<code class="descclassname">platform.</code><code class="descname">system_alias</code><span class="sig-paren">(</span><em>system</em>, <em>release</em>, <em>version</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.system_alias" title="Permalink to this definition">¶</a></dt>
231
 
<dd><p>Returns <code class="docutils literal"><span class="pre">(system,</span> <span class="pre">release,</span> <span class="pre">version)</span></code> aliased to common marketing names used
232
 
for some systems.  It also does some reordering of the information in some cases
233
 
where it would otherwise cause confusion.</p>
234
 
</dd></dl>
235
 
 
236
 
<dl class="function">
237
 
<dt id="platform.version">
238
 
<code class="descclassname">platform.</code><code class="descname">version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.version" title="Permalink to this definition">¶</a></dt>
239
 
<dd><p>Returns the system&#8217;s release version, e.g. <code class="docutils literal"><span class="pre">'#3</span> <span class="pre">on</span> <span class="pre">degas'</span></code>. An empty string is
240
 
returned if the value cannot be determined.</p>
241
 
</dd></dl>
242
 
 
243
 
<dl class="function">
244
 
<dt id="platform.uname">
245
 
<code class="descclassname">platform.</code><code class="descname">uname</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.uname" title="Permalink to this definition">¶</a></dt>
246
 
<dd><p>Fairly portable uname interface. Returns a tuple of strings <code class="docutils literal"><span class="pre">(system,</span> <span class="pre">node,</span>
247
 
<span class="pre">release,</span> <span class="pre">version,</span> <span class="pre">machine,</span> <span class="pre">processor)</span></code> identifying the underlying platform.</p>
248
 
<p>Note that unlike the <a class="reference internal" href="os.html#os.uname" title="os.uname"><code class="xref py py-func docutils literal"><span class="pre">os.uname()</span></code></a> function this also returns possible
249
 
processor information as additional tuple entry.</p>
250
 
<p>Entries which cannot be determined are set to <code class="docutils literal"><span class="pre">''</span></code>.</p>
251
 
</dd></dl>
252
 
 
253
 
</div>
254
 
<div class="section" id="java-platform">
255
 
<h2>15.15.2. Java Platform<a class="headerlink" href="#java-platform" title="Permalink to this headline">¶</a></h2>
256
 
<dl class="function">
257
 
<dt id="platform.java_ver">
258
 
<code class="descclassname">platform.</code><code class="descname">java_ver</code><span class="sig-paren">(</span><em>release=''</em>, <em>vendor=''</em>, <em>vminfo=(''</em>, <em>''</em>, <em>'')</em>, <em>osinfo=(''</em>, <em>''</em>, <em>'')</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.java_ver" title="Permalink to this definition">¶</a></dt>
259
 
<dd><p>Version interface for Jython.</p>
260
 
<p>Returns a tuple <code class="docutils literal"><span class="pre">(release,</span> <span class="pre">vendor,</span> <span class="pre">vminfo,</span> <span class="pre">osinfo)</span></code> with <em>vminfo</em> being a
261
 
tuple <code class="docutils literal"><span class="pre">(vm_name,</span> <span class="pre">vm_release,</span> <span class="pre">vm_vendor)</span></code> and <em>osinfo</em> being a tuple
262
 
<code class="docutils literal"><span class="pre">(os_name,</span> <span class="pre">os_version,</span> <span class="pre">os_arch)</span></code>. Values which cannot be determined are set to
263
 
the defaults given as parameters (which all default to <code class="docutils literal"><span class="pre">''</span></code>).</p>
264
 
</dd></dl>
265
 
 
266
 
</div>
267
 
<div class="section" id="windows-platform">
268
 
<h2>15.15.3. Windows Platform<a class="headerlink" href="#windows-platform" title="Permalink to this headline">¶</a></h2>
269
 
<dl class="function">
270
 
<dt id="platform.win32_ver">
271
 
<code class="descclassname">platform.</code><code class="descname">win32_ver</code><span class="sig-paren">(</span><em>release=''</em>, <em>version=''</em>, <em>csd=''</em>, <em>ptype=''</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.win32_ver" title="Permalink to this definition">¶</a></dt>
272
 
<dd><p>Get additional version information from the Windows Registry and return a tuple
273
 
<code class="docutils literal"><span class="pre">(release,</span> <span class="pre">version,</span> <span class="pre">csd,</span> <span class="pre">ptype)</span></code> referring to OS release, version number,
274
 
CSD level (service pack) and OS type (multi/single processor).</p>
275
 
<p>As a hint: <em>ptype</em> is <code class="docutils literal"><span class="pre">'Uniprocessor</span> <span class="pre">Free'</span></code> on single processor NT machines
276
 
and <code class="docutils literal"><span class="pre">'Multiprocessor</span> <span class="pre">Free'</span></code> on multi processor machines. The <em>&#8216;Free&#8217;</em> refers
277
 
to the OS version being free of debugging code. It could also state <em>&#8216;Checked&#8217;</em>
278
 
which means the OS version uses debugging code, i.e. code that checks arguments,
279
 
ranges, etc.</p>
280
 
<div class="admonition note">
281
 
<p class="first admonition-title">Note</p>
282
 
<p class="last">This function works best with Mark Hammond&#8217;s
283
 
<code class="xref py py-mod docutils literal"><span class="pre">win32all</span></code> package installed, but also on Python 2.3 and
284
 
later (support for this was added in Python 2.6). It obviously
285
 
only runs on Win32 compatible platforms.</p>
286
 
</div>
287
 
</dd></dl>
288
 
 
289
 
<div class="section" id="win95-98-specific">
290
 
<h3>15.15.3.1. Win95/98 specific<a class="headerlink" href="#win95-98-specific" title="Permalink to this headline">¶</a></h3>
291
 
<dl class="function">
292
 
<dt id="platform.popen">
293
 
<code class="descclassname">platform.</code><code class="descname">popen</code><span class="sig-paren">(</span><em>cmd</em>, <em>mode='r'</em>, <em>bufsize=None</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.popen" title="Permalink to this definition">¶</a></dt>
294
 
<dd><p>Portable <a class="reference internal" href="#platform.popen" title="platform.popen"><code class="xref py py-func docutils literal"><span class="pre">popen()</span></code></a> interface.  Find a working popen implementation
295
 
preferring <code class="xref py py-func docutils literal"><span class="pre">win32pipe.popen()</span></code>.  On Windows NT, <code class="xref py py-func docutils literal"><span class="pre">win32pipe.popen()</span></code>
296
 
should work; on Windows 9x it hangs due to bugs in the MS C library.</p>
297
 
</dd></dl>
298
 
 
299
 
</div>
300
 
</div>
301
 
<div class="section" id="mac-os-platform">
302
 
<h2>15.15.4. Mac OS Platform<a class="headerlink" href="#mac-os-platform" title="Permalink to this headline">¶</a></h2>
303
 
<dl class="function">
304
 
<dt id="platform.mac_ver">
305
 
<code class="descclassname">platform.</code><code class="descname">mac_ver</code><span class="sig-paren">(</span><em>release=''</em>, <em>versioninfo=(''</em>, <em>''</em>, <em>'')</em>, <em>machine=''</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.mac_ver" title="Permalink to this definition">¶</a></dt>
306
 
<dd><p>Get Mac OS version information and return it as tuple <code class="docutils literal"><span class="pre">(release,</span> <span class="pre">versioninfo,</span>
307
 
<span class="pre">machine)</span></code> with <em>versioninfo</em> being a tuple <code class="docutils literal"><span class="pre">(version,</span> <span class="pre">dev_stage,</span>
308
 
<span class="pre">non_release_version)</span></code>.</p>
309
 
<p>Entries which cannot be determined are set to <code class="docutils literal"><span class="pre">''</span></code>.  All tuple entries are
310
 
strings.</p>
311
 
</dd></dl>
312
 
 
313
 
</div>
314
 
<div class="section" id="unix-platforms">
315
 
<h2>15.15.5. Unix Platforms<a class="headerlink" href="#unix-platforms" title="Permalink to this headline">¶</a></h2>
316
 
<dl class="function">
317
 
<dt id="platform.dist">
318
 
<code class="descclassname">platform.</code><code class="descname">dist</code><span class="sig-paren">(</span><em>distname=''</em>, <em>version=''</em>, <em>id=''</em>, <em>supported_dists=('SuSE'</em>, <em>'debian'</em>, <em>'redhat'</em>, <em>'mandrake'</em>, <em>...)</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.dist" title="Permalink to this definition">¶</a></dt>
319
 
<dd><p>This is an old version of the functionality now provided by
320
 
<a class="reference internal" href="#platform.linux_distribution" title="platform.linux_distribution"><code class="xref py py-func docutils literal"><span class="pre">linux_distribution()</span></code></a>. For new code, please use the
321
 
<a class="reference internal" href="#platform.linux_distribution" title="platform.linux_distribution"><code class="xref py py-func docutils literal"><span class="pre">linux_distribution()</span></code></a>.</p>
322
 
<p>The only difference between the two is that <code class="docutils literal"><span class="pre">dist()</span></code> always
323
 
returns the short name of the distribution taken from the
324
 
<code class="docutils literal"><span class="pre">supported_dists</span></code> parameter.</p>
325
 
<div class="deprecated">
326
 
<p><span class="versionmodified">Deprecated since version 2.6.</span></p>
327
 
</div>
328
 
</dd></dl>
329
 
 
330
 
<dl class="function">
331
 
<dt id="platform.linux_distribution">
332
 
<code class="descclassname">platform.</code><code class="descname">linux_distribution</code><span class="sig-paren">(</span><em>distname=''</em>, <em>version=''</em>, <em>id=''</em>, <em>supported_dists=('SuSE'</em>, <em>'debian'</em>, <em>'redhat'</em>, <em>'mandrake'</em>, <em>...)</em>, <em>full_distribution_name=1</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.linux_distribution" title="Permalink to this definition">¶</a></dt>
333
 
<dd><p>Tries to determine the name of the Linux OS distribution name.</p>
334
 
<p><code class="docutils literal"><span class="pre">supported_dists</span></code> may be given to define the set of Linux distributions to
335
 
look for. It defaults to a list of currently supported Linux distributions
336
 
identified by their release file name.</p>
337
 
<p>If <code class="docutils literal"><span class="pre">full_distribution_name</span></code> is true (default), the full distribution read
338
 
from the OS is returned. Otherwise the short name taken from
339
 
<code class="docutils literal"><span class="pre">supported_dists</span></code> is used.</p>
340
 
<p>Returns a tuple <code class="docutils literal"><span class="pre">(distname,version,id)</span></code> which defaults to the args given as
341
 
parameters.  <code class="docutils literal"><span class="pre">id</span></code> is the item in parentheses after the version number.  It
342
 
is usually the version codename.</p>
343
 
<div class="versionadded">
344
 
<p><span class="versionmodified">New in version 2.6.</span></p>
345
 
</div>
346
 
</dd></dl>
347
 
 
348
 
<dl class="function">
349
 
<dt id="platform.libc_ver">
350
 
<code class="descclassname">platform.</code><code class="descname">libc_ver</code><span class="sig-paren">(</span><em>executable=sys.executable</em>, <em>lib=''</em>, <em>version=''</em>, <em>chunksize=2048</em><span class="sig-paren">)</span><a class="headerlink" href="#platform.libc_ver" title="Permalink to this definition">¶</a></dt>
351
 
<dd><p>Tries to determine the libc version against which the file executable (defaults
352
 
to the Python interpreter) is linked.  Returns a tuple of strings <code class="docutils literal"><span class="pre">(lib,</span>
353
 
<span class="pre">version)</span></code> which default to the given parameters in case the lookup fails.</p>
354
 
<p>Note that this function has intimate knowledge of how different libc versions
355
 
add symbols to the executable is probably only usable for executables compiled
356
 
using <strong class="program">gcc</strong>.</p>
357
 
<p>The file is read and scanned in chunks of <em>chunksize</em> bytes.</p>
358
 
</dd></dl>
359
 
 
360
 
</div>
361
 
</div>
362
 
 
363
 
 
364
 
          </div>
365
 
        </div>
366
 
      </div>
367
 
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
368
 
        <div class="sphinxsidebarwrapper">
369
 
  <h3><a href="../contents.html">Table Of Contents</a></h3>
370
 
  <ul>
371
 
<li><a class="reference internal" href="#">15.15. <code class="docutils literal"><span class="pre">platform</span></code> &#8212;  Access to underlying platform&#8217;s identifying data</a><ul>
372
 
<li><a class="reference internal" href="#cross-platform">15.15.1. Cross Platform</a></li>
373
 
<li><a class="reference internal" href="#java-platform">15.15.2. Java Platform</a></li>
374
 
<li><a class="reference internal" href="#windows-platform">15.15.3. Windows Platform</a><ul>
375
 
<li><a class="reference internal" href="#win95-98-specific">15.15.3.1. Win95/98 specific</a></li>
376
 
</ul>
377
 
</li>
378
 
<li><a class="reference internal" href="#mac-os-platform">15.15.4. Mac OS Platform</a></li>
379
 
<li><a class="reference internal" href="#unix-platforms">15.15.5. Unix Platforms</a></li>
380
 
</ul>
381
 
</li>
382
 
</ul>
383
 
 
384
 
  <h4>Previous topic</h4>
385
 
  <p class="topless"><a href="curses.panel.html"
386
 
                        title="previous chapter">15.14. <code class="docutils literal"><span class="pre">curses.panel</span></code> &#8212; A panel stack extension for curses</a></p>
387
 
  <h4>Next topic</h4>
388
 
  <p class="topless"><a href="errno.html"
389
 
                        title="next chapter">15.16. <code class="docutils literal"><span class="pre">errno</span></code> &#8212; Standard errno system symbols</a></p>
390
 
<h3>This Page</h3>
391
 
<ul class="this-page-menu">
392
 
  <li><a href="../bugs.html">Report a Bug</a></li>
393
 
  <li><a href="../_sources/library/platform.txt"
394
 
         rel="nofollow">Show Source</a></li>
395
 
</ul>
396
 
 
397
 
<div id="searchbox" style="display: none" role="search">
398
 
  <h3>Quick search</h3>
399
 
    <form class="search" action="../search.html" method="get">
400
 
      <input type="text" name="q" />
401
 
      <input type="submit" value="Go" />
402
 
      <input type="hidden" name="check_keywords" value="yes" />
403
 
      <input type="hidden" name="area" value="default" />
404
 
    </form>
405
 
    <p class="searchtip" style="font-size: 90%">
406
 
    Enter search terms or a module, class or function name.
407
 
    </p>
408
 
</div>
409
 
<script type="text/javascript">$('#searchbox').show(0);</script>
410
 
        </div>
411
 
      </div>
412
 
      <div class="clearer"></div>
413
 
    </div>  
414
 
    <div class="related" role="navigation" aria-label="related navigation">
415
 
      <h3>Navigation</h3>
416
 
      <ul>
417
 
        <li class="right" style="margin-right: 10px">
418
 
          <a href="../genindex.html" title="General Index"
419
 
             >index</a></li>
420
 
        <li class="right" >
421
 
          <a href="../py-modindex.html" title="Python Module Index"
422
 
             >modules</a> |</li>
423
 
        <li class="right" >
424
 
          <a href="errno.html" title="15.16. errno — Standard errno system symbols"
425
 
             >next</a> |</li>
426
 
        <li class="right" >
427
 
          <a href="curses.panel.html" title="15.14. curses.panel — A panel stack extension for curses"
428
 
             >previous</a> |</li>
429
 
        <li><img src="../_static/py.png" alt=""
430
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
431
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
432
 
        <li>
433
 
          <span class="version_switcher_placeholder">2.7.11</span>
434
 
          <a href="../index.html">Documentation</a> &raquo;
435
 
        </li>
436
 
 
437
 
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
438
 
          <li class="nav-item nav-item-2"><a href="allos.html" >15. Generic Operating System Services</a> &raquo;</li> 
439
 
      </ul>
440
 
    </div>  
441
 
    <div class="footer">
442
 
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
443
 
    <br />
444
 
    The Python Software Foundation is a non-profit corporation.
445
 
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
446
 
    <br />
447
 
    Last updated on Jan 23, 2016.
448
 
    <a href="../bugs.html">Found a bug</a>?
449
 
    <br />
450
 
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
451
 
    </div>
452
 
 
453
 
  </body>
454
 
</html>
 
 
b'\\ No newline at end of file'