From a0de96c8cd6caca379a7a8f9fab1d3e093f16a77 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 3 May 2025 13:18:29 +0400 Subject: [PATCH 1/5] use `.. program::` directive for documenting `platform` CLI --- Doc/library/cmdline.rst | 2 +- Doc/library/platform.rst | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Doc/library/cmdline.rst b/Doc/library/cmdline.rst index 85e82f6292a5ec..f7ae2133a70b7a 100644 --- a/Doc/library/cmdline.rst +++ b/Doc/library/cmdline.rst @@ -27,7 +27,7 @@ The following modules have a command-line interface. * :mod:`pdb` * :ref:`pickle ` * :ref:`pickletools ` -* :mod:`platform` +* :ref:`platform ` * :mod:`poplib` * :ref:`profile ` * :mod:`pstats` diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index cfe1e7ba48da32..c02b9aa6d2f668 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -360,6 +360,33 @@ Android Platform .. versionadded:: 3.13 +.. _platform-cli: + +Command-line Usage +------------------ + +:mod:`platform` can also be invoked directly using the :option:`-m` +switch of the interpreter:: + + python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...] + +The following options are accepted: + +.. program:: platform + +.. option:: --terse + + Print terse information about the platform. This is equivalent to + calling :func:`platform` with the *terse* argument set to ``True``. + +.. option:: --nonaliased + + Print information without system/OS name aliasing. This is equivalent to + calling :func:`platform` with the *aliased* argument set to ``True``. + +You can also pass one or more positional arguments (``terse``, ``nonaliased``) +to explicitly control the output format. These behave similarly to their +corresponding options. Miscellaneous ------------- From dea95f75615638520842340f517887a2367611d0 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 3 May 2025 13:42:59 +0400 Subject: [PATCH 2/5] Fix func link --- Doc/library/platform.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index c02b9aa6d2f668..957556e07ab89b 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -377,12 +377,13 @@ The following options are accepted: .. option:: --terse Print terse information about the platform. This is equivalent to - calling :func:`platform` with the *terse* argument set to ``True``. + calling :func:`platform.platform` with the *terse* argument set to ``True``. .. option:: --nonaliased - Print information without system/OS name aliasing. This is equivalent to - calling :func:`platform` with the *aliased* argument set to ``True``. + Print platform information without system/OS name aliasing. This is + equivalent to calling :func:`platform.platform` with the *aliased* argument + set to ``True``. You can also pass one or more positional arguments (``terse``, ``nonaliased``) to explicitly control the output format. These behave similarly to their From 4513a954caaf226ff3aa498b7f8ccfb8a48ae20a Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 3 May 2025 14:32:53 +0400 Subject: [PATCH 3/5] Add `.. versionadded::` directive --- Doc/library/platform.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 957556e07ab89b..521c3a8e813aec 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -365,6 +365,8 @@ Android Platform Command-line Usage ------------------ +.. versionadded:: 3.14 + :mod:`platform` can also be invoked directly using the :option:`-m` switch of the interpreter:: From 18049695ef6b02d8e48b5ab4414ad0f95fa1cbb0 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 3 May 2025 14:33:45 +0400 Subject: [PATCH 4/5] Revert "Add `.. versionadded::` directive" This reverts commit 4513a954caaf226ff3aa498b7f8ccfb8a48ae20a. --- Doc/library/platform.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 521c3a8e813aec..957556e07ab89b 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -365,8 +365,6 @@ Android Platform Command-line Usage ------------------ -.. versionadded:: 3.14 - :mod:`platform` can also be invoked directly using the :option:`-m` switch of the interpreter:: From 4aff409e4e588281e50b394c40b24701b87a8cf9 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 3 May 2025 15:52:04 +0400 Subject: [PATCH 5/5] Fix headings --- Doc/library/platform.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 957556e07ab89b..5c999054323be5 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -17,7 +17,7 @@ section. -Cross Platform +Cross platform -------------- @@ -188,7 +188,7 @@ Cross Platform :attr:`processor` is resolved late instead of immediately. -Java Platform +Java platform ------------- @@ -206,7 +206,7 @@ Java Platform and was only useful for Jython support. -Windows Platform +Windows platform ---------------- @@ -240,7 +240,7 @@ Windows Platform .. versionadded:: 3.8 -macOS Platform +macOS platform -------------- .. function:: mac_ver(release='', versioninfo=('','',''), machine='') @@ -252,7 +252,7 @@ macOS Platform Entries which cannot be determined are set to ``''``. All tuple entries are strings. -iOS Platform +iOS platform ------------ .. function:: ios_ver(system='', release='', model='', is_simulator=False) @@ -271,7 +271,7 @@ iOS Platform parameters. -Unix Platforms +Unix platforms -------------- .. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=16384) @@ -287,7 +287,7 @@ Unix Platforms The file is read and scanned in chunks of *chunksize* bytes. -Linux Platforms +Linux platforms --------------- .. function:: freedesktop_os_release() @@ -325,7 +325,7 @@ Linux Platforms .. versionadded:: 3.10 -Android Platform +Android platform ---------------- .. function:: android_ver(release="", api_level=0, manufacturer="", \ @@ -362,7 +362,7 @@ Android Platform .. _platform-cli: -Command-line Usage +Command-line usage ------------------ :mod:`platform` can also be invoked directly using the :option:`-m`