aboutsummaryrefslogtreecommitdiffstats
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
commitc735886bf4433d26f8c0679b722e46393a1dd92a (patch)
tree73ff13843a9144a0ab6b6cebd41ce43c012ad975
parentfb6baa09e5089c3984ee38da5f96b857c7e90c8f (diff)
downloadexternal_python_setuptools-c735886bf4433d26f8c0679b722e46393a1dd92a.tar.gz
external_python_setuptools-c735886bf4433d26f8c0679b722e46393a1dd92a.tar.bz2
external_python_setuptools-c735886bf4433d26f8c0679b722e46393a1dd92a.zip
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