diff -r a63af1c8e0b1 Doc/library/allos.rst --- a/Doc/library/allos.rst Sat Oct 12 19:54:30 2013 +0200 +++ b/Doc/library/allos.rst Sat Oct 12 20:32:02 2013 +0200 @@ -28,3 +28,16 @@ but they are available on most other sys platform.rst errno.rst ctypes.rst + + +.. _availability: + +Notes on availability +===================== + +* An "Availability: Unix" note means that this function is commonly found on + Unix systems. It does not make any claims about its existence on a specific + operating system. + +* If not separately noted, all functions that claim "Availability: Unix" are + supported on Mac OS X, which builds on a Unix core. diff -r a63af1c8e0b1 Doc/library/os.rst --- a/Doc/library/os.rst Sat Oct 12 19:54:30 2013 +0200 +++ b/Doc/library/os.rst Sat Oct 12 20:32:02 2013 +0200 @@ -29,15 +29,6 @@ Notes on the availability of these funct objects, and result in an object of the same type, if a path or file name is returned. -* An "Availability: Unix" note means that this function is commonly found on - Unix systems. It does not make any claims about its existence on a specific - operating system. - -* If not separately noted, all functions that claim "Availability: Unix" are - supported on Mac OS X, which builds on a Unix core. - -.. Availability notes get their own line and occur at the end of the function -.. documentation. .. note:: @@ -100,7 +91,7 @@ process and user. Return the filename corresponding to the controlling terminal of the process. - Availability: Unix. + .. availability:: Unix .. data:: environ @@ -193,7 +184,7 @@ process and user. and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would like to use a different encoding. - Availability: most flavors of Unix, Windows. + .. availability:: most flavors of Unix, Windows .. function:: getenvb(key, default=None) @@ -201,7 +192,7 @@ process and user. Return the value of the environment variable *key* if it exists, or *default* if it doesn't. *key*, *default* and the result are bytes. - Availability: most flavors of Unix. + .. availability:: most flavors of Unix .. versionadded:: 3.2 diff -r a63af1c8e0b1 Doc/tools/sphinxext/pyspecific.py --- a/Doc/tools/sphinxext/pyspecific.py Sat Oct 12 19:54:30 2013 +0200 +++ b/Doc/tools/sphinxext/pyspecific.py Sat Oct 12 20:32:02 2013 +0200 @@ -5,7 +5,7 @@ Sphinx extension with Python doc-specific markup. - :copyright: 2008, 2009, 2010, 2011, 2012 by Georg Brandl. + :copyright: 2008-2013 by Georg Brandl. :license: Python license. """ @@ -113,6 +113,27 @@ class ImplementationDetail(Directive): return [pnode] +# Support for documenting platform availability + +class Availability(Directive): + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + has_content = False + + def run(self): + pnode = nodes.paragraph(classes=['availability']) + n, m = self.state.inline_text(':ref:`Availability `: ', + self.lineno) + pnode.extend(n + m) + n, m = self.state.inline_text(self.arguments[0], self.lineno) + pnode.extend(n + m) + pnode += nodes.Text('.', '.') + return [pnode] + + # Support for documenting decorators from sphinx import addnodes @@ -336,6 +357,7 @@ def setup(app): app.add_role('issue', issue_role) app.add_role('source', source_role) app.add_directive('impl-detail', ImplementationDetail) + app.add_directive('availability', Availability) app.add_directive('deprecated-removed', DeprecatedRemoved) app.add_builder(PydocTopicsBuilder) app.add_builder(suspicious.CheckSuspiciousMarkupBuilder)