diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-08-21 10:08:11 (GMT) | 
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-08-21 10:08:11 (GMT) | 
| commit | 795eaeb41f358d3eb14731c04fb2bd9c1da83aa4 (patch) | |
| tree | 4586213c732f05aa3ed57a7c2a85c6c370a68973 | |
| parent | e67474725b5b13b48ba0007e89314214a6bdca0b (diff) | |
| download | cpython-795eaeb41f358d3eb14731c04fb2bd9c1da83aa4.zip cpython-795eaeb41f358d3eb14731c04fb2bd9c1da83aa4.tar.gz cpython-795eaeb41f358d3eb14731c04fb2bd9c1da83aa4.tar.bz2 | |
Issue #12326: update sys.platform doc for Linux
| -rw-r--r-- | Doc/library/sys.rst | 19 | 
1 files changed, 12 insertions, 7 deletions
| diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 517ba63..d2986e4 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -702,20 +702,21 @@ always available.     This string contains a platform identifier that can be used to append     platform-specific components to :data:`sys.path`, for instance. -   For Unix systems, this is the lowercased OS name as returned by ``uname -s`` -   with the first part of the version as returned by ``uname -r`` appended, -   e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*. -   Unless you want to test for a specific system version, it is therefore -   recommended to use the following idiom:: +   For Unix systems, except on Linux, this is the lowercased OS name as +   returned by ``uname -s`` with the first part of the version as returned by +   ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time +   when Python was built*.  Unless you want to test for a specific system +   version, it is therefore recommended to use the following idiom:: -      if sys.platform.startswith('linux'): -          # Linux-specific code here... +      if sys.platform.startswith('freebsd'): +          # FreeBSD-specific code here...     For other systems, the values are:     ================ ===========================     System           :data:`platform` value     ================ =========================== +   Linux            ``'linux'``     Windows          ``'win32'``     Windows/Cygwin   ``'cygwin'``     Mac OS X         ``'darwin'`` @@ -723,6 +724,10 @@ always available.     OS/2 EMX         ``'os2emx'``     ================ =========================== +   .. versionchanged:: 3.3 +      On Linux, :attr:`sys.platform` doesn't contain the major version anymore. +      It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. +     .. seealso::        :attr:`os.name` has a coarser granularity.  :func:`os.uname` gives        system-dependent version information. | 
