0001-misc-generate-a-version-number-that-s-compatible-wit.patch
setup.py | ||
---|---|---|
26 | 26 | |
27 | 27 | |
28 | 28 |
def get_version(): |
29 |
'''Use the VERSION, if absent generates a version with git describe, if not |
|
30 |
tag exists, take 0.0- and add the length of the commit log. |
|
31 |
''' |
|
29 | 32 |
if os.path.exists('VERSION'): |
30 |
version_file = open('VERSION', 'r') |
|
31 |
version = version_file.read() |
|
32 |
version_file.close() |
|
33 |
return version |
|
33 |
with open('VERSION', 'r') as v: |
|
34 |
return v.read() |
|
34 | 35 |
if os.path.exists('.git'): |
35 |
p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE) |
|
36 |
p = subprocess.Popen(['git','describe','--dirty=.dirty','--match=v*'], |
|
37 |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
36 | 38 |
result = p.communicate()[0] |
37 | 39 |
if p.returncode == 0: |
38 |
version = result.split()[0][1:] |
|
39 |
version = version.replace('-', '.') |
|
40 |
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v |
|
41 |
if '-' in result: # not a tagged version |
|
42 |
real_number, commit_count, commit_hash = result.split('-', 2) |
|
43 |
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash) |
|
44 |
else: |
|
45 |
version = result |
|
40 | 46 |
return version |
41 |
return '0' |
|
47 |
else: |
|
48 |
return '0.0.post%s' % len( |
|
49 |
subprocess.check_output( |
|
50 |
['git', 'rev-list', 'HEAD']).splitlines()) |
|
51 |
return '0.0' |
|
42 | 52 | |
43 | 53 | |
44 | 54 |
class compile_translations(Command): |
45 |
- |