|
1 | | -import os |
2 | | -import subprocess |
3 | | -from sys import stdout |
| 1 | +# import os |
| 2 | +# import subprocess |
| 3 | +# from sys import stdout |
4 | 4 |
|
5 | | -try: |
6 | | - with open(os.devnull, 'w') as devnull: |
7 | | - v = subprocess.check_output(['git', 'describe', '--dirty', '--abbrev'], stderr=stdout).decode().strip() |
8 | | - print(v) |
9 | | - if '-' in v: |
10 | | - bv = v[:v.index('-')] |
11 | | - bv = bv[:bv.rindex('.') + 1] + str(int(bv[bv.rindex('.') + 1:]) + 1) |
12 | | - sempre = 'dirty' if v.endswith('-dirty') else 'commit' |
13 | | - pippre = 'alpha' if v.endswith('-dirty') else 'pre' |
14 | | - build = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip() |
15 | | - number_since = subprocess.check_output( |
16 | | - ['git', 'rev-list', v[:v.index('-')] + '..HEAD', '--count']).decode().strip() |
17 | | - semver = bv + '-' + sempre + '+' + build |
18 | | - pipver = bv + pippre + number_since |
19 | | - winver = v[:v.index('-')] + '.' + number_since |
20 | | - else: |
21 | | - semver = v |
22 | | - pipver = v |
23 | | - winver = v + '.0' |
| 5 | +# try: |
| 6 | +# with open(os.devnull, 'w') as devnull: |
| 7 | +# v = subprocess.check_output(['git', 'describe', '--dirty', '--abbrev'], stderr=stdout).decode().strip() |
| 8 | +# print(v) |
| 9 | +# if '-' in v: |
| 10 | +# bv = v[:v.index('-')] |
| 11 | +# bv = bv[:bv.rindex('.') + 1] + str(int(bv[bv.rindex('.') + 1:]) + 1) |
| 12 | +# sempre = 'dirty' if v.endswith('-dirty') else 'commit' |
| 13 | +# pippre = 'alpha' if v.endswith('-dirty') else 'pre' |
| 14 | +# build = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip() |
| 15 | +# number_since = subprocess.check_output( |
| 16 | +# ['git', 'rev-list', v[:v.index('-')] + '..HEAD', '--count']).decode().strip() |
| 17 | +# semver = bv + '-' + sempre + '+' + build |
| 18 | +# pipver = bv + pippre + number_since |
| 19 | +# winver = v[:v.index('-')] + '.' + number_since |
| 20 | +# else: |
| 21 | +# semver = v |
| 22 | +# pipver = v |
| 23 | +# winver = v + '.0' |
24 | 24 |
|
25 | | - with open('version', 'w') as f: |
26 | | - print('Semantic version is ' + semver) |
27 | | - f.write(semver) |
28 | | - with open('pip_version', 'w') as f: |
29 | | - print('PIP version is ' + pipver) |
30 | | - f.write(pipver) |
31 | | - with open('win_version', 'w') as f: |
32 | | - print('Windows version is ' + winver) |
33 | | - f.write(winver) |
34 | | -except Exception as e: |
35 | | - print('Error calling git') |
36 | | - print(e) |
| 25 | +# with open('version', 'w') as f: |
| 26 | +# print('Semantic version is ' + semver) |
| 27 | +# f.write(semver) |
| 28 | +# with open('pip_version', 'w') as f: |
| 29 | +# print('PIP version is ' + pipver) |
| 30 | +# f.write(pipver) |
| 31 | +# with open('win_version', 'w') as f: |
| 32 | +# print('Windows version is ' + winver) |
| 33 | +# f.write(winver) |
| 34 | +# except Exception as e: |
| 35 | +# print('Error calling git') |
| 36 | +# print(e) |
0 commit comments