Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions Doc/library/sysconfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -380,24 +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-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`.

Expand Down
39 changes: 28 additions & 11 deletions Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +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)

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':
Expand Down
7 changes: 7 additions & 0 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) '
Expand Down
Loading