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