#############################################################################
# Setup Intel Compiler
# Please notice it only supports Visual Studio 2015 or later
#############################################################################
import platform

from distutils import ccompiler
from distutils.ccompiler import *
if platform.system() == 'Windows':  # to prevent linux import error
    from distutils._msvccompiler import _find_exe
    from distutils._msvccompiler import MSVCCompiler

if platform.system() == 'Windows':
    class Intel64CompilerW(MSVCCompiler):
        """
        A modified Intel compiler compatible with an MSVC-built Python.
        """
        compiler_type = 'intel64w'
        compiler_cxx = 'icl'

        def __init__(self, verbose=0, dry_run=0, force=0):
            MSVCCompiler.__init__(self, verbose, dry_run, force)

        def initialize(self, plat_name=None):
            MSVCCompiler.initialize(self)
            self.cc = _find_exe("icl.exe")
            self.lib = _find_exe("xilib.exe")
            self.linker = _find_exe("xilink.exe")
            self.compile_options = ['/nologo', '/O3', '/MD', '/W3',
                                    '/Qstd=c99']
            self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
                                          '/Qstd=c99', '/Z7', '/D_DEBUG']

compiler_class['intel64w'] = ('intelcompiler', 'Intel64CompilerW',
                              "Intel C Compiler for 64-bit applications on Windows")

ccompiler._default_compilers += ('nt', 'intel64w')

_distutils_new_compiler = new_compiler


def new_compiler(plat=os.name,
                 compiler=None,
                 verbose=0,
                 dry_run=0,
                 force=0):
    """
    make new compiler and pass it to distutils

    dont delete verbose even not using it, distutils expects it
    """
    try:
        if compiler is None:
            compiler = get_default_compiler(plat)
        (module_name, class_name, long_description) = compiler_class[compiler]
    except KeyError:
        msg = "don't know how to compile C/C++ code on platform '%s'" % plat
        if compiler is not None:
            msg = msg + " with '%s' compiler" % compiler
        raise DistutilsPlatformError(msg)
    try:
        __import__ (module_name)
    except ImportError:
        # go back to default compiler
        __import__("distutils." + module_name)
        module_name = "distutils." + module_name
    module = sys.modules[module_name]
    klass = vars(module)[class_name]
    # dryrun compiler
    compiler = klass(None, dry_run, force)
    return compiler


ccompiler.new_compiler = new_compiler

@@ -491,48 +491,99 @@
 ler%0A
-%0Aif platform.system() == 'Windows':%0A    
+else:%0A    raise OSError(%22You are not using Windows, so you should not import this file%22)%0A%0A%0A
 clas
@@ -616,20 +616,16 @@
 piler):%0A
-    
     %22%22%22%0A
@@ -628,20 +628,16 @@
 %22%22%22%0A    
-  
-  
 A modifi
@@ -696,28 +696,20 @@
 on.%0A    
-    %22%22%22%0A    
+%22%22%22%0A
     comp
@@ -731,20 +731,16 @@
 tel64w'%0A
-    
     comp
@@ -757,20 +757,16 @@
  'icl'%0A%0A
-    
     def 
@@ -812,36 +812,32 @@
 rce=0):%0A        
-  
-  
 MSVCCompiler.__i
@@ -874,20 +874,16 @@
 force)%0A%0A
-    
     def 
@@ -916,20 +916,16 @@
 =None):%0A
-    
         
@@ -958,28 +958,24 @@
 lf)%0A        
-    
 self.cc = _f
@@ -989,28 +989,24 @@
 (%22icl.exe%22)%0A
-    
         self
@@ -1039,28 +1039,24 @@
 e%22)%0A        
-  
-  
 self.linker 
@@ -1077,28 +1077,24 @@
 ilink.exe%22)%0A
-    
         self
@@ -1137,36 +1137,32 @@
 , '/MD', '/W3',%0A
-    
                 
@@ -1194,28 +1194,24 @@
 9'%5D%0A        
-    
 self.compile
@@ -1291,36 +1291,32 @@
                 
-    
 '/Qstd=c99', '/Z
@@ -1332,16 +1332,17 @@
 EBUG'%5D%0A%0A
+%0A
 compiler

raise error if not using windows but import this file