1#!/usr/bin/env python3
2#
3# Arm SCP/MCP Software
4# Copyright (c) 2015-2021, Arm Limited and Contributors. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8
9import subprocess
10from datetime import datetime
11
12
13def main():
14    # Check if git is available and that the source is within a git repository
15    try:
16        cmd = 'git describe --tags --dirty --always'
17        output = subprocess.check_output(cmd.split())
18        git_string = output.decode('utf-8').strip()
19    except BaseException:
20        git_string = 'Unknown'
21
22    print("{}-{}".format(datetime.now().strftime('%Y-%m-%d_%H-%M-%S'),
23          git_string))
24
25
26if __name__ == '__main__':
27    main()
28