summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-09-26 15:21:56 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-09-26 15:21:56 -0400
commit83611c2711c0ad3612a6c67c5432166ac1f4ca91 (patch)
treee6be2e0671489339a4e7a8d3a2060efa3bbdc0c6
parent2478914c6ee61f85ccc878fb052bf044b4bca39b (diff)
downloadpython-setuptools-bitbucket-83611c2711c0ad3612a6c67c5432166ac1f4ca91.tar.gz
Protect against import errors.
-rw-r--r--setuptools/msvc9_support.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/setuptools/msvc9_support.py b/setuptools/msvc9_support.py
index fba2a71a..f2e5cffc 100644
--- a/setuptools/msvc9_support.py
+++ b/setuptools/msvc9_support.py
@@ -1,13 +1,17 @@
import sys
-import distutils.msvc9compiler
-
def patch_for_specialized_compiler():
"""
Patch functions in distutils.msvc9compiler to use the standalone compiler
build for Python (Windows only). Fall back to original behavior when the
standalone compiler is not available.
"""
+ try:
+ distutils = __import__('distutils.msvc9compiler')
+ except ImportError:
+ # The module isn't available to be patched
+ return
+
VC_BASE = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f'
find_vcvarsall = distutils.msvc9compiler.find_vcvarsall
query_vcvarsall = distutils.msvc9compiler.query_vcvarsall