summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/MSCommon/common.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-09-09 02:36:45 (GMT)
committerDavid Cournapeau <cournape@gmail.com>2009-09-09 02:36:45 (GMT)
commit2426e20e2cc3f13e480c5e4ce2b202614b1314e6 (patch)
tree4301d2cd773d4d513b99edbed0af85fe23c30195 /src/engine/SCons/Tool/MSCommon/common.py
parent7993461430b56b88522513967e37eefb858b7753 (diff)
downloadSCons-2426e20e2cc3f13e480c5e4ce2b202614b1314e6.zip
SCons-2426e20e2cc3f13e480c5e4ce2b202614b1314e6.tar.gz
SCons-2426e20e2cc3f13e480c5e4ce2b202614b1314e6.tar.bz2
Fix win64 detection.
Diffstat (limited to 'src/engine/SCons/Tool/MSCommon/common.py')
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index f74d10c..017892c 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -54,7 +54,9 @@ else:
_is_win64 = None
def is_win64():
- """Return true if running on windows 64 bits."""
+ """Return true if running on windows 64 bits.
+
+ Works whether python itself runs in 64 bits or 32 bits."""
# Unfortunately, python does not provide a useful way to determine
# if the underlying Windows OS is 32-bit or 64-bit. Worse, whether
# the Python itself is 32-bit or 64-bit affects what it returns,
@@ -63,17 +65,22 @@ def is_win64():
# avoid repeated registry calls.
global _is_win64
if _is_win64 is None:
- try:
- yo = read_reg(r'Software\Wow6432Node')
- except WindowsError:
- yo = None
- _is_win64 = (yo is not None)
+ _is_win64 = has_reg(r"Software\Wow6432Node")
return _is_win64
def read_reg(value):
return SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, value)[0]
+def has_reg(value):
+ """Return True if the given key exists in HKEY_LOCAL_MACHINE, False
+ otherwise."""
+ try:
+ SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value)
+ ret = True
+ except WindowsError:
+ ret = False
+ return ret
# Functions for fetching environment variable settings from batch files.