parameters: (env,msvc_version,host_arch,target_arch)
return_statement: return (batfilename, use_arg, None)
docstring: Find the location of the batch script which should set up the compiler
      for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
  
      In newer (2017+) compilers, make use of the fact there are vcvars
      scripts named with a host_target pair that calls vcvarsall.bat properly,
      so use that and return an indication we don't need the argument
      we would have computed to run vcvarsall.bat.
docstring_summary: Find the location of the batch script which should set up the compiler
      for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
docstring_tokens: Find the location of the batch script which should set up the compiler for any TARGET_ARCH whose compilers were installed by Visual Studio / VCExpress
function: def find_batch_file(env,msvc_version,host_arch,target_arch):
      """
      Find the location of the batch script which should set up the compiler
      for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
  
      In newer (2017+) compilers, make use of the fact there are vcvars
      scripts named with a host_target pair that calls vcvarsall.bat properly,
      so use that and return an indication we don't need the argument
      we would have computed to run vcvarsall.bat.
      """
      pdir = find_vc_pdir(env, msvc_version)
      if pdir is None:
          raise NoVersionFound("No version of Visual Studio found")
      debug('looking in {}'.format(pdir))
  
      # filter out e.g. "Exp" from the version name
      msvc_ver_numeric = get_msvc_version_numeric(msvc_version)
      use_arg = True
      vernum = float(msvc_ver_numeric)
      if 7 <= vernum < 8:
          pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
          batfilename = os.path.join(pdir, "vsvars32.bat")
      elif vernum < 7:
          pdir = os.path.join(pdir, "Bin")
          batfilename = os.path.join(pdir, "vcvars32.bat")
      elif 8 <= vernum <= 14:
          batfilename = os.path.join(pdir, "vcvarsall.bat")
      else:  # vernum >= 14.1  VS2017 and above
          batfiledir = os.path.join(pdir, "Auxiliary", "Build")
          targ  = _HOST_TARGET_TO_BAT_ARCH_GT14[(host_arch, target_arch)]
          batfilename = os.path.join(batfiledir, targ)
          use_arg = False
  
      if not os.path.exists(batfilename):
          debug("Not found: %s" % batfilename)
          batfilename = None
  
      installed_sdks = get_installed_sdks()
      for _sdk in installed_sdks:
          sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch)
          if not sdk_bat_file:
              debug("batch file not found:%s" % _sdk)
          else:
              sdk_bat_file_path = os.path.join(pdir,sdk_bat_file)
              if os.path.exists(sdk_bat_file_path):
                  debug('sdk_bat_file_path:%s' % sdk_bat_file_path)
                  return (batfilename, use_arg, sdk_bat_file_path)
      return (batfilename, use_arg, None)
function_tokens: def find_batch_file ( env , msvc_version , host_arch , target_arch ) : pdir = find_vc_pdir ( env , msvc_version ) if pdir is None : raise NoVersionFound ( "No version of Visual Studio found" ) debug ( 'looking in {}' . format ( pdir ) ) # filter out e.g. "Exp" from the version name msvc_ver_numeric = get_msvc_version_numeric ( msvc_version ) use_arg = True vernum = float ( msvc_ver_numeric ) if 7 <= vernum < 8 : pdir = os . path . join ( pdir , os . pardir , "Common7" , "Tools" ) batfilename = os . path . join ( pdir , "vsvars32.bat" ) elif vernum < 7 : pdir = os . path . join ( pdir , "Bin" ) batfilename = os . path . join ( pdir , "vcvars32.bat" ) elif 8 <= vernum <= 14 : batfilename = os . path . join ( pdir , "vcvarsall.bat" ) else : # vernum >= 14.1  VS2017 and above batfiledir = os . path . join ( pdir , "Auxiliary" , "Build" ) targ = _HOST_TARGET_TO_BAT_ARCH_GT14 [ ( host_arch , target_arch ) ] batfilename = os . path . join ( batfiledir , targ ) use_arg = False if not os . path . exists ( batfilename ) : debug ( "Not found: %s" % batfilename ) batfilename = None installed_sdks = get_installed_sdks ( ) for _sdk in installed_sdks : sdk_bat_file = _sdk . get_sdk_vc_script ( host_arch , target_arch ) if not sdk_bat_file : debug ( "batch file not found:%s" % _sdk ) else : sdk_bat_file_path = os . path . join ( pdir , sdk_bat_file ) if os . path . exists ( sdk_bat_file_path ) : debug ( 'sdk_bat_file_path:%s' % sdk_bat_file_path ) return ( batfilename , use_arg , sdk_bat_file_path ) return ( batfilename , use_arg , None )