Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
build
git_revision.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
#
3
# Copyright 2013 The Flutter Authors. All rights reserved.
4
# Use of this source code is governed by a BSD-style license that can be
5
# found in the LICENSE file.
6
7
"""Get the Git HEAD revision of a specified Git repository."""
8
9
import
sys
10
import
subprocess
11
import
os
12
import
argparse
13
14
15
def
is_windows
():
16
os_id = sys.platform
17
return
os_id.startswith(
'win32'
)
or
os_id.startswith(
'cygwin'
)
18
19
20
def
get_repository_version
(repository):
21
'Returns the Git HEAD for the supplied repository path as a string.'
22
if
not
os.path.exists(repository):
23
raise
IOError(
'path does not exist'
)
24
25
git =
'git'
26
if
is_windows
():
27
git =
'git.bat'
28
version = subprocess.check_output([
29
git,
30
'-C'
,
31
repository,
32
'rev-parse'
,
33
'HEAD'
,
34
])
35
36
return
str(version.strip(),
'utf-8'
)
37
38
39
def
main
():
40
parser = argparse.ArgumentParser()
41
42
parser.add_argument(
43
'--repository'
, action=
'store'
, help=
'Path to the Git repository.'
, required=
True
44
)
45
46
args = parser.parse_args()
47
repository = os.path.abspath(args.repository)
48
version =
get_repository_version
(repository)
49
print
(version.strip())
50
51
return
0
52
53
54
if
__name__ ==
'__main__'
:
55
sys.exit(
main
())
print
void print(void *str)
Definition
bridge.cpp:126
git_revision.get_repository_version
get_repository_version(repository)
Definition
git_revision.py:20
git_revision.main
main()
Definition
git_revision.py:39
git_revision.is_windows
is_windows()
Definition
git_revision.py:15
main
Definition
main.py:1
Generated on Fri Apr 26 2024 06:14:01 for Flutter Engine by
1.9.8