Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6537bc

Browse files
committed
updated with exhaustive list and tests for >=11
1 parent 0964298 commit a6537bc

File tree

3 files changed

+54
-31
lines changed

3 files changed

+54
-31
lines changed

Doc/library/sysconfig.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,25 +380,32 @@ Other functions
380380
exact information included depends on the OS; e.g., on Linux, the kernel
381381
version isn't particularly important.
382382

383-
Examples of returned values:
383+
Returned values:
384384

385-
- linux-i586
385+
Linux platforms:
386+
- linux-i586
387+
- linux-i686
386388
- linux-alpha (?)
387389
- solaris-2.6-sun4u
388390

389-
Windows will return one of:
390-
391+
Windows platforms:
392+
- win32 (32-bit Windows)
391393
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
392394
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
393-
- win32 (all others - specifically, sys.platform is returned)
394-
395-
macOS can return:
395+
- win-arm32 (32-bit Windows on ARM)
396+
397+
macOS platforms:
398+
- macosx-{11.*-15.*}-arm64 (Apple Silicon)
399+
- macosx-10.{3,4}-ppc (PowerPC)
400+
- macosx-10.{3,4}-ppc64 (64-bit PowerPC)
401+
- macosx-10.{3,4}-i386 (32-bit Intel)
402+
- macosx-10.{3,4}-x86_64 (64-bit Intel)
403+
- macosx-10.4-fat (Universal binary with PPC and i386)
404+
- macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386)
405+
- macosx-10.4-fat64 (Universal binary with x86_64 and ppc64)
406+
- macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386)
407+
- macosx-10.4-intel (Intel binary with x86_64 and i386)
396408

397-
- macosx-11.0-arm64
398-
- macosx-10.6-ppc
399-
- macosx-10.4-ppc64
400-
- macosx-10.3-i386
401-
- macosx-10.4-fat
402409

403410
For other non-POSIX platforms, currently just returns :data:`sys.platform`.
404411

Lib/sysconfig/__init__.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -638,25 +638,34 @@ def get_platform():
638638
exact information included depends on the OS; on Linux, the kernel version
639639
isn't particularly important.
640640
641-
Examples of returned values:
642-
linux-i586
643-
linux-alpha (?)
644-
solaris-2.6-sun4u
645-
646-
Windows will return one of:
647-
win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
648-
win-arm64 (64-bit Windows on ARM64 (aka AArch64)
649-
win32 (all others - specifically, sys.platform is returned)
650-
651-
macOS can return:
652-
macosx-11.0-arm64
653-
macosx-10.6-ppc
654-
macosx-10.4-ppc64
655-
macosx-10.3-i386
656-
macosx-10.4-fat
657-
658-
659-
For other non-POSIX platforms, currently just returns 'sys.platform'.
641+
Returned values:
642+
643+
Linux platforms:
644+
- linux-i586
645+
- linux-i686
646+
- linux-alpha (?)
647+
- solaris-2.6-sun4u
648+
649+
Windows platforms:
650+
- win32 (32-bit Windows)
651+
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
652+
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
653+
- win-arm32 (32-bit Windows on ARM)
654+
655+
macOS platforms:
656+
- macosx-{11.*-15.*}-arm64 (Apple Silicon)
657+
- macosx-10.{3,4}-ppc (PowerPC)
658+
- macosx-10.{3,4}-ppc64 (64-bit PowerPC)
659+
- macosx-10.{3,4}-i386 (32-bit Intel)
660+
- macosx-10.{3,4}-x86_64 (64-bit Intel)
661+
- macosx-10.4-fat (Universal binary with PPC and i386)
662+
- macosx-10.4-fat3 (Universal binary with x86_64, PPC, and i386)
663+
- macosx-10.4-fat64 (Universal binary with x86_64 and ppc64)
664+
- macosx-10.4-universal (Universal binary with ppc64, x86_64, ppc, and i386)
665+
- macosx-10.4-intel (Intel binary with x86_64 and i386)
666+
667+
668+
For other non-POSIX platforms, currently just returns :data:`sys.platform`.
660669
661670
"""
662671
if os.name == 'nt':

Lib/test/test_sysconfig.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,13 @@ def test_get_platform(self):
352352

353353
self.assertEqual(get_platform(), 'macosx-10.4-%s' % arch)
354354

355+
for macver in range(11, 16):
356+
_osx_support._remove_original_values(get_config_vars())
357+
get_config_vars()['CFLAGS'] = ('-fno-strict-overflow -Wsign-compare -Wunreachable-code'
358+
'-arch arm64 -fno-common -dynamic -DNDEBUG -g -O3 -Wall')
359+
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = f"{macver}.0"
360+
self.assertEqual(get_platform(), 'macosx-%d.0-arm64' % macver)
361+
355362
# linux debian sarge
356363
os.name = 'posix'
357364
sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) '

0 commit comments

Comments
 (0)