forked from tschaub/suite
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build_properties.py
37 lines (27 loc) · 1.16 KB
/
build_properties.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# parses the build.properties file making it available to sphinx config files
import os
from StringIO import StringIO
from ConfigParser import ConfigParser
__all__ = ['server_version', 'server_version_short', 'gs_version', 'gs_version_short',
'gwc_version', 'gwc_version_short', 'pg_version', 'pg_version_short']
bpfile = open(os.path.join(os.path.dirname(__file__), 'build.properties'))
buf = StringIO()
buf.write('[build]')
buf.write(bpfile.read())
buf.seek(0, os.SEEK_SET)
cp = ConfigParser()
cp.readfp(buf)
def clean_snapshot(ver):
return ver.replace('-SNAPSHOT', '.x')
def short_version(ver):
return ver.split('-')[0]
def x_version(ver):
return ver + '.x'
server_version = clean_snapshot(cp.get('build', 'server.version'))
server_version_short = short_version(cp.get('build', 'server.version'))
gs_version = x_version(cp.get('build', 'gs.major_version'))
gs_version_short = cp.get('build', 'gs.major_version')
gwc_version = x_version(cp.get('build', 'gwc.major_version'))
gwc_version_short = cp.get('build', 'gwc.major_version')
pg_version = clean_snapshot(cp.get('build', 'pg.version'))
pg_version_short = short_version(cp.get('build', 'pg.version'))