Merged revisions 73286,73294,73296,73459,73462-73463,73544,73576-73577,73595-73596,73693-73694,73704-73705,73707,73713,73937-73940,73945,73951,73979 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73286 | georg.brandl | 2009-06-08 09:57:35 +0200 (Mo, 08 Jun 2009) | 1 line
Remove period from end of headings.
........
r73294 | georg.brandl | 2009-06-08 15:34:52 +0200 (Mo, 08 Jun 2009) | 1 line
#6194: O_SHLOCK/O_EXLOCK are not really more platform independent than lockf().
........
r73296 | georg.brandl | 2009-06-08 18:03:41 +0200 (Mo, 08 Jun 2009) | 1 line
#6238: add fillchar to string.just function family.
........
r73459 | raymond.hettinger | 2009-06-17 03:43:47 +0200 (Mi, 17 Jun 2009) | 1 line
Add usage note.
........
r73462 | georg.brandl | 2009-06-17 11:36:21 +0200 (Mi, 17 Jun 2009) | 1 line
#6295: clarify blocking behavior of getch().
........
r73463 | georg.brandl | 2009-06-17 11:43:31 +0200 (Mi, 17 Jun 2009) | 1 line
#6255: document PyInt_FromSize_t.
........
r73544 | georg.brandl | 2009-06-24 08:41:19 +0200 (Mi, 24 Jun 2009) | 1 line
#6332: fix word dupes throughout the source.
........
r73576 | benjamin.peterson | 2009-06-27 01:37:06 +0200 (Sa, 27 Jun 2009) | 1 line
document is_declared_global()
........
r73577 | benjamin.peterson | 2009-06-27 16:16:23 +0200 (Sa, 27 Jun 2009) | 1 line
link to extensive generator docs in the reference manual
........
r73595 | ezio.melotti | 2009-06-28 01:45:39 +0200 (So, 28 Jun 2009) | 1 line
stmt and setup can contain multiple statements, see #5896
........
r73596 | ezio.melotti | 2009-06-28 02:07:45 +0200 (So, 28 Jun 2009) | 1 line
Fixed a wrong apostrophe
........
r73693 | jesse.noller | 2009-06-29 20:20:34 +0200 (Mo, 29 Jun 2009) | 1 line
Bug 5906: add a documentation note for unix daemons vs. multiprocessing daemons
........
r73694 | jesse.noller | 2009-06-29 20:24:26 +0200 (Mo, 29 Jun 2009) | 1 line
Issue 5740: multiprocessing.connection.* authkey fixes
........
r73704 | georg.brandl | 2009-06-30 18:15:43 +0200 (Di, 30 Jun 2009) | 1 line
#6376: fix copy-n-paste oversight.
........
r73705 | georg.brandl | 2009-06-30 18:17:28 +0200 (Di, 30 Jun 2009) | 1 line
#6374: add a bit of explanation about shell=True on Windows.
........
r73707 | georg.brandl | 2009-06-30 18:35:11 +0200 (Di, 30 Jun 2009) | 1 line
#6371: fix link targets.
........
r73713 | ezio.melotti | 2009-07-01 00:56:16 +0200 (Mi, 01 Jul 2009) | 1 line
Fixed a backslash that was not supposed to be there
........
r73937 | georg.brandl | 2009-07-11 12:12:36 +0200 (Sa, 11 Jul 2009) | 1 line
Fix style.
........
r73938 | georg.brandl | 2009-07-11 12:14:54 +0200 (Sa, 11 Jul 2009) | 1 line
#6446: fix import_spam() function to use correct error and reference handling.
........
r73939 | georg.brandl | 2009-07-11 12:18:10 +0200 (Sa, 11 Jul 2009) | 1 line
#6448: clarify docs for find_module().
........
r73940 | georg.brandl | 2009-07-11 12:37:38 +0200 (Sa, 11 Jul 2009) | 1 line
#6430: add note about size of "u" type.
........
r73945 | georg.brandl | 2009-07-11 12:51:31 +0200 (Sa, 11 Jul 2009) | 1 line
#6456: clarify the meaning of constants used as arguments to nl_langinfo().
........
r73951 | georg.brandl | 2009-07-11 16:23:38 +0200 (Sa, 11 Jul 2009) | 2 lines
array.array is actually a class.
........
r73979 | benjamin.peterson | 2009-07-12 18:56:54 +0200 (So, 12 Jul 2009) | 1 line
add versionadded
........
2009-10-27 11:29:22 -03:00
|
|
|
:mod:`platform` --- Access to underlying platform's identifying data
|
|
|
|
=====================================================================
|
2007-08-15 11:28:01 -03:00
|
|
|
|
|
|
|
.. module:: platform
|
|
|
|
:synopsis: Retrieves as much platform identifying data as possible.
|
|
|
|
.. moduleauthor:: Marc-Andre Lemburg <mal@egenix.com>
|
|
|
|
.. sectionauthor:: Bjorn Pettersen <bpettersen@corp.fairisaac.com>
|
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.3
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Specific platforms listed alphabetically, with Linux included in the Unix
|
|
|
|
section.
|
|
|
|
|
|
|
|
|
|
|
|
Cross Platform
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: architecture(executable=sys.executable, bits='', linkage='')
|
|
|
|
|
|
|
|
Queries the given executable (defaults to the Python interpreter binary) for
|
|
|
|
various architecture information.
|
|
|
|
|
|
|
|
Returns a tuple ``(bits, linkage)`` which contain information about the bit
|
|
|
|
architecture and the linkage format used for the executable. Both values are
|
|
|
|
returned as strings.
|
|
|
|
|
|
|
|
Values that cannot be determined are returned as given by the parameter presets.
|
|
|
|
If bits is given as ``''``, the :cfunc:`sizeof(pointer)` (or
|
|
|
|
:cfunc:`sizeof(long)` on Python version < 1.5.2) is used as indicator for the
|
|
|
|
supported pointer size.
|
|
|
|
|
|
|
|
The function relies on the system's :file:`file` command to do the actual work.
|
|
|
|
This is available on most if not all Unix platforms and some non-Unix platforms
|
|
|
|
and then only if the executable points to the Python interpreter. Reasonable
|
|
|
|
defaults are used when the above needs are not met.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: machine()
|
|
|
|
|
|
|
|
Returns the machine type, e.g. ``'i386'``. An empty string is returned if the
|
|
|
|
value cannot be determined.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: node()
|
|
|
|
|
|
|
|
Returns the computer's network name (may not be fully qualified!). An empty
|
|
|
|
string is returned if the value cannot be determined.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: platform(aliased=0, terse=0)
|
|
|
|
|
|
|
|
Returns a single string identifying the underlying platform with as much useful
|
|
|
|
information as possible.
|
|
|
|
|
|
|
|
The output is intended to be *human readable* rather than machine parseable. It
|
|
|
|
may look different on different platforms and this is intended.
|
|
|
|
|
|
|
|
If *aliased* is true, the function will use aliases for various platforms that
|
|
|
|
report system names which differ from their common names, for example SunOS will
|
|
|
|
be reported as Solaris. The :func:`system_alias` function is used to implement
|
|
|
|
this.
|
|
|
|
|
|
|
|
Setting *terse* to true causes the function to return only the absolute minimum
|
|
|
|
information needed to identify the platform.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: processor()
|
|
|
|
|
|
|
|
Returns the (real) processor name, e.g. ``'amdk6'``.
|
|
|
|
|
|
|
|
An empty string is returned if the value cannot be determined. Note that many
|
|
|
|
platforms do not provide this information or simply return the same value as for
|
|
|
|
:func:`machine`. NetBSD does this.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_build()
|
|
|
|
|
|
|
|
Returns a tuple ``(buildno, builddate)`` stating the Python build number and
|
|
|
|
date as strings.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_compiler()
|
|
|
|
|
|
|
|
Returns a string identifying the compiler used for compiling Python.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_branch()
|
|
|
|
|
|
|
|
Returns a string identifying the Python implementation SCM branch.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_implementation()
|
|
|
|
|
|
|
|
Returns a string identifying the Python implementation. Possible return values
|
|
|
|
are: 'CPython', 'IronPython', 'Jython'
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_revision()
|
|
|
|
|
|
|
|
Returns a string identifying the Python implementation SCM revision.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_version()
|
|
|
|
|
|
|
|
Returns the Python version as string ``'major.minor.patchlevel'``
|
|
|
|
|
|
|
|
Note that unlike the Python ``sys.version``, the returned value will always
|
|
|
|
include the patchlevel (it defaults to 0).
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: python_version_tuple()
|
|
|
|
|
|
|
|
Returns the Python version as tuple ``(major, minor, patchlevel)`` of strings.
|
|
|
|
|
|
|
|
Note that unlike the Python ``sys.version``, the returned value will always
|
|
|
|
include the patchlevel (it defaults to ``'0'``).
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: release()
|
|
|
|
|
|
|
|
Returns the system's release, e.g. ``'2.2.0'`` or ``'NT'`` An empty string is
|
|
|
|
returned if the value cannot be determined.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: system()
|
|
|
|
|
|
|
|
Returns the system/OS name, e.g. ``'Linux'``, ``'Windows'``, or ``'Java'``. An
|
|
|
|
empty string is returned if the value cannot be determined.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: system_alias(system, release, version)
|
|
|
|
|
|
|
|
Returns ``(system, release, version)`` aliased to common marketing names used
|
|
|
|
for some systems. It also does some reordering of the information in some cases
|
|
|
|
where it would otherwise cause confusion.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: version()
|
|
|
|
|
|
|
|
Returns the system's release version, e.g. ``'#3 on degas'``. An empty string is
|
|
|
|
returned if the value cannot be determined.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: uname()
|
|
|
|
|
|
|
|
Fairly portable uname interface. Returns a tuple of strings ``(system, node,
|
|
|
|
release, version, machine, processor)`` identifying the underlying platform.
|
|
|
|
|
|
|
|
Note that unlike the :func:`os.uname` function this also returns possible
|
|
|
|
processor information as additional tuple entry.
|
|
|
|
|
|
|
|
Entries which cannot be determined are set to ``''``.
|
|
|
|
|
|
|
|
|
|
|
|
Java Platform
|
|
|
|
-------------
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','',''))
|
|
|
|
|
Merged revisions 72558,72745,72750,72876,73042,73045-73048,73069,73089,73163,73186,73213,73215,73217,73257-73258,73260 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72558 | benjamin.peterson | 2009-05-11 01:52:09 +0200 (Mo, 11 Mai 2009) | 1 line
sys.setdefaultencoding() strikes me as a bad example
........
r72745 | benjamin.peterson | 2009-05-17 16:16:29 +0200 (So, 17 Mai 2009) | 1 line
ignore .rst files in sphinx its self
........
r72750 | benjamin.peterson | 2009-05-17 18:59:27 +0200 (So, 17 Mai 2009) | 1 line
chop off slash
........
r72876 | benjamin.peterson | 2009-05-23 22:59:09 +0200 (Sa, 23 Mai 2009) | 1 line
remove mention of old ctypes version
........
r73042 | benjamin.peterson | 2009-05-30 05:10:52 +0200 (Sa, 30 Mai 2009) | 1 line
no fdatasync on macos
........
r73045 | georg.brandl | 2009-05-30 09:26:04 +0200 (Sa, 30 Mai 2009) | 1 line
#6146: fix markup bug.
........
r73046 | georg.brandl | 2009-05-30 09:31:25 +0200 (Sa, 30 Mai 2009) | 1 line
Use preferred form of raising exceptions.
........
r73047 | georg.brandl | 2009-05-30 12:33:23 +0200 (Sa, 30 Mai 2009) | 1 line
Fix some more small markup problems.
........
r73048 | georg.brandl | 2009-05-30 12:34:25 +0200 (Sa, 30 Mai 2009) | 1 line
Fix markup problem.
........
r73069 | benjamin.peterson | 2009-05-31 02:42:42 +0200 (So, 31 Mai 2009) | 1 line
fix signature
........
r73089 | andrew.kuchling | 2009-06-01 02:14:19 +0200 (Mo, 01 Jun 2009) | 1 line
The class for regexes isn't called RegexObject any more; correct the text
........
r73163 | georg.brandl | 2009-06-03 09:25:35 +0200 (Mi, 03 Jun 2009) | 1 line
Use the preferred form of raise statements in the docs.
........
r73186 | georg.brandl | 2009-06-03 23:21:09 +0200 (Mi, 03 Jun 2009) | 1 line
#6174: fix indentation in code example.
........
r73213 | georg.brandl | 2009-06-04 12:15:57 +0200 (Do, 04 Jun 2009) | 1 line
#5967: note that the C slicing APIs do not support negative indices.
........
r73215 | georg.brandl | 2009-06-04 12:22:31 +0200 (Do, 04 Jun 2009) | 1 line
#6176: fix man page section for flock(2).
........
r73217 | georg.brandl | 2009-06-04 12:27:21 +0200 (Do, 04 Jun 2009) | 1 line
#6175: document that inet_aton supports alternate input formats with less than three dots.
........
r73257 | georg.brandl | 2009-06-06 19:50:05 +0200 (Sa, 06 Jun 2009) | 1 line
#6211: elaborate a bit on ways to call the function.
........
r73258 | georg.brandl | 2009-06-06 19:51:31 +0200 (Sa, 06 Jun 2009) | 1 line
#6204: use a real reference instead of "see later".
........
r73260 | georg.brandl | 2009-06-06 20:21:58 +0200 (Sa, 06 Jun 2009) | 1 line
#6224: s/JPython/Jython/, and remove one link to a module nine years old.
........
2009-10-27 11:19:50 -03:00
|
|
|
Version interface for Jython.
|
2007-08-15 11:28:01 -03:00
|
|
|
|
|
|
|
Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
|
|
|
|
tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple
|
|
|
|
``(os_name, os_version, os_arch)``. Values which cannot be determined are set to
|
|
|
|
the defaults given as parameters (which all default to ``''``).
|
|
|
|
|
|
|
|
|
|
|
|
Windows Platform
|
|
|
|
----------------
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: win32_ver(release='', version='', csd='', ptype='')
|
|
|
|
|
|
|
|
Get additional version information from the Windows Registry and return a tuple
|
|
|
|
``(version, csd, ptype)`` referring to version number, CSD level and OS type
|
|
|
|
(multi/single processor).
|
|
|
|
|
|
|
|
As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT machines
|
|
|
|
and ``'Multiprocessor Free'`` on multi processor machines. The *'Free'* refers
|
|
|
|
to the OS version being free of debugging code. It could also state *'Checked'*
|
|
|
|
which means the OS version uses debugging code, i.e. code that checks arguments,
|
|
|
|
ranges, etc.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2008-03-20 14:55:31 -03:00
|
|
|
Note: this function works best with Mark Hammond's
|
|
|
|
:mod:`win32all` package installed, but also on Python 2.3 and
|
2008-03-20 15:58:14 -03:00
|
|
|
later (support for this was added in Python 2.6). It obviously
|
|
|
|
only runs on Win32 compatible platforms.
|
2007-08-15 11:28:01 -03:00
|
|
|
|
|
|
|
|
|
|
|
Win95/98 specific
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
.. function:: popen(cmd, mode='r', bufsize=None)
|
|
|
|
|
|
|
|
Portable :func:`popen` interface. Find a working popen implementation
|
|
|
|
preferring :func:`win32pipe.popen`. On Windows NT, :func:`win32pipe.popen`
|
|
|
|
should work; on Windows 9x it hangs due to bugs in the MS C library.
|
|
|
|
|
|
|
|
|
|
|
|
Mac OS Platform
|
|
|
|
---------------
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: mac_ver(release='', versioninfo=('','',''), machine='')
|
|
|
|
|
|
|
|
Get Mac OS version information and return it as tuple ``(release, versioninfo,
|
|
|
|
machine)`` with *versioninfo* being a tuple ``(version, dev_stage,
|
|
|
|
non_release_version)``.
|
|
|
|
|
|
|
|
Entries which cannot be determined are set to ``''``. All tuple entries are
|
|
|
|
strings.
|
|
|
|
|
|
|
|
Documentation for the underlying :cfunc:`gestalt` API is available online at
|
|
|
|
http://www.rgaros.nl/gestalt/.
|
|
|
|
|
|
|
|
|
|
|
|
Unix Platforms
|
|
|
|
--------------
|
|
|
|
|
|
|
|
|
2008-03-20 14:55:31 -03:00
|
|
|
.. function:: dist(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...))
|
2007-08-15 11:28:01 -03:00
|
|
|
|
Merged revisions 69520,69633,69672,69703-69704,69717,69731 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69520 | benjamin.peterson | 2009-02-12 04:50:00 +0100 (Do, 12 Feb 2009) | 1 line
os.fsync() should be used to ensure that data is written to disk
........
r69633 | hirokazu.yamamoto | 2009-02-15 10:19:48 +0100 (So, 15 Feb 2009) | 1 line
Fixed typo.
........
r69672 | benjamin.peterson | 2009-02-16 15:54:34 +0100 (Mo, 16 Feb 2009) | 1 line
note functions that are not aliased to PyBytes_ #5280
........
r69703 | raymond.hettinger | 2009-02-16 23:42:54 +0100 (Mo, 16 Feb 2009) | 3 lines
Issue 5229: Documentation for super() neglects to say what super() actually does
........
r69704 | raymond.hettinger | 2009-02-17 00:00:25 +0100 (Di, 17 Feb 2009) | 1 line
Add explanation for super(type1, type2).
........
r69717 | marc-andre.lemburg | 2009-02-17 13:48:19 +0100 (Di, 17 Feb 2009) | 5 lines
Clarify the deprecation of platform.dist().
Add versionadded tags.
........
r69731 | gregory.p.smith | 2009-02-18 06:46:11 +0100 (Mi, 18 Feb 2009) | 3 lines
Clarify socket timeout behavior vs system network stack behavior on connect
for issue5293.
........
2009-10-27 10:38:33 -03:00
|
|
|
This is an old version of the functionality now provided by
|
|
|
|
:func:`linux_distribution`. For new code, please use the
|
|
|
|
:func:`linux_distribution`.
|
|
|
|
|
|
|
|
The only difference between the two is that ``dist()`` always
|
|
|
|
returns the short name of the distribution taken from the
|
|
|
|
``supported_dists`` parameter.
|
|
|
|
|
|
|
|
.. deprecated:: 2.6
|
2007-08-15 11:28:01 -03:00
|
|
|
|
2008-03-20 14:55:31 -03:00
|
|
|
.. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1)
|
|
|
|
|
|
|
|
Tries to determine the name of the Linux OS distribution name.
|
|
|
|
|
2008-09-22 19:13:29 -03:00
|
|
|
``supported_dists`` may be given to define the set of Linux distributions to
|
|
|
|
look for. It defaults to a list of currently supported Linux distributions
|
|
|
|
identified by their release file name.
|
2008-03-20 14:55:31 -03:00
|
|
|
|
2008-09-22 19:13:29 -03:00
|
|
|
If ``full_distribution_name`` is true (default), the full distribution read
|
|
|
|
from the OS is returned. Otherwise the short name taken from
|
|
|
|
``supported_dists`` is used.
|
2008-03-20 14:55:31 -03:00
|
|
|
|
2008-09-22 19:13:29 -03:00
|
|
|
Returns a tuple ``(distname,version,id)`` which defaults to the args given as
|
|
|
|
parameters. ``id`` is the item in parentheses after the version number. It
|
|
|
|
is usually the version codename.
|
2007-08-15 11:28:01 -03:00
|
|
|
|
Merged revisions 69520,69633,69672,69703-69704,69717,69731 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69520 | benjamin.peterson | 2009-02-12 04:50:00 +0100 (Do, 12 Feb 2009) | 1 line
os.fsync() should be used to ensure that data is written to disk
........
r69633 | hirokazu.yamamoto | 2009-02-15 10:19:48 +0100 (So, 15 Feb 2009) | 1 line
Fixed typo.
........
r69672 | benjamin.peterson | 2009-02-16 15:54:34 +0100 (Mo, 16 Feb 2009) | 1 line
note functions that are not aliased to PyBytes_ #5280
........
r69703 | raymond.hettinger | 2009-02-16 23:42:54 +0100 (Mo, 16 Feb 2009) | 3 lines
Issue 5229: Documentation for super() neglects to say what super() actually does
........
r69704 | raymond.hettinger | 2009-02-17 00:00:25 +0100 (Di, 17 Feb 2009) | 1 line
Add explanation for super(type1, type2).
........
r69717 | marc-andre.lemburg | 2009-02-17 13:48:19 +0100 (Di, 17 Feb 2009) | 5 lines
Clarify the deprecation of platform.dist().
Add versionadded tags.
........
r69731 | gregory.p.smith | 2009-02-18 06:46:11 +0100 (Mi, 18 Feb 2009) | 3 lines
Clarify socket timeout behavior vs system network stack behavior on connect
for issue5293.
........
2009-10-27 10:38:33 -03:00
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
2007-08-15 11:28:01 -03:00
|
|
|
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048)
|
|
|
|
|
|
|
|
Tries to determine the libc version against which the file executable (defaults
|
|
|
|
to the Python interpreter) is linked. Returns a tuple of strings ``(lib,
|
|
|
|
version)`` which default to the given parameters in case the lookup fails.
|
|
|
|
|
|
|
|
Note that this function has intimate knowledge of how different libc versions
|
2008-02-22 08:31:45 -04:00
|
|
|
add symbols to the executable is probably only usable for executables compiled
|
2007-08-15 11:28:01 -03:00
|
|
|
using :program:`gcc`.
|
|
|
|
|
|
|
|
The file is read and scanned in chunks of *chunksize* bytes.
|
|
|
|
|