Remove .bat and .exe from commands where possible.

We expect .BAT and .EXE to be on PATHEXT. Also, although Python
CreateProcess doesn't honor PATHEXT, it will try .EXE. This allows most
commands to be platform-independent, and also resolves the issue with
the cpython package not including python.bat.

No-Tree-Checks: true
Docs-Preview: https://skia.org/?cl=135626
Bug: chromium:852581
Change-Id: Iab4189407df44ff4ad4d37da07ff52414229d397
Reviewed-on: https://skia-review.googlesource.com/135626
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
Auto-Submit: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index 1c0c2dc..6229e45 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -23,10 +23,8 @@
 }
 
 if (host_os == "win") {
-  python = "python.bat"
   stamp = "cmd.exe /c echo >"
 } else {
-  python = "python"
   stamp = "touch"
 }
 
@@ -180,7 +178,7 @@
 
   tool("copy") {
     cp_py = rebase_path("../cp.py")
-    command = "$python $cp_py {{source}} {{output}}"
+    command = "python $cp_py {{source}} {{output}}"
     description = "copy {{source}} {{output}}"
   }
 }
@@ -247,7 +245,7 @@
       rspfile = "{{output}}.rsp"
       rspfile_content = "{{inputs}}"
       ar_py = rebase_path("../ar.py")
-      command = "$python $ar_py $ar {{output}} $rspfile"
+      command = "python $ar_py $ar {{output}} $rspfile"
       outputs = [
         "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
       ]
@@ -292,13 +290,13 @@
 
     tool("copy") {
       cp_py = rebase_path("../cp.py")
-      command = "$python $cp_py {{source}} {{output}}"
+      command = "python $cp_py {{source}} {{output}}"
       description = "copy {{source}} {{output}}"
     }
 
     tool("copy_bundle_data") {
       cp_py = rebase_path("../cp.py")
-      command = "$python $cp_py {{source}} {{output}}"
+      command = "python $cp_py {{source}} {{output}}"
       description = "copy_bundle_data {{source}} {{output}}"
     }
 
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go
index 01098e2..c9816c7 100644
--- a/infra/bots/gen_tasks.go
+++ b/infra/bots/gen_tasks.go
@@ -196,9 +196,6 @@
 		},
 	}
 
-	RECIPE_BUNDLE_UNIX = "recipe_bundle/recipes"
-	RECIPE_BUNDLE_WIN  = "recipe_bundle/recipes.bat"
-
 	// Flags.
 	builderNameSchemaFile = flag.String("builder_name_schema", "", "Path to the builder_name_schema.json file. If not specified, uses infra/bots/recipe_modules/builder_name_schema/builder_name_schema.json from this repo.")
 	assetsDir             = flag.String("assets_dir", "", "Directory containing assets.")
diff --git a/infra/bots/recipe_modules/build/android.py b/infra/bots/recipe_modules/build/android.py
index ba57db8..34d4df1 100644
--- a/infra/bots/recipe_modules/build/android.py
+++ b/infra/bots/recipe_modules/build/android.py
@@ -58,9 +58,7 @@
     args['extra_cflags'] = repr(extra_cflags).replace("'", '"')
 
   gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems()))
-  gn      = 'gn.exe'    if 'Win' in os else 'gn'
-  ninja   = 'ninja.exe' if 'Win' in os else 'ninja'
-  gn      = skia_dir.join('bin', gn)
+  gn      = skia_dir.join('bin', 'gn')
 
   with api.context(cwd=skia_dir):
     api.run(api.python, 'fetch-gn',
@@ -95,7 +93,7 @@
     else:
       api.run(api.step, 'gn gen',
               cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
-      api.run(api.step, 'ninja', cmd=[ninja, '-k', '0', '-C', out_dir])
+      api.run(api.step, 'ninja', cmd=['ninja', '-k', '0', '-C', out_dir])
 
 
 def copy_extra_build_products(api, src, dst):
diff --git a/infra/bots/recipe_modules/build/chromebook.py b/infra/bots/recipe_modules/build/chromebook.py
index f7af555..63e4f78 100644
--- a/infra/bots/recipe_modules/build/chromebook.py
+++ b/infra/bots/recipe_modules/build/chromebook.py
@@ -6,7 +6,6 @@
 def compile_fn(api, checkout_root, out_dir):
   skia_dir      = checkout_root.join('skia')
   configuration = api.vars.builder_cfg.get('configuration')
-  os            = api.vars.builder_cfg.get('os')
   target_arch   = api.vars.builder_cfg.get('target_arch')
 
   clang_linux = api.vars.slave_dir.join('clang_linux')
@@ -84,10 +83,7 @@
   args['extra_ldflags'] = repr(extra_ldflags).replace("'", '"')
 
   gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems()))
