parameters: ()
docstring: Patch functions in distutils to use standalone Microsoft Visual C++
      compilers.
docstring_summary: Patch functions in distutils to use standalone Microsoft Visual C++
      compilers.
docstring_tokens: Patch functions in distutils to use standalone Microsoft Visual C ++ compilers .
function: def patch_for_msvc_specialized_compiler():
      """
      Patch functions in distutils to use standalone Microsoft Visual C++
      compilers.
      """
      # import late to avoid circular imports on Python < 3.5
      msvc = import_module('setuptools.msvc')
  
      if platform.system() != 'Windows':
          # Compilers only availables on Microsoft Windows
          return
  
      def patch_params(mod_name, func_name):
          """
          Prepare the parameters for patch_func to patch indicated function.
          """
          repl_prefix = 'msvc9_' if 'msvc9' in mod_name else 'msvc14_'
          repl_name = repl_prefix + func_name.lstrip('_')
          repl = getattr(msvc, repl_name)
          mod = import_module(mod_name)
          if not hasattr(mod, func_name):
              raise ImportError(func_name)
          return repl, mod, func_name
  
      # Python 2.7 to 3.4
      msvc9 = functools.partial(patch_params, 'distutils.msvc9compiler')
  
      # Python 3.5+
      msvc14 = functools.partial(patch_params, 'distutils._msvccompiler')
  
      try:
          # Patch distutils.msvc9compiler
          patch_func(*msvc9('find_vcvarsall'))
          patch_func(*msvc9('query_vcvarsall'))
      except ImportError:
          pass
  
      try:
          # Patch distutils._msvccompiler._get_vc_env
          patch_func(*msvc14('_get_vc_env'))
      except ImportError:
          pass
  
      try:
          # Patch distutils._msvccompiler.gen_lib_options for Numpy
          patch_func(*msvc14('gen_lib_options'))
      except ImportError:
          pass
function_tokens: def patch_for_msvc_specialized_compiler ( ) : # import late to avoid circular imports on Python < 3.5 msvc = import_module ( 'setuptools.msvc' ) if platform . system ( ) != 'Windows' : # Compilers only availables on Microsoft Windows return def patch_params ( mod_name , func_name ) : """
          Prepare the parameters for patch_func to patch indicated function.
          """ repl_prefix = 'msvc9_' if 'msvc9' in mod_name else 'msvc14_' repl_name = repl_prefix + func_name . lstrip ( '_' ) repl = getattr ( msvc , repl_name ) mod = import_module ( mod_name ) if not hasattr ( mod , func_name ) : raise ImportError ( func_name ) return repl , mod , func_name # Python 2.7 to 3.4 msvc9 = functools . partial ( patch_params , 'distutils.msvc9compiler' ) # Python 3.5+ msvc14 = functools . partial ( patch_params , 'distutils._msvccompiler' ) try : # Patch distutils.msvc9compiler patch_func ( * msvc9 ( 'find_vcvarsall' ) ) patch_func ( * msvc9 ( 'query_vcvarsall' ) ) except ImportError : pass try : # Patch distutils._msvccompiler._get_vc_env patch_func ( * msvc14 ( '_get_vc_env' ) ) except ImportError : pass try : # Patch distutils._msvccompiler.gen_lib_options for Numpy patch_func ( * msvc14 ( 'gen_lib_options' ) ) except ImportError : pass