Skip to content

Engine configuration phase on Windows cannot find git.bat in git_revision.py with some git installations #106615

@mtolmacs

Description

@mtolmacs

Environment

Platform: Windows
Engine hash: 9caf2f9

Description

On Windows if git is not installed from the official git package, git.bat might not be on the path. In my case, git is installed via the scoop package manager, where there is no git.bat at all.

However ./src/flutter/build/git_revision.py on Windows always tries to call git.bat, therefore it fails on environments like mine.

Command and it's output

PS > python  .\tools\gn --unoptimized --no-goma
Traceback (most recent call last):
  File "C:\Users\tolmi\Projects\flutter\engine\src\flutter\build\git_revision.py", line 58, in <module>
    sys.exit(main())
  File "C:\Users\tolmi\Projects\flutter\engine\src\flutter\build\git_revision.py", line 51, in main
    version = get_repository_version(repository)
  File "C:\Users\tolmi\Projects\flutter\engine\src\flutter\build\git_revision.py", line 28, in get_repository_version
    version = subprocess.check_output([
  File "C:\Users\tolmi\scoop\apps\python\current\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\tolmi\scoop\apps\python\current\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\tolmi\scoop\apps\python\current\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\tolmi\scoop\apps\python\current\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
ERROR at //flutter/shell/version/version.gni:17:7: Script returned non-zero exit code.
      exec_script("//flutter/build/git_revision.py",
      ^----------
Current dir: [...]/flutter/engine/src/out/host_debug_unopt/
Command: [...]/python3.exe [...]/src/flutter/build/git_revision.py --repository 
[...]
Returned 1.
See //flutter/tools/font-subset/BUILD.gn:6:1: whence it was imported.
import("//flutter/shell/version/version.gni")
^-------------------------------------------
See //flutter/BUILD.gn:118:7: which caused the file to be included.
      "//flutter/tools/font-subset",
      ^----------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listengineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specificallywaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions