equal
deleted
inserted
replaced
|
1 import subprocess, os |
|
2 |
|
3 def GetAppRevision(): |
|
4 rev = None |
|
5 app_dir=os.path.dirname(os.path.realpath(__file__)) |
|
6 try: |
|
7 pipe = subprocess.Popen( |
|
8 ["hg", "id", "-i"], |
|
9 stdout = subprocess.PIPE, |
|
10 cwd = app_dir |
|
11 ) |
|
12 rev = pipe.communicate()[0] |
|
13 if pipe.returncode != 0: |
|
14 rev = None |
|
15 except: |
|
16 pass |
|
17 |
|
18 # if this is not mercurial repository |
|
19 # try to read revision from file |
|
20 if rev is None: |
|
21 try: |
|
22 f = open(os.path.join(app_dir,"revision")) |
|
23 rev = f.readline() |
|
24 except: |
|
25 pass |
|
26 return rev |
|
27 |
|
28 app_version = "1.2" |
|
29 rev = GetAppRevision() |
|
30 if rev is not None: |
|
31 app_version = app_version + "-" + rev.rstrip() |
|
32 |
|
33 |
|
34 |