-
-  gn    = 'gn.exe'    if 'Win' in os else 'gn'
-  ninja = 'ninja.exe' if 'Win' in os else 'ninja'
-  gn = skia_dir.join('bin', gn)
+  gn = skia_dir.join('bin', 'gn')
 
   with api.context(cwd=skia_dir, env=env):
     api.run(api.python, 'fetch-gn',
@@ -95,7 +91,7 @@
             infra_step=True)
     api.run(api.step, 'gn gen', cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
     api.run(api.step, 'ninja',
-            cmd=[ninja, '-k', '0', '-C', out_dir, 'nanobench', 'dm'])
+            cmd=['ninja', '-k', '0', '-C', out_dir, 'nanobench', 'dm'])
 
 
 def copy_extra_build_products(api, src, dst):
diff --git a/infra/bots/recipe_modules/build/chromecast.py b/infra/bots/recipe_modules/build/chromecast.py
index 9ba5dc6..fcccf4d 100644
--- a/infra/bots/recipe_modules/build/chromecast.py
+++ b/infra/bots/recipe_modules/build/chromecast.py
@@ -6,7 +6,6 @@
 def compile_fn(api, checkout_root, out_dir):
   skia_dir      = checkout_root.join('skia')
   configuration = api.vars.builder_cfg.get('configuration')
-  os            = api.vars.builder_cfg.get('os')
   target_arch   = api.vars.builder_cfg.get('target_arch')
 
   # TODO(kjlubick): can this toolchain be replaced/shared with chromebook?
@@ -62,10 +61,7 @@
   args['extra_ldflags'] = repr(extra_ldflags).replace("'", '"')
 
   gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems()))
-
-  gn    = 'gn.exe'    if 'Win' in os else 'gn'
-  ninja = 'ninja.exe' if 'Win' in os else 'ninja'
-  gn = skia_dir.join('bin', gn)
+  gn = skia_dir.join('bin', 'gn')
 
   with api.context(cwd=skia_dir):
     api.run(api.python, 'fetch-gn',
@@ -73,7 +69,7 @@
             infra_step=True)
     api.run(api.step, 'gn gen', cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
     api.run(api.step, 'ninja',
-            cmd=[ninja, '-k', '0', '-C', out_dir, 'nanobench', 'dm'])
+            cmd=['ninja', '-k', '0', '-C', out_dir, 'nanobench', 'dm'])
 
 
 def copy_extra_build_products(api, src, dst):
diff --git a/infra/bots/recipe_modules/build/default.py b/infra/bots/recipe_modules/build/default.py
index 5c88feb..7bdbf4f 100644
--- a/infra/bots/recipe_modules/build/default.py
+++ b/infra/bots/recipe_modules/build/default.py
@@ -249,10 +249,7 @@
     args['extra_ldflags'] = repr(extra_ldflags).replace("'", '"')
 
   gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems()))
