Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 # strategy: 17 # 18 # if there is a VERSION file, use its contents. otherwise, call git to 19 # get a version string. if that also fails, use 'latest'. 20 # 21 import os 22 23 version = "latest" 24 25 try: 26 fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION') 27 version = open(fn).read().strip() 28 29 except IOError: 30 from subprocess import Popen, PIPE, STDOUT 31 import re 32 33 VERSION_MATCH = re.compile(r'\d+\.\d+\.\d+(\w|-)*') 34 35 try: 36 p = Popen(['git', 'describe', '--tags', '--always'], stdout=PIPE, stderr=STDOUT) 37 out = p.communicate()[0] 38 39 if (not p.returncode) and out: 40 v = VERSION_MATCH.search(out) 41 if v: 42 version = v.group() 43 except OSError: 44 pass 45
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Nov 21 16:22:54 2012 | http://epydoc.sourceforge.net |