~ubuntu-branches/ubuntu/raring/python3.2/raring

« back to all changes in this revision

Viewing changes to Doc/library/sys.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-09-05 22:01:13 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: package-import@ubuntu.com-20110905220113-gmku3knwah89ojat
Tags: 3.2.2-0ubuntu1
* Python 3.2.2 release.
* Search headers in /usr/include/ncursesw for the curses/panel extensions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
699
699
   This string contains a platform identifier that can be used to append
700
700
   platform-specific components to :data:`sys.path`, for instance.
701
701
 
702
 
   For Unix systems, this is the lowercased OS name as returned by ``uname -s``
703
 
   with the first part of the version as returned by ``uname -r`` appended,
704
 
   e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*.
705
 
   Unless you want to test for a specific system version, it is therefore
706
 
   recommended to use the following idiom::
 
702
   For most Unix systems, this is the lowercased OS name as returned by ``uname
 
703
   -s`` with the first part of the version as returned by ``uname -r`` appended,
 
704
   e.g. ``'sunos5'``, *at the time when Python was built*.  Unless you want to
 
705
   test for a specific system version, it is therefore recommended to use the
 
706
   following idiom::
707
707
 
708
 
      if sys.platform.startswith('linux'):
 
708
      if sys.platform.startswith('freebsd'):
 
709
          # FreeBSD-specific code here...
 
710
      elif sys.platform.startswith('linux'):
709
711
          # Linux-specific code here...
710
712
 
 
713
   .. versionchanged:: 3.2.2
 
714
      Since lots of code check for ``sys.platform == 'linux2'``, and there is
 
715
      no essential change between Linux 2.x and 3.x, ``sys.platform`` is always
 
716
      set to ``'linux2'``, even on Linux 3.x.  In Python 3.3 and later, the
 
717
      value will always be set to ``'linux'``, so it is recommended to always
 
718
      use the ``startswith`` idiom presented above.
 
719
 
711
720
   For other systems, the values are:
712
721
 
713
 
   ================ ===========================
714
 
   System           :data:`platform` value
715
 
   ================ ===========================
716
 
   Windows          ``'win32'``
717
 
   Windows/Cygwin   ``'cygwin'``
718
 
   Mac OS X         ``'darwin'``
719
 
   OS/2             ``'os2'``
720
 
   OS/2 EMX         ``'os2emx'``
721
 
   ================ ===========================
 
722
   ====================== ===========================
 
723
   System                 :data:`platform` value
 
724
   ====================== ===========================
 
725
   Linux (2.x *and* 3.x)  ``'linux2'``
 
726
   Windows                ``'win32'``
 
727
   Windows/Cygwin         ``'cygwin'``
 
728
   Mac OS X               ``'darwin'``
 
729
   OS/2                   ``'os2'``
 
730
   OS/2 EMX               ``'os2emx'``
 
731
   ====================== ===========================
722
732
 
723
733
   .. seealso::
724
734
      :attr:`os.name` has a coarser granularity.  :func:`os.uname` gives