Skip to content

Commit

Permalink
improved MSVC detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed May 3, 2010
1 parent 07ea110 commit 45059a9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion setup.py
Expand Up @@ -23,8 +23,10 @@
# $Id$ # $Id$
# #
import sys, os import sys, os
import optparse
from warnings import warn from warnings import warn
from distutils.ccompiler import new_compiler from distutils.ccompiler import new_compiler
from distutils.errors import DistutilsPlatformError
from distutils.msvccompiler import MSVCCompiler from distutils.msvccompiler import MSVCCompiler


from ez_setup import use_setuptools from ez_setup import use_setuptools
Expand Down Expand Up @@ -84,7 +86,17 @@ class UnsupportedPlatformWarning(Warning):
compile_args = [] compile_args = []
link_args = [] link_args = []
macros = [] macros = []
compiler = new_compiler() class SilentOptionParser(optparse.OptionParser):
def error(self, msg):
# ignore errors
pass
parser = SilentOptionParser()
parser.add_option('--compiler', dest='compiler', default=None)
(options, args) = parser.parse_args()
try:
compiler = new_compiler(compiler=options.compiler)
except DistutilsPlatformError:
compiler = None
if IS_WINDOWS and isinstance(compiler, MSVCCompiler): if IS_WINDOWS and isinstance(compiler, MSVCCompiler):
# set flags only available when using MSVC # set flags only available when using MSVC
if COMPILE_DEBUG: if COMPILE_DEBUG:
Expand Down

0 comments on commit 45059a9

Please sign in to comment.