| 1 | \section{\module{platform} ---
|
|---|
| 2 | Access to underlying platform's identifying data.}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{standard}{platform}
|
|---|
| 5 | \modulesynopsis{Retrieves as much platform identifying data as possible.}
|
|---|
| 6 | \moduleauthor{Marc-Andre Lemburg}{[email protected]}
|
|---|
| 7 | \sectionauthor{Bjorn Pettersen}{[email protected]}
|
|---|
| 8 |
|
|---|
| 9 | \versionadded{2.3}
|
|---|
| 10 |
|
|---|
| 11 | \begin{notice}
|
|---|
| 12 | Specific platforms listed alphabetically, with Linux included in the
|
|---|
| 13 | \UNIX{} section.
|
|---|
| 14 | \end{notice}
|
|---|
| 15 |
|
|---|
| 16 | \subsection{Cross Platform}
|
|---|
| 17 |
|
|---|
| 18 | \begin{funcdesc}{architecture}{executable=sys.executable, bits='', linkage=''}
|
|---|
| 19 | Queries the given executable (defaults to the Python interpreter
|
|---|
| 20 | binary) for various architecture information.
|
|---|
| 21 |
|
|---|
| 22 | Returns a tuple \code{(bits, linkage)} which contain information about
|
|---|
| 23 | the bit architecture and the linkage format used for the
|
|---|
| 24 | executable. Both values are returned as strings.
|
|---|
| 25 |
|
|---|
| 26 | Values that cannot be determined are returned as given by the
|
|---|
| 27 | parameter presets. If bits is given as \code{''}, the
|
|---|
| 28 | \cfunction{sizeof(pointer)}
|
|---|
| 29 | (or \cfunction{sizeof(long)} on Python version < 1.5.2) is used as
|
|---|
| 30 | indicator for the supported pointer size.
|
|---|
| 31 |
|
|---|
| 32 | The function relies on the system's \file{file} command to do the
|
|---|
| 33 | actual work. This is available on most if not all \UNIX{}
|
|---|
| 34 | platforms and some non-\UNIX{} platforms and then only if the
|
|---|
| 35 | executable points to the Python interpreter. Reasonable defaults
|
|---|
| 36 | are used when the above needs are not met.
|
|---|
| 37 | \end{funcdesc}
|
|---|
| 38 |
|
|---|
| 39 | \begin{funcdesc}{machine}{}
|
|---|
| 40 | Returns the machine type, e.g. \code{'i386'}.
|
|---|
| 41 | An empty string is returned if the value cannot be determined.
|
|---|
| 42 | \end{funcdesc}
|
|---|
| 43 |
|
|---|
| 44 | \begin{funcdesc}{node}{}
|
|---|
| 45 | Returns the computer's network name (may not be fully qualified!).
|
|---|
| 46 | An empty string is returned if the value cannot be determined.
|
|---|
| 47 | \end{funcdesc}
|
|---|
| 48 |
|
|---|
| 49 | \begin{funcdesc}{platform}{aliased=0, terse=0}
|
|---|
| 50 | Returns a single string identifying the underlying platform
|
|---|
| 51 | with as much useful information as possible.
|
|---|
| 52 |
|
|---|
| 53 | The output is intended to be \emph{human readable} rather than
|
|---|
| 54 | machine parseable. It may look different on different platforms and
|
|---|
| 55 | this is intended.
|
|---|
| 56 |
|
|---|
| 57 | If \var{aliased} is true, the function will use aliases for various
|
|---|
| 58 | platforms that report system names which differ from their common
|
|---|
| 59 | names, for example SunOS will be reported as Solaris. The
|
|---|
| 60 | \function{system_alias()} function is used to implement this.
|
|---|
| 61 |
|
|---|
| 62 | Setting \var{terse} to true causes the function to return only the
|
|---|
| 63 | absolute minimum information needed to identify the platform.
|
|---|
| 64 | \end{funcdesc}
|
|---|
| 65 |
|
|---|
| 66 | \begin{funcdesc}{processor}{}
|
|---|
| 67 | Returns the (real) processor name, e.g. \code{'amdk6'}.
|
|---|
| 68 |
|
|---|
| 69 | An empty string is returned if the value cannot be determined. Note
|
|---|
| 70 | that many platforms do not provide this information or simply return
|
|---|
| 71 | the same value as for \function{machine()}. NetBSD does this.
|
|---|
| 72 | \end{funcdesc}
|
|---|
| 73 |
|
|---|
| 74 | \begin{funcdesc}{python_build}{}
|
|---|
| 75 | Returns a tuple \code{(\var{buildno}, \var{builddate})} stating the
|
|---|
| 76 | Python build number and date as strings.
|
|---|
| 77 | \end{funcdesc}
|
|---|
| 78 |
|
|---|
| 79 | \begin{funcdesc}{python_compiler}{}
|
|---|
| 80 | Returns a string identifying the compiler used for compiling Python.
|
|---|
| 81 | \end{funcdesc}
|
|---|
| 82 |
|
|---|
| 83 | \begin{funcdesc}{python_version}{}
|
|---|
| 84 | Returns the Python version as string \code{'major.minor.patchlevel'}
|
|---|
| 85 |
|
|---|
| 86 | Note that unlike the Python \code{sys.version}, the returned value
|
|---|
|
|---|