From 65e9d57433b4c89e76181af9cf23038d7fe2278f Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Sat, 25 Jun 2022 19:30:02 +0200 Subject: [PATCH 1/7] Use git exec candidate list on all platforms for build build/git_revision.py now uses a git executable name search list on all platforms, avoiding issues with some Windows installations. --- build/git_revision.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/git_revision.py b/build/git_revision.py index d84886d8b8427..8038d3574d586 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -22,9 +22,15 @@ def get_repository_version(repository): if not os.path.exists(repository): raise IOError('path does not exist') - git = 'git' - if is_windows(): - git = 'git.bat' + # Natively supported since python 3.3 + from shutil import which + + git_candidates = ['git', 'git.sh', 'git.bat'] + git = next(filter(which, git_candidates), None) + if git is None: + candidates = "', '".join(git_candidates) + raise IOError(f"Looks like GIT is not on the path. Tried '{candidates}'") + version = subprocess.check_output([ git, '-C', From 54d7c31a89af5c5e31e3a572eb097149e86c8c7d Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Sun, 26 Jun 2022 09:40:35 +0200 Subject: [PATCH 2/7] Moving python import to top to satisfy linter --- build/git_revision.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/git_revision.py b/build/git_revision.py index 8038d3574d586..ba12479010a2b 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -10,6 +10,7 @@ import subprocess import os import argparse +from shutil import which # Natively supported since python 3.3 def is_windows(): @@ -22,9 +23,6 @@ def get_repository_version(repository): if not os.path.exists(repository): raise IOError('path does not exist') - # Natively supported since python 3.3 - from shutil import which - git_candidates = ['git', 'git.sh', 'git.bat'] git = next(filter(which, git_candidates), None) if git is None: From f227a40ea810f0974b8e0b6a0c6af0b75f5fec24 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Sun, 26 Jun 2022 10:54:40 +0200 Subject: [PATCH 3/7] Fixing format error and removing unneeded check --- build/git_revision.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build/git_revision.py b/build/git_revision.py index ba12479010a2b..0b0653f3ad3f9 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -10,12 +10,7 @@ import subprocess import os import argparse -from shutil import which # Natively supported since python 3.3 - - -def is_windows(): - os_id = sys.platform - return os_id.startswith('win32') or os_id.startswith('cygwin') +from shutil import which # Natively supported since python 3.3 def get_repository_version(repository): From da946edec1b252f6a64641ba8aa905fb5e7203cb Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Tue, 28 Jun 2022 12:24:23 +0200 Subject: [PATCH 4/7] Adding git candidate search to githooks setup.py --- tools/githooks/setup.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/githooks/setup.py b/tools/githooks/setup.py index ea8edf467a838..630d0ea15b530 100755 --- a/tools/githooks/setup.py +++ b/tools/githooks/setup.py @@ -10,6 +10,7 @@ import os import subprocess import sys +from shutil import which # Natively supported since python 3.3 SRC_ROOT = os.path.dirname( os.path.dirname( @@ -18,18 +19,13 @@ ) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') - -def IsWindows(): - os_id = sys.platform - return os_id.startswith('win32') or os_id.startswith('cygwin') - - def Main(argv): - git = 'git' githooks = os.path.join(FLUTTER_DIR, 'tools', 'githooks') - if IsWindows(): - git = 'git.bat' - githooks = os.path.join(githooks, 'windows') + git_candidates = ['git', 'git.sh', 'git.bat'] + git = next(filter(which, git_candidates), None) + if git is None: + candidates = "', '".join(git_candidates) + raise IOError(f"Looks like GIT is not on the path. Tried '{candidates}'") result = subprocess.run([ git, 'config', From 1b0da56ffd9af41d457f5a609022d4b0387cd935 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Tue, 28 Jun 2022 13:29:45 +0200 Subject: [PATCH 5/7] Adding missing COM initialization to flutter_tester executable on Windows --- shell/testing/tester_main.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 2416a61289fc2..5669c28c042e5 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -27,6 +27,10 @@ #include "third_party/dart/runtime/include/bin/dart_io_api.h" #include "third_party/dart/runtime/include/dart_api.h" +#if defined(FML_OS_WIN) +#include +#endif // defined(FML_OS_WIN) + #if defined(FML_OS_POSIX) #include #endif // defined(FML_OS_POSIX) @@ -414,6 +418,11 @@ int main(int argc, char* argv[]) { return true; }; +#if defined(FML_OS_WIN) + CoInitializeEx(nullptr, + COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); +#endif // defined(FML_OS_WIN) + return flutter::RunTester(settings, command_line.HasOption(flutter::FlagForSwitch( flutter::Switch::RunForever)), From 6cc079cfe18eb8d03c78dfa9d317f8b10f11af0d Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Tue, 28 Jun 2022 13:38:39 +0200 Subject: [PATCH 6/7] Revert "Adding missing COM initialization to" Reason: Added to incorrect branch This reverts commit 1b0da56ffd9af41d457f5a609022d4b0387cd935. --- shell/testing/tester_main.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 5669c28c042e5..2416a61289fc2 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -27,10 +27,6 @@ #include "third_party/dart/runtime/include/bin/dart_io_api.h" #include "third_party/dart/runtime/include/dart_api.h" -#if defined(FML_OS_WIN) -#include -#endif // defined(FML_OS_WIN) - #if defined(FML_OS_POSIX) #include #endif // defined(FML_OS_POSIX) @@ -418,11 +414,6 @@ int main(int argc, char* argv[]) { return true; }; -#if defined(FML_OS_WIN) - CoInitializeEx(nullptr, - COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); -#endif // defined(FML_OS_WIN) - return flutter::RunTester(settings, command_line.HasOption(flutter::FlagForSwitch( flutter::Switch::RunForever)), From b363aec91da32bf3f2111a22cfa93b10bf65dcd6 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Tue, 28 Jun 2022 13:46:42 +0200 Subject: [PATCH 7/7] Format fix for setup.py --- tools/githooks/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/githooks/setup.py b/tools/githooks/setup.py index 630d0ea15b530..9e677e96b91d5 100755 --- a/tools/githooks/setup.py +++ b/tools/githooks/setup.py @@ -19,6 +19,7 @@ ) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') + def Main(argv): githooks = os.path.join(FLUTTER_DIR, 'tools', 'githooks') git_candidates = ['git', 'git.sh', 'git.bat']