mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 02:15:10 +00:00 
			
		
		
		
	 628e6f908e
			
		
	
	
		628e6f908e
		
	
	
	
	
		
			
			svn+ssh://svn.python.org/python/branches/py3k
................
  r75797 | georg.brandl | 2009-10-27 16:28:25 +0100 (Di, 27 Okt 2009) | 129 lines
  Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk
  ........
    r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
    Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
  ........
    r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
    Fix markup.
  ........
    r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
    #7125: fix typo.
  ........
    r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
    #7126: os.environ changes *do* take effect in subprocesses started with os.system().
  ........
    r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
    #7116: str.join() takes an iterable.
  ........
    r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
    Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
  ........
    r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
    Fix missing word.
  ........
    r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
    Fix punctuation.
  ........
    r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
    Revert unintended change.
  ........
    r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
    Fix markup.
  ........
    r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
    Fix duplicate target.
  ........
    r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
    Add a new directive marking up implementation details and start using it.
  ........
    r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
    Make it more robust.
  ........
    r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
    Document new directive.
  ........
    r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
    Allow short form with text as argument.
  ........
    r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
    Fix stylesheet for multi-paragraph impl-details.
  ........
    r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
    Use "impl-detail" directive where applicable.
  ........
    r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
    #6324: membership test tries iteration via __iter__.
  ........
    r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
    #7088: document new functions in signal as Unix-only.
  ........
    r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
    Reorder __slots__ fine print and add a clarification.
  ........
    r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
    #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
  ........
    r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
    #7156: document curses as Unix-only.
  ........
    r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
    #6977: getopt does not support optional option arguments.
  ........
    r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
    Add proper references.
  ........
    r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
    Make printout margin important.
  ........
    r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
    #7188: fix optionxform() docs.
  ........
    r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
    add further note about what's passed to optionxform
  ........
    r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
    Improve some docstrings in the 'warnings' module.
  ........
    r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
    Fix markup.
  ........
    r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
    Fix a demo.
  ........
    r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
    Fix a strange mis-edit.
  ........
................
		
	
			
		
			
				
	
	
		
			257 lines
		
	
	
	
		
			8.5 KiB
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
			
		
		
	
	
			257 lines
		
	
	
	
		
			8.5 KiB
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
| :mod:`platform` ---  Access to underlying platform's identifying data
 | |
| =====================================================================
 | |
| 
 | |
| .. 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>
 | |
| 
 | |
| 
 | |
| .. 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.
 | |
| 
 | |
| 
 | |
| .. function:: python_implementation()
 | |
| 
 | |
|    Returns a string identifying the Python implementation. Possible return values
 | |
|    are: 'CPython', 'IronPython', 'Jython'.
 | |
| 
 | |
| 
 | |
| .. function:: python_revision()
 | |
| 
 | |
|    Returns a string identifying the Python implementation SCM revision.
 | |
| 
 | |
| 
 | |
| .. 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=('','',''))
 | |
| 
 | |
|    Version interface for Jython.
 | |
| 
 | |
|    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::
 | |
| 
 | |
|       Note: this function works best with Mark Hammond's
 | |
|       :mod:`win32all` package installed, but also on Python 2.3 and
 | |
|       later (support for this was added in Python 2.6). It obviously
 | |
|       only runs on Win32 compatible platforms.
 | |
| 
 | |
| 
 | |
| 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
 | |
| --------------
 | |
| 
 | |
| 
 | |
| .. function:: dist(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...))
 | |
| 
 | |
|    This is another name for :func:`linux_distribution`.
 | |
| 
 | |
| .. 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.
 | |
| 
 | |
|    ``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.
 | |
| 
 | |
|    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.
 | |
| 
 | |
|    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.
 | |
| 
 | |
| .. 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
 | |
|    add symbols to the executable is probably only usable for executables compiled
 | |
|    using :program:`gcc`.
 | |
| 
 | |
|    The file is read and scanned in chunks of *chunksize* bytes.
 | |
| 
 |