Fix dawn_version_generator.py on Windows when not using depot_tools

Find git using shutil.which() so extensions are resolved according to PATHEXT.

Remove the "print(e)" that is breaking the expected output.

Bug: dawn:1383
Change-Id: If299b744add0797036598129e08ba7d8c64002e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87481
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/generator/dawn_version_generator.py b/generator/dawn_version_generator.py
index 8ee856a..58e0393 100644
--- a/generator/dawn_version_generator.py
+++ b/generator/dawn_version_generator.py
@@ -13,13 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os, subprocess, sys
+import os, subprocess, sys, shutil
 
 from generator_lib import Generator, run_generator, FileRender
 
-
 def get_git():
-    return "git.bat" if sys.platform == "win32" else "git"
+    # Will find git, git.exe, git.bat...
+    git_exec = shutil.which("git")
+    if not git_exec:
+        raise Exception("No git executable found")
+
+    return git_exec
 
 
 def get_gitHash(dawnDir):
@@ -61,10 +65,9 @@
     result = subprocess.run(
         [get_git(), "rev-parse", "--symbolic-full-name", "HEAD"],
         stdout=subprocess.PIPE,
-        cwd=dawnDir,
-    )
+        cwd=dawnDir)
     if result.returncode != 0:
-        raise Exception("Failed to execute git rev-parse to resolve git head.")
+        raise Exception("Failed to execute git rev-parse to resolve git head:", result.stdout)
 
     resolved = os.path.join(dawnDir, ".git",
                             result.stdout.decode("utf-8").strip())
@@ -102,8 +105,7 @@
         if gitExists(dawnDir):
             try:
                 return [get_gitHead(dawnDir)] + get_gitResolvedHead(dawnDir)
-            except Exception as e:
-                print(e)
+            except Exception:
                 return []
         return []