summaryrefslogtreecommitdiff
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2007-08-21 01:04:47 +0000
committerMark Hammond <mhammond@skippinet.com.au>2007-08-21 01:04:47 +0000
commite4f271f38d0e23e408624b3fab6298d9037a1307 (patch)
treee039b54f509bffe3d2edf25198a535c4dfc0816b /Lib/distutils/util.py
parentc65a5f1b14ff6bd995d7cb102e5b4577ce0f16e2 (diff)
downloadcpython-git-e4f271f38d0e23e408624b3fab6298d9037a1307.tar.gz
[ 1761786 ] distutils.util.get_platform() return value on 64bit Windows
As discussed on distutils-sig: Allows the generated installer name on 64bit Windows platforms to be different than the name generated for 32bit Windows platforms.
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index cfcc6a951e..8979634e4b 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -29,8 +29,27 @@ def get_platform ():
irix-5.3
irix64-6.2
- For non-POSIX platforms, currently just returns 'sys.platform'.
+ Windows will return one of:
+ win-x86_64 (64bit Windows on x86_64 (AMD64))
+ win-ia64 (64bit Windows on Itanium)
+ win32 (all others - specifically, sys.platform is returned)
+
+ For other non-POSIX platforms, currently just returns 'sys.platform'.
"""
+ if os.name == 'nt':
+ # sniff sys.version for architecture.
+ prefix = " bit ("
+ i = string.find(sys.version, prefix)
+ if i == -1:
+ return sys.platform
+ j = string.find(sys.version, ")", i)
+ look = sys.version[i+len(prefix):j].lower()
+ if look=='amd64':
+ return 'win-x86_64'
+ if look=='itanium':
+ return 'win-ia64'
+ return sys.platform
+
if os.name != "posix" or not hasattr(os, 'uname'):
# XXX what about the architecture? NT is Intel or Alpha,
# Mac OS is M68k or PPC, etc.