mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Almost all of the python build files in the flutter project work if `python` is `python2` or `python3`. This is the only area where print is incorrectly used (for `python3`). Related issue: https://fuchsia-review.googlesource.com/c/fuchsia/+/272925
43 lines
853 B
Python
Executable File
43 lines
853 B
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Copyright 2013 The Flutter Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""Get the Git HEAD revision of a specified Git repository."""
|
|
|
|
import sys
|
|
import subprocess
|
|
import os
|
|
import argparse
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser();
|
|
|
|
parser.add_argument('--repository',
|
|
action='store',
|
|
help='Path to the Git repository.',
|
|
required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
repository = os.path.abspath(args.repository)
|
|
|
|
if not os.path.exists(repository):
|
|
exit -1
|
|
|
|
version = subprocess.check_output([
|
|
'git',
|
|
'-C',
|
|
repository,
|
|
'rev-parse',
|
|
'HEAD',
|
|
])
|
|
|
|
print (version.strip())
|
|
|
|
return 0
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|