-
-  gn    = 'gn.exe'    if 'Win' in os else 'gn'
-  ninja = 'ninja.exe' if 'Win' in os else 'ninja'
-  gn = skia_dir.join('bin', gn)
+  gn = skia_dir.join('bin', 'gn')
 
   with api.context(cwd=skia_dir):
     api.run(api.python,
@@ -272,7 +269,7 @@
     with api.env(env):
       api.run(api.step, 'gn gen',
               cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
-      api.run(api.step, 'ninja', cmd=[ninja, '-k', '0', '-C', out_dir])
+      api.run(api.step, 'ninja', cmd=['ninja', '-k', '0', '-C', out_dir])
 
 
 def copy_extra_build_products(api, src, dst):
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-arm64-Release-Android.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-arm64-Release-Android.json
index ee5e9d1..fe220dd 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-arm64-Release-Android.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-arm64-Release-Android.json
@@ -29,7 +29,7 @@
   },
   {
     "cmd": [
-      "[START_DIR]/cache/work/skia/bin/gn.exe",
+      "[START_DIR]/cache/work/skia/bin/gn",
       "gen",
       "[START_DIR]/cache/work/skia/out/Build-Win-Clang-arm64-Release-Android/Release",
       "--args=extra_cflags=[\"-DDUMMY_ndk_version=42\"] is_debug=false ndk=\"[START_DIR]/n\" target_cpu=\"arm64\""
@@ -43,7 +43,7 @@
   },
   {
     "cmd": [
-      "ninja.exe",
+      "ninja",
       "-k",
       "0",
       "-C",
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86-Debug-Exceptions.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86-Debug-Exceptions.json
index 69aabc3..5af4f84 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86-Debug-Exceptions.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86-Debug-Exceptions.json
@@ -29,7 +29,7 @@
   },
   {
     "cmd": [
-      "[START_DIR]/cache/work/skia/bin/gn.exe",
+      "[START_DIR]/cache/work/skia/bin/gn",
       "gen",
       "[START_DIR]/cache/work/skia/out/Build-Win-Clang-x86-Debug-Exceptions/Debug",
       "--args=cc=\"clang\" clang_win=\"[START_DIR]/clang_win\" cxx=\"clang++\" extra_cflags=[\"-O1\", \"/EHsc\", \"-DDUMMY_clang_win_version=42\"] target_cpu=\"x86\" win_sdk=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/win_sdk\" win_vc=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/VC\""
@@ -43,7 +43,7 @@
   },
   {
     "cmd": [
-      "ninja.exe",
+      "ninja",
       "-k",
       "0",
       "-C",
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
index 0f8aa55..ca19f49 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json
@@ -29,7 +29,7 @@
   },
   {
     "cmd": [
-      "[START_DIR]/cache/work/skia/bin/gn.exe",
+      "[START_DIR]/cache/work/skia/bin/gn",
       "gen",
       "[START_DIR]/cache/work/skia/out/Build-Win-Clang-x86_64-Release-Vulkan/Release_x64",
       "--args=cc=\"clang\" clang_win=\"[START_DIR]/clang_win\" cxx=\"clang++\" extra_cflags=[\"-DDUMMY_clang_win_version=42\"] is_debug=false skia_enable_vulkan_debug_layers=false skia_vulkan_sdk=\"[START_DIR]/win_vulkan_sdk\" target_cpu=\"x86_64\" win_sdk=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/win_sdk\" win_vc=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/VC\""
@@ -43,7 +43,7 @@
   },
   {
     "cmd": [
-      "ninja.exe",
+      "ninja",
       "-k",
       "0",
       "-C",
diff --git a/infra/bots/recipes/compile.expected/Build-Win-Clang-x86-Debug.json b/infra/bots/recipes/compile.expected/Build-Win-Clang-x86-Debug.json
index 93f86d6..6f5bdee 100644
--- a/infra/bots/recipes/compile.expected/Build-Win-Clang-x86-Debug.json
+++ b/infra/bots/recipes/compile.expected/Build-Win-Clang-x86-Debug.json
@@ -138,7 +138,7 @@
   },
   {
     "cmd": [
-      "[START_DIR]/cache/work/skia/bin/gn.exe",
+      "[START_DIR]/cache/work/skia/bin/gn",
       "gen",
       "[START_DIR]/cache/work/skia/out/Build-Win-Clang-x86-Debug/Debug",
       "--args=cc=\"clang\" clang_win=\"[START_DIR]/clang_win\" cxx=\"clang++\" extra_cflags=[\"-O1\", \"-DDUMMY_clang_win_version=42\"] target_cpu=\"x86\" win_sdk=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/win_sdk\" win_vc=\"[START_DIR]/t/depot_tools/win_toolchain/vs_files/5454e45bf3764c03d3fc1024b3bf5bc41e3ab62c/VC\""
@@ -152,7 +152,7 @@
   },
   {
     "cmd": [
-      "ninja.exe",
+      "ninja",
       "-k",
       "0",
       "-C",
diff --git a/site/user/build.md b/site/user/build.md
index 899a11b..eaf0f68 100644
--- a/site/user/build.md
+++ b/site/user/build.md
@@ -263,6 +263,8 @@
 This toolchain is the only way we support 32-bit builds, by also setting `target_cpu="x86"`.
 There is also a corresponding 2015 toolchain, downloaded via `infra/bots/assets/win_toolchain_2015`.
 
+The Skia build assumes that the PATHEXT environment variable contains ".EXE".
+
 ### Visual Studio Solutions
 
 If you use Visual Studio, you may want to pass `--ide=vs` to `bin/gn gen` to
diff --git a/tools/git-sync-deps b/tools/git-sync-deps
index 78449d9..7599eac 100755
--- a/tools/git-sync-deps
+++ b/tools/git-sync-deps
@@ -11,8 +11,8 @@
   An optional list of deps_os values.
 
 Environment Variables:
-  GIT_EXECUTABLE: path to "git" binary; if unset, will look for one of
-  ['git', 'git.exe', 'git.bat'] in your default path.
+  GIT_EXECUTABLE: path to "git" binary; if unset, will look for git in
+  your default path.
 
   GIT_SYNC_DEPS_PATH: file to get the dependency list from; if unset,
   will use the file ../DEPS relative to this script's directory.
@@ -43,7 +43,7 @@
       A string suitable for passing to subprocess functions, or None.
   """
   envgit = os.environ.get('GIT_EXECUTABLE')
-  searchlist = ['git', 'git.exe', 'git.bat']
+  searchlist = ['git']
   if envgit:
     searchlist.insert(0, envgit)
   with open(os.devnull, 'w') as devnull: