| 9 | # GetSdkRevision |
| 10 | ############################################################# |
| 11 | def GetSdkRevision(): |
| 12 | cmd = 'git status --porcelain -b' |
| 13 | lines = os.popen(cmd).readlines() |
| 14 | if not lines[0].startswith('## master'): |
| 15 | print('ERROR: not on master branch') |
| 16 | return None |
| 17 | if len(lines) > 1: |
| 18 | print('ERROR: git status not empty') |
| 19 | print(''.join(lines)) |
| 20 | return None |
| 21 | |
| 22 | cmd = 'git tag --contains HEAD' |
| 23 | tags = os.popen(cmd).readlines() |
| 24 | if len(tags) != 1: |
| 25 | print('ERROR: expected exactly one tag for HEAD, found', len(tags), ':', tags) |
| 26 | return None |
| 27 | version = tags[0].strip() |
| 28 | sep = version.find('-') |
| 29 | if sep < 0: |
| 30 | print('ERROR: unrecognized version string format:', version) |
| 31 | return version[sep+1:] |
| 32 | |
| 33 | ############################################################# |
| 34 | # GetVersion |