Flutter Engine
The Flutter Engine
Functions
git_revision Namespace Reference

Functions

def is_windows ()
 
def get_repository_version (repository)
 
def main ()
 

Function Documentation

◆ get_repository_version()

def git_revision.get_repository_version (   repository)

Definition at line 20 of file git_revision.py.

20def 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
def get_repository_version(repository)
Definition: git_revision.py:20
def is_windows()
Definition: git_revision.py:15

◆ is_windows()

def git_revision.is_windows ( )

Definition at line 15 of file git_revision.py.

15def is_windows():
16 os_id = sys.platform
17 return os_id.startswith('win32') or os_id.startswith('cygwin')
18
19

◆ main()

def git_revision.main ( )

Definition at line 39 of file git_revision.py.

39def 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
def print(*args, **kwargs)
Definition: run_tests.py:49