This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 1010import subprocess
1111import os
1212import argparse
13- from shutil import which # Natively supported since python 3.3
13+
14+
15+ def is_windows ():
16+ os_id = sys .platform
17+ return os_id .startswith ('win32' ) or os_id .startswith ('cygwin' )
1418
1519
1620def get_repository_version (repository ):
1721 'Returns the Git HEAD for the supplied repository path as a string.'
1822 if not os .path .exists (repository ):
1923 raise IOError ('path does not exist' )
2024
21- git_candidates = ['git' , 'git.sh' , 'git.bat' ]
22- git = next (filter (which , git_candidates ), None )
23- if git is None :
24- candidates = "', '" .join (git_candidates )
25- raise IOError (f"Looks like GIT is not on the path. Tried '{ candidates } '" )
26-
25+ git = 'git'
26+ if is_windows ():
27+ git = 'git.bat'
2728 version = subprocess .check_output ([
2829 git ,
2930 '-C' ,
Original file line number Diff line number Diff line change 1010import os
1111import subprocess
1212import sys
13- from shutil import which # Natively supported since python 3.3
1413
1514SRC_ROOT = os .path .dirname (
1615 os .path .dirname (
2019FLUTTER_DIR = os .path .join (SRC_ROOT , 'flutter' )
2120
2221
22+ def IsWindows ():
23+ os_id = sys .platform
24+ return os_id .startswith ('win32' ) or os_id .startswith ('cygwin' )
25+
26+
2327def Main (argv ):
28+ git = 'git'
2429 githooks = os .path .join (FLUTTER_DIR , 'tools' , 'githooks' )
25- git_candidates = ['git' , 'git.sh' , 'git.bat' ]
26- git = next (filter (which , git_candidates ), None )
27- if git is None :
28- candidates = "', '" .join (git_candidates )
29- raise IOError (f"Looks like GIT is not on the path. Tried '{ candidates } '" )
30+ if IsWindows ():
31+ git = 'git.bat'
32+ githooks = os .path .join (githooks , 'windows' )
3033 result = subprocess .run ([
3134 git ,
3235 'config' ,
You can’t perform that action at this time.
0 commit comments