parameters: (self, target_arch)
docstring: Returns a command (with arguments) to be used to set up the
      environment.
docstring_summary: Returns a command (with arguments) to be used to set up the
      environment.
docstring_tokens: Returns a command ( with arguments ) to be used to set up the environment .
function: def _SetupScriptInternal(self, target_arch):
          """Returns a command (with arguments) to be used to set up the
      environment."""
          assert target_arch in ("x86", "x64"), "target_arch not supported"
          # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the
          # depot_tools build tools and should run SetEnv.Cmd to set up the
          # environment. The check for WindowsSDKDir alone is not sufficient because
          # this is set by running vcvarsall.bat.
          sdk_dir = os.environ.get("WindowsSDKDir", "")
          setup_path = JoinPath(sdk_dir, "Bin", "SetEnv.Cmd")
          if self.sdk_based and sdk_dir and os.path.exists(setup_path):
              return [setup_path, "/" + target_arch]
  
          is_host_arch_x64 = (
              os.environ.get("PROCESSOR_ARCHITECTURE") == "AMD64"
              or os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64"
          )
  
          # For VS2017 (and newer) it's fairly easy
          if self.short_name >= "2017":
              script_path = JoinPath(
                  self.path, "VC", "Auxiliary", "Build", "vcvarsall.bat"
              )
  
              # Always use a native executable, cross-compiling if necessary.
              host_arch = "amd64" if is_host_arch_x64 else "x86"
              msvc_target_arch = "amd64" if target_arch == "x64" else "x86"
              arg = host_arch
              if host_arch != msvc_target_arch:
                  arg += "_" + msvc_target_arch
  
              return [script_path, arg]
  
          # We try to find the best version of the env setup batch.
          vcvarsall = JoinPath(self.path, "VC", "vcvarsall.bat")
          if target_arch == "x86":
              if (
                  self.short_name >= "2013"
                  and self.short_name[-1] != "e"
                  and is_host_arch_x64
              ):
                  # VS2013 and later, non-Express have a x64-x86 cross that we want
                  # to prefer.
                  return [vcvarsall, "amd64_x86"]
              else:
                  # Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat
                  # for x86 because vcvarsall calls vcvars32, which it can only find if
                  # VS??COMNTOOLS is set, which isn't guaranteed.
                  return [JoinPath(self.path, "Common7", "Tools", "vsvars32.bat")]
          elif target_arch == "x64":
              arg = "x86_amd64"
              # Use the 64-on-64 compiler if we're not using an express edition and
              # we're running on a 64bit OS.
              if self.short_name[-1] != "e" and is_host_arch_x64:
                  arg = "amd64"
              return [vcvarsall, arg]
function_tokens: def _SetupScriptInternal ( self , target_arch ) : assert target_arch in ( "x86" , "x64" ) , "target_arch not supported" # If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the # depot_tools build tools and should run SetEnv.Cmd to set up the # environment. The check for WindowsSDKDir alone is not sufficient because # this is set by running vcvarsall.bat. sdk_dir = os . environ . get ( "WindowsSDKDir" , "" ) setup_path = JoinPath ( sdk_dir , "Bin" , "SetEnv.Cmd" ) if self . sdk_based and sdk_dir and os . path . exists ( setup_path ) : return [ setup_path , "/" + target_arch ] is_host_arch_x64 = ( os . environ . get ( "PROCESSOR_ARCHITECTURE" ) == "AMD64" or os . environ . get ( "PROCESSOR_ARCHITEW6432" ) == "AMD64" ) # For VS2017 (and newer) it's fairly easy if self . short_name >= "2017" : script_path = JoinPath ( self . path , "VC" , "Auxiliary" , "Build" , "vcvarsall.bat" ) # Always use a native executable, cross-compiling if necessary. host_arch = "amd64" if is_host_arch_x64 else "x86" msvc_target_arch = "amd64" if target_arch == "x64" else "x86" arg = host_arch if host_arch != msvc_target_arch : arg += "_" + msvc_target_arch return [ script_path , arg ] # We try to find the best version of the env setup batch. vcvarsall = JoinPath ( self . path , "VC" , "vcvarsall.bat" ) if target_arch == "x86" : if ( self . short_name >= "2013" and self . short_name [ - 1 ] != "e" and is_host_arch_x64 ) : # VS2013 and later, non-Express have a x64-x86 cross that we want # to prefer. return [ vcvarsall , "amd64_x86" ] else : # Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat # for x86 because vcvarsall calls vcvars32, which it can only find if # VS??COMNTOOLS is set, which isn't guaranteed. return [ JoinPath ( self . path , "Common7" , "Tools" , "vsvars32.bat" ) ] elif target_arch == "x64" : arg = "x86_amd64" # Use the 64-on-64 compiler if we're not using an express edition and # we're running on a 64bit OS. if self . short_name [ - 1 ] != "e" and is_host_arch_x64 : arg = "amd64" return [ vcvarsall , arg ]