summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-127732: Add Windows Server 2025 detection to platform module (GH-127733)Wulian2024-12-091-1/+2
|
* gh-122549: Add platform.invalidate_caches() (#122547)Bénédikt Tran2024-11-151-1/+14
| | | Allow to invalidate platform's cached results.
* gh-120417: Add #noqa to used imports in the stdlib (#120421)Victor Stinner2024-06-131-1/+1
| | | | | Tools such as ruff can ignore "imported but unused" warnings if a line ends with "# noqa: F401". It avoids the temptation to remove an import which is used effectively.
* gh-118673: Remove shebang and executable bits from stdlib modules. (#119658)Jason R. Coombs2024-05-291-2/+0
| | | | | | | * gh-118673: Remove shebang and executable bits from stdlib modules. * Removed shebangs and exe bits on turtledemo scripts. The setting was inappropriate for '__main__' and inconsistent across the other modules. The scripts can still be executed directly by invoking with the desired interpreter.
* gh-119132: Update sys.version to identify free-threaded or not. (gh-119134)Donghee Na2024-05-181-9/+15
|
* gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568)Steve (Gadget) Barnes2024-04-011-1/+2
| | | | | | Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* gh-114099: Additions to standard library to support iOS (GH-117052)Russell Keith-Magee2024-03-281-7/+46
| | | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Ned Deily <nad@python.org>
* gh-71042: Add `platform.android_ver` (#116674)Malcolm Smith2024-03-271-0/+46
|
* gh-116493: Remove old Python 2.x _winreg imports from platform.py (GH-116494)Nikita Sobolev2024-03-081-8/+2
|
* gh-116349: Deprecate `platform.java_ver` function (#116471)Nikita Sobolev2024-03-081-1/+3
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-114490: Add check for Mach-O linkage in Lib/platform.py (#114491)Aiden Fox Ivey2024-01-261-0/+2
| | | | | ``platform.architecture()`` now returns the format of binaries (e.g. Mach-O) instead of the default empty string. Co-authored-by: AN Long <aisk@users.noreply.github.com>
* gh-112278: Disable WMI queries on Windows after they time out (GH-112658)AN Long2023-12-071-13/+19
|
* gh-103977: compile re expressions in platform.py only if required (#103981)Pieter Eendebak2023-04-301-36/+39
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-102491: Remove IronPython version check in sys_version (#102492)Pieter Eendebak2023-03-191-34/+1
|
* gh-91038: Change default argument value to `False` instead of `0` (#31621)Rotzbua2023-02-271-1/+1
| | | | | | The argument is used as a switch and corresponds to a boolean logic. Therefore it is more intuitive to use the corresponding constant `False` as default value instead of the integer `0`. Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
* gh-100750: pass encoding kwarg in lib/platform.py (#100751)Thomas Grainger2023-01-201-0/+2
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)Nikita Sobolev2022-12-231-1/+1
|
* gh-97966: Restore prior expectation that uname_result._fields and ._asdict ↵Jason R. Coombs2022-11-261-2/+4
| | | | would include the processor. (gh-98343)
* gh-89545: Updates platform module to use new internal _wmi module on Windows ↵Steve Dower2022-09-071-43/+105
| | | | to directly query OS properties (GH-96289)
* gh-94713 - Replacing while 1 with while True (#94714)Itay2022-07-131-1/+1
|
* gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Christian Heimes2022-05-191-0/+4
|
* bpo-40280: Emscripten has no support for subprocesses (GH-29872)Christian Heimes2021-12-021-2/+8
| | | | | | | Fixes ``platform`` and ``help()`` on emscripten. Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-1/+1
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* Remove compatibility check for Python versions below 2.2. (GH-28314)Omer Katz2021-09-171-5/+4
| | | | | | `os.path.realpath()` already exists in all our supported Python versions. There's no longer a need to check if it exists or not. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* platform: Import subprocess in function. (GH-27610)Inada Naoki2021-08-051-1/+1
|
* bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent ↵Konstantin-Glukhov2021-07-131-0/+1
| | | | erroneous STDIN consumption (GH-27092)
* Fix typos in multiple files (GH-26689)Binbin2021-06-131-2/+2
| | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of ↵Shreyan Avigyan2021-04-221-10/+11
| | | | | | | sys.getwindowsversion() (GH-25500) The sys module uses the kernel32.dll version number, which can vary from the "actual" Windows version. Since the best option for getting the version is WMI (which is expensive), we switch back to launching cmd.exe (which is also expensive, but a lot less code on our part). sys.getwindowsversion() is not updated to avoid launching executables from that module.
* handle empty string in variable executable in platform.libc_ver() (#23140)Kurochan2021-01-021-1/+1
|
* bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but ↵Jason R. Coombs2020-12-311-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | processor) (#23010) * Add test capturing missed expectation with uname_result._replace. * bpo-42163: Override uname_result._make to allow uname_result._replace to work (for everything but 'processor'. * Replace hard-coded length with one derived from the definition. * Add test capturing missed expectation with copy/deepcopy on namedtuple (bpo-42189). * bpo-42189: Exclude processor parameter when constructing uname_result. * In _make, rely on __new__ to strip processor. * Add blurb. * iter is not necessary here. * Rely on num_fields in __new__ * Add test for slices on uname * Add test for copy and pickle. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> * import pickle * Fix equality test after pickling. * Simply rely on __reduce__ for pickling. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-28468: Fix typo in _os_release_candidates (GH-23913)Victor Stinner2020-12-231-1/+1
| | | Automerge-Triggered-By: GH:tiran
* bpo-28468: Add platform.freedesktop_os_release() (GH-23492)Christian Heimes2020-11-301-0/+57
| | | | | | | Add platform.freedesktop_os_release() function to parse freedesktop.org os-release files. Signed-off-by: Christian Heimes <christian@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-42029: Remove IRIX code (GH-23023)Victor Stinner2020-10-291-13/+0
| | | | IRIX code was slowy removed in Python 2.4 (--with-sgi-dl), Python 3.3 (Irix threads), and Python 3.7.
* bpo-40570: Improve compatibility of uname_result with late-bound .platform ↵Jason R. Coombs2020-05-091-3/+4
| | | | | | | (#20015) * bpo-40570: Improve compatibility of uname_result with late-bound .platform. * Add test capturing ability to cast uname to a tuple.
* bpo-40459: Fix NameError in platform.py (GH-19855)Dennis Sweeney2020-05-051-3/+3
|
* bpo-35967 resolve platform.processor late (GH-12239)Jason R. Coombs2020-04-161-79/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replace flag-flip indirection with direct inspection * Use any for simpler code * Avoid flag flip and set results directly. * Resolve processor in a single function. * Extract processor handling into a namespace (class) * Remove _syscmd_uname, unused * Restore platform.processor behavior to match prior expectation (reliant on uname -p in a subprocess). * Extract '_unknown_as_blank' function. * Override uname_result to resolve the processor late. * Add a test intended to capture the expected values from 'uname -p' * Instead of trying to keep track of all of the possible outputs on different systems (probably a fool's errand), simply assert that except for the known platform variance, uname().processor matches the output of 'uname -p' * Use a skipIf directive * Use contextlib.suppress to suppress the error. Inline strip call. * 📜🤖 Added by blurb_it. * Remove use of contextlib.suppress (it would fail with NameError if it had any effect). Rely on _unknown_as_blank to replace unknown with blank. Co-authored-by: blurb-it[bot] <blurb-it[bot]@users.noreply.github.com>
* bpo-35389: platform.platform() calls libc_ver() without executable (GH-14418)Victor Stinner2019-06-271-1/+1
| | | | | | | When libc_ver() is called with an executable, the os.confstr('CS_GNU_LIBC_VERSION') fast-path cannot be taken. Modify platform.platform() to call libc_ver() without executable, instead of calling libc_ver(sys.executable), since sys.executable is already the default value.
* bpo-36766: Typos in docs and code comments (GH-13116)penguindustin2019-05-061-1/+1
|
* bpo-35920: Windows 10 ARM32 platform support (GH-11774)Paul Monson2019-04-251-0/+21
|
* Fixes platform.win32_ver on non-Windows platforms (GH-12912)Steve Dower2019-04-221-12/+12
|
* bpo-35516: platform.system_alias() don't replace Darwin (GH-11207)Victor Stinner2018-12-181-0/+3
| | | | Add a comment explaining why system_alias() doesn't alias Darwin to macOS.
* bpo-35348: Fix platform.architecture() (GH-11159)Victor Stinner2018-12-171-4/+12
| | | | | | | | | | Make platform.architecture() parsing of "file" command output more reliable: * Add the "-b" option to the "file" command to omit the filename; * Force the usage of the C locale; * Search also the "shared object" pattern. Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35346: Cleanup platform.architecture() (GH-11130)Victor Stinner2018-12-141-6/+2
| | | struct.calcsize('P') now always works.
* bpo-35346: Drop Mac OS 9 support from platform (GH-10959)Victor Stinner2018-12-121-15/+2
| | | | | | Drop Mac OS 9 and Rhapsody support from the platform module: * Rhapsody: last release in 2000 * Mac OS 9: last release in 2001
* bpo-35346, platform: replace os.popen() with subprocess (GH-10786)Victor Stinner2018-12-071-39/+19
| | | | | | | | | | | Replace os.popen() with subprocess.check_output() in the platform module: * platform.uname() (its _syscmd_ver() helper function) now redirects stderr to DEVNULL. * Remove platform.DEV_NULL. * _syscmd_uname() and _syscmd_file() no longer catch AttributeError. The "except AttributeError:" was only needed in Python 2, when os.popen() was not always available. In Python 3, subprocess.check_output() is always available.
* bpo-35344: platform.platform() uses mac_ver() on macOS (GH-10780)Victor Stinner2018-12-051-0/+8
| | | | | On macOS, platform.platform() now uses mac_ver(), if it returns a non-empty release string, to get the macOS version rather than darwin version.
* bpo-35389: platform.libc_ver() uses os.confstr() (GH-10891)Victor Stinner2018-12-051-1/+14
| | | | | | | | | | platform.libc_ver() now uses os.confstr('CS_GNU_LIBC_VERSION') if available and the *executable* parameter is not set. The default value of the libc_ver() *executable* parameter becomes None. Quick benchmark on Fedora 29: python3 -m perf command ./python -S -c 'import platform; platform.libc_ver()' 94.9 ms +- 4.3 ms -> 33.2 ms +- 1.4 ms: 2.86x faster (-65%)
* bpo-35346, platform: import subprocess in _syscmd_file() (GH-10892)Victor Stinner2018-12-041-5/+7
| | | | | | | Only platform._syscmd_file() uses subprocess. Move subprocess import inside this function to reduce the number of imports at Python startup. Remove also warnings import which is no longer needed.
* bpo-35345: Remove platform.popen() (GH-10781)Victor Stinner2018-11-291-9/+0
| | | | | | | Remove platform.popen() function, it was deprecated since Python 3.3: use os.popen() instead. Rename also the "Removed" section to "API and Feature Removals" of What's New in Python 3.8.
* bpo-28167: Remove platform._dist_try_harder() (GH-10787)Victor Stinner2018-11-291-48/+0
| | | | | platform._dist_try_harder() was an helper function for platform.linux_distribution() which has been removed by the commit 8b94b41ab7b12f745dea744e8940631318816935.