OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. |
| 5 |
| 6 import argparse |
| 7 import os |
| 8 import sys |
| 9 import utils |
| 10 |
| 11 def ParseArgs(args): |
| 12 args = args[1:] |
| 13 parser = argparse.ArgumentParser( |
| 14 description='A script to write the version string to a file') |
| 15 |
| 16 parser.add_argument('--output', '-o', |
| 17 type=str, |
| 18 required=True, |
| 19 help='File to write') |
| 20 |
| 21 return parser.parse_args(args) |
| 22 |
| 23 |
| 24 def Main(argv): |
| 25 args = ParseArgs(argv) |
| 26 revision = utils.GetGitRevision() |
| 27 if revision is not None: |
| 28 with open(args.output, 'w') as f: |
| 29 f.write('%s\n' % revision) |
| 30 return 0 |
| 31 |
| 32 |
| 33 if __name__ == '__main__': |
| 34 sys.exit(Main(sys.argv)) |
OLD | NEW |