From 096429863667a6385a9e6b6761ac9d5b4d69e750 Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Sun, 15 Jun 2025 02:30:12 -0300 Subject: [PATCH 01/10] Added missing macos return to sysconfig.get_platform() --- Doc/library/sysconfig.rst | 1 + Lib/sysconfig/__init__.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 684d14a74c48ab..c00a4713d72814 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -394,6 +394,7 @@ Other functions macOS can return: + - macosx-11.0-arm64 - macosx-10.6-ppc - macosx-10.4-ppc64 - macosx-10.3-i386 diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 49e0986517ce97..ff9a8101fd4ef7 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -648,6 +648,14 @@ def get_platform(): win-arm64 (64-bit Windows on ARM64 (aka AArch64) win32 (all others - specifically, sys.platform is returned) + macOS can return: + macosx-11.0-arm64 + macosx-10.6-ppc + macosx-10.4-ppc64 + macosx-10.3-i386 + macosx-10.4-fat + + For other non-POSIX platforms, currently just returns 'sys.platform'. """ From 7ab7580e0f1970278fdf2011d66ebbc07da9ef4b Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Sun, 15 Jun 2025 04:51:37 -0300 Subject: [PATCH 02/10] updated with exhaustive list and tests for >=11 --- Doc/library/sysconfig.rst | 29 ++++++++++++++--------- Lib/sysconfig/__init__.py | 47 +++++++++++++++++++++++--------------- Lib/test/test_sysconfig.py | 7 ++++++ 3 files changed, 53 insertions(+), 30 deletions(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index c00a4713d72814..ae77e6bf6de133 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -380,25 +380,32 @@ Other functions exact information included depends on the OS; e.g., on Linux, the kernel version isn't particularly important. - Examples of returned values: + Returned values: + Linux platforms: - linux-i586 + - linux-i686 - linux-alpha (?) - solaris-2.6-sun4u - Windows will return one of: - + Windows platforms: + - win32 (32-bit Windows) - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - - win32 (all others - specifically, sys.platform is returned) - - macOS can return: + - win-arm32 (32-bit Windows on ARM) + + macOS platforms: + - macosx-{11.*-15.*}-arm64 (Apple Silicon) + - macosx-10.{3,4}-ppc (PowerPC) + - macosx-10.{3,4}-ppc64 (64-bit PowerPC) + - macosx-10.{3,4}-i386 (32-bit Intel) + - macosx-10.{3,4}-x86_64 (64-bit Intel) + - macosx-10.4-fat (Universal binary with PPC and i386) + - macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386) + - macosx-10.4-fat64 (Universal binary with x86_64 and ppc64) + - macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386) + - macosx-10.4-intel (Intel binary with x86_64 and i386) - - macosx-11.0-arm64 - - macosx-10.6-ppc - - macosx-10.4-ppc64 - - macosx-10.3-i386 - - macosx-10.4-fat For other non-POSIX platforms, currently just returns :data:`sys.platform`. diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index ff9a8101fd4ef7..4ec4391c8afd58 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -638,25 +638,34 @@ def get_platform(): exact information included depends on the OS; on Linux, the kernel version isn't particularly important. - Examples of returned values: - linux-i586 - linux-alpha (?) - solaris-2.6-sun4u - - Windows will return one of: - win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - win-arm64 (64-bit Windows on ARM64 (aka AArch64) - win32 (all others - specifically, sys.platform is returned) - - macOS can return: - macosx-11.0-arm64 - macosx-10.6-ppc - macosx-10.4-ppc64 - macosx-10.3-i386 - macosx-10.4-fat - - - For other non-POSIX platforms, currently just returns 'sys.platform'. + Returned values: + + Linux platforms: + - linux-i586 + - linux-i686 + - linux-alpha (?) + - solaris-2.6-sun4u + + Windows platforms: + - win32 (32-bit Windows) + - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) + - win-arm64 (64-bit Windows on ARM64, aka AArch64) + - win-arm32 (32-bit Windows on ARM) + + macOS platforms: + - macosx-{11.*-15.*}-arm64 (Apple Silicon) + - macosx-10.{3,4}-ppc (PowerPC) + - macosx-10.{3,4}-ppc64 (64-bit PowerPC) + - macosx-10.{3,4}-i386 (32-bit Intel) + - macosx-10.{3,4}-x86_64 (64-bit Intel) + - macosx-10.4-fat (Universal binary with PPC and i386) + - macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386) + - macosx-10.4-fat64 (Universal binary with x86_64 and ppc64) + - macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386) + - macosx-10.4-intel (Intel binary with x86_64 and i386) + + + For other non-POSIX platforms, currently just returns :data:`sys.platform`. """ if os.name == 'nt': diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 2c0df9376abfc6..606b1c31b69610 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -352,6 +352,13 @@ def test_get_platform(self): self.assertEqual(get_platform(), 'macosx-10.4-%s' % arch) + for macver in range(11, 16): + _osx_support._remove_original_values(get_config_vars()) + get_config_vars()['CFLAGS'] = ('-fno-strict-overflow -Wsign-compare -Wunreachable-code' + '-arch arm64 -fno-common -dynamic -DNDEBUG -g -O3 -Wall') + get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = f"{macver}.0" + self.assertEqual(get_platform(), 'macosx-%d.0-arm64' % macver) + # linux debian sarge os.name = 'posix' sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) ' From 5db6178c85c11ebef1e089a2f6508ae6524ba65b Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Mon, 16 Jun 2025 09:05:31 -0300 Subject: [PATCH 03/10] removed exhaustive list for macOS --- Doc/library/sysconfig.rst | 20 ++++++++------------ Lib/sysconfig/__init__.py | 20 ++++++++------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index ae77e6bf6de133..84e7825d72a5de 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -382,29 +382,25 @@ Other functions Returned values: - Linux platforms: + Examples of Linux returned values: + - linux-i586 - linux-i686 - linux-alpha (?) - solaris-2.6-sun4u Windows platforms: + - win32 (32-bit Windows) - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - win-arm32 (32-bit Windows on ARM) - macOS platforms: - - macosx-{11.*-15.*}-arm64 (Apple Silicon) - - macosx-10.{3,4}-ppc (PowerPC) - - macosx-10.{3,4}-ppc64 (64-bit PowerPC) - - macosx-10.{3,4}-i386 (32-bit Intel) - - macosx-10.{3,4}-x86_64 (64-bit Intel) - - macosx-10.4-fat (Universal binary with PPC and i386) - - macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386) - - macosx-10.4-fat64 (Universal binary with x86_64 and ppc64) - - macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386) - - macosx-10.4-intel (Intel binary with x86_64 and i386) + Examples of macOS returned values: + + - macosx-10.13-x86_64 + - macosx-11-universal2 + - macosx-15.5-arm64 For other non-POSIX platforms, currently just returns :data:`sys.platform`. diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 4ec4391c8afd58..3dd9b18eb0e56a 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -640,29 +640,25 @@ def get_platform(): Returned values: - Linux platforms: + Examples of Linux returned values: + - linux-i586 - linux-i686 - linux-alpha (?) - solaris-2.6-sun4u Windows platforms: + - win32 (32-bit Windows) - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - win-arm32 (32-bit Windows on ARM) - macOS platforms: - - macosx-{11.*-15.*}-arm64 (Apple Silicon) - - macosx-10.{3,4}-ppc (PowerPC) - - macosx-10.{3,4}-ppc64 (64-bit PowerPC) - - macosx-10.{3,4}-i386 (32-bit Intel) - - macosx-10.{3,4}-x86_64 (64-bit Intel) - - macosx-10.4-fat (Universal binary with PPC and i386) - - macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386) - - macosx-10.4-fat64 (Universal binary with x86_64 and ppc64) - - macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386) - - macosx-10.4-intel (Intel binary with x86_64 and i386) + Examples of macOS returned values: + + - macosx-10.13-x86_64 + - macosx-11-universal2 + - macosx-15.5-arm64 For other non-POSIX platforms, currently just returns :data:`sys.platform`. From cb393a02e4a815c3c22f68596c3de42c73f922f2 Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Mon, 16 Jun 2025 23:41:41 -0300 Subject: [PATCH 04/10] removed windows configs + format change --- Doc/library/sysconfig.rst | 10 ++++------ Lib/sysconfig/__init__.py | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 84e7825d72a5de..9894ae407fdbf8 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -380,23 +380,21 @@ Other functions exact information included depends on the OS; e.g., on Linux, the kernel version isn't particularly important. - Returned values: + Examples of returned values: - Examples of Linux returned values: + Linux - linux-i586 - linux-i686 - linux-alpha (?) - solaris-2.6-sun4u - Windows platforms: + Windows - - win32 (32-bit Windows) - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - - win-arm32 (32-bit Windows on ARM) - Examples of macOS returned values: + macOS - macosx-10.13-x86_64 - macosx-11-universal2 diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 3dd9b18eb0e56a..5d6d592baf9b3f 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -638,23 +638,21 @@ def get_platform(): exact information included depends on the OS; on Linux, the kernel version isn't particularly important. - Returned values: + Examples of returned values: - Examples of Linux returned values: + Linux - linux-i586 - linux-i686 - linux-alpha (?) - solaris-2.6-sun4u - Windows platforms: + Windows - - win32 (32-bit Windows) - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - - win-arm32 (32-bit Windows on ARM) - Examples of macOS returned values: + macOS - macosx-10.13-x86_64 - macosx-11-universal2 From f15972346716e0e8a78f14d7d7fa9670cfc0eb9a Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Fri, 20 Jun 2025 02:51:26 -0300 Subject: [PATCH 05/10] missing non posix example or removal --- Doc/library/sysconfig.rst | 15 +++++---------- Lib/sysconfig/__init__.py | 19 ++++++------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 9894ae407fdbf8..0196244d7cca95 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -382,24 +382,19 @@ Other functions Examples of returned values: - Linux - - linux-i586 - - linux-i686 - - linux-alpha (?) - - solaris-2.6-sun4u - - Windows + Windows: - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - macOS + POSIX based OS: - - macosx-10.13-x86_64 - - macosx-11-universal2 + - linux-x86_64 - macosx-15.5-arm64 + - android-9-arm64_v8a + Other non-POSIX platforms: For other non-POSIX platforms, currently just returns :data:`sys.platform`. diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 5d6d592baf9b3f..7d92212846fa0f 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -640,27 +640,20 @@ def get_platform(): Examples of returned values: - Linux - - - linux-i586 - - linux-i686 - - linux-alpha (?) - - solaris-2.6-sun4u - - Windows + Windows: - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - macOS + POSIX based OS: - - macosx-10.13-x86_64 - - macosx-11-universal2 + - linux-x86_64 - macosx-15.5-arm64 + - android-9-arm64_v8a + Other non-POSIX platforms: - For other non-POSIX platforms, currently just returns :data:`sys.platform`. - + For other non-POSIX platforms, currently just returns :data:`sys.platform`. """ if os.name == 'nt': if 'amd64' in sys.version.lower(): From 054836094abaeea8881d289bd654e798f6ac8803 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Jun 2025 00:43:26 +0200 Subject: [PATCH 06/10] remove Non POSIX Co-authored-by: Mikhail Efimov --- Doc/library/sysconfig.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 0196244d7cca95..4ff519d1d99203 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -394,8 +394,6 @@ Other functions - macosx-15.5-arm64 - android-9-arm64_v8a - Other non-POSIX platforms: - For other non-POSIX platforms, currently just returns :data:`sys.platform`. From d7a23640a23229fbf073f34feff522e9587c90ba Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Jun 2025 00:44:23 +0200 Subject: [PATCH 07/10] windows Co-authored-by: Mikhail Efimov --- Doc/library/sysconfig.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 4ff519d1d99203..00e613091de91f 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -387,6 +387,7 @@ Other functions - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) + - win32 (all others - specifically, sys.platform is returned) POSIX based OS: From 3aa49e4b6538b7d350398e9b33e19289151cf4d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Jun 2025 00:44:39 +0200 Subject: [PATCH 08/10] Update Doc/library/sysconfig.rst Co-authored-by: Mikhail Efimov --- Doc/library/sysconfig.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 00e613091de91f..014c01598bd338 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -393,7 +393,7 @@ Other functions - linux-x86_64 - macosx-15.5-arm64 - - android-9-arm64_v8a + - android-24-arm64_v8a For other non-POSIX platforms, currently just returns :data:`sys.platform`. From 38052992833f8c0fc77c28c0449cdbd9a01b4286 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Jun 2025 00:45:24 +0200 Subject: [PATCH 09/10] Update Lib/sysconfig/__init__.py Co-authored-by: Mikhail Efimov --- Lib/sysconfig/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 7d92212846fa0f..56088b8c24d9cd 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -644,7 +644,8 @@ def get_platform(): - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - + - win32 (all others - specifically, sys.platform is returned) + POSIX based OS: - linux-x86_64 From 56d56e3414eb1d6daabfe850dcaeef3e203067f8 Mon Sep 17 00:00:00 2001 From: ivanbelenky Date: Fri, 20 Jun 2025 19:50:00 -0300 Subject: [PATCH 10/10] sync on Doc --- Lib/sysconfig/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 56088b8c24d9cd..cfff9ec88265b6 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -640,22 +640,20 @@ def get_platform(): Examples of returned values: + Windows: - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) - win-arm64 (64-bit Windows on ARM64, aka AArch64) - win32 (all others - specifically, sys.platform is returned) - + POSIX based OS: - linux-x86_64 - macosx-15.5-arm64 - - android-9-arm64_v8a + - android-24-arm64_v8a - Other non-POSIX platforms: - - For other non-POSIX platforms, currently just returns :data:`sys.platform`. - """ + For other non-POSIX platforms, currently just returns :data:`sys.platform`.""" if os.name == 'nt': if 'amd64' in sys.version.lower(): return 'win-amd64'