summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-12-27 10:57:05 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-12-27 10:57:05 +0000
commit4e99df67658a4e43f68e2fa5773267583ac586ea (patch)
treeee327c79390d0921b4d57ea3291fe5cd9e1ff190
parent4251fe7fede00e20eb4f4e1e80194113aee3766f (diff)
downloadnumpy-4e99df67658a4e43f68e2fa5773267583ac586ea.tar.gz
Fix manifest generation.
-rw-r--r--numpy/distutils/mingw32ccompiler.py31
1 files changed, 14 insertions, 17 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 567289939..19cb22a1b 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -244,28 +244,25 @@ def build_import_library():
# XXX: ideally, we should use exactly the same version as used by python. I
# submitted a patch to get this version, but it was only included for python
# 2.6.1 and above. So for versions below, we use a "best guess".
-_MSVCRVER_TO_FULLVER = {'90': None}
-
-def msvcrt_version(num):
- k = _MSVCRVER_TO_FULLVER[num]
- if not k:
- try:
- import msvcrt
- if hasattr(msvcrt, "CRT_ASSEMBLY_VERSION"):
- _MSVCRVER_TO_FULLVER['90'] = msvcrt.CRT_ASSEMBLY_VERSION
- else:
- _MSVCRVER_TO_FULLVER['90'] = "9.0.21022.8"
- except ImportError:
- # If we are here, means python was not built with MSVC. Not sure what to do
- # in that case: manifest building will fail, but it should not be used in
- # that case anyway
- log.warn('Cannot import msvcrt: using manifest will not be possible')
+_MSVCRVER_TO_FULLVER = {}
+if sys.platform == 'win32':
+ try:
+ import msvcrt
+ if hasattr(msvcrt, "CRT_ASSEMBLY_VERSION"):
+ _MSVCRVER_TO_FULLVER['90'] = msvcrt.CRT_ASSEMBLY_VERSION
+ else:
+ _MSVCRVER_TO_FULLVER['90'] = "9.0.21022.8"
+ except ImportError:
+ # If we are here, means python was not built with MSVC. Not sure what to do
+ # in that case: manifest building will fail, but it should not be used in
+ # that case anyway
+ log.warn('Cannot import msvcrt: using manifest will not be possible')
def msvc_manifest_xml(maj, min):
"""Given a major and minor version of the MSVCR, returns the
corresponding XML file."""
try:
- fullver = msvcrt_version(str(maj * 10 + min))
+ fullver = _MSVCRVER_TO_FULLVER[str(maj * 10 + min)]
except KeyError:
raise ValueError("Version %d,%d of MSVCRT not supported yet" \
% (maj, min))