Package buildbot
[frames] | no frames]

Source Code for Package buildbot

 1  # strategy: 
 2  # 
 3  # if there is a VERSION file, use its contents. otherwise, call git to 
 4  # get a version string. if that also fails, use 'latest'. 
 5  # 
 6  import os 
 7   
 8  version = "latest" 
 9   
10  try: 
11      fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION') 
12      version = open(fn).read().strip() 
13   
14  except IOError: 
15      from subprocess import Popen, PIPE, STDOUT 
16      import re 
17   
18      VERSION_MATCH = re.compile(r'\d+\.\d+\.\d+(\w|-)*') 
19   
20      try: 
21          p = Popen(['git', 'describe', '--tags', '--always'], stdout=PIPE, stderr=STDOUT) 
22          out = p.communicate()[0] 
23   
24          if (not p.returncode) and out: 
25              v = VERSION_MATCH.search(out) 
26              if v: 
27                  version = v.group() 
28      except OSError: 
29          pass 
30