aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/scripts/build_version.py
diff options
context:
space:
mode:
Diffstat (limited to 'linden/scripts/build_version.py')
-rwxr-xr-xlinden/scripts/build_version.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/linden/scripts/build_version.py b/linden/scripts/build_version.py
deleted file mode 100755
index f6b88a9..0000000
--- a/linden/scripts/build_version.py
+++ /dev/null
@@ -1,62 +0,0 @@
1#!/usr/bin/env python
2#
3# Print the build information embedded in a header file.
4#
5# Expects to be invoked from the command line with a file name and a
6# list of directories to search. The file name will be one of the
7# following:
8#
9# llversionserver.h
10# llversionviewer.h
11#
12# The directory list that follows will include indra/llcommon, where
13# these files live.
14
15import errno, os, re
16
17def get_version(filename):
18 fp = open(filename)
19 data = fp.read()
20 fp.close()
21
22 vals = {}
23 m = re.search('<viewer version_major="(\d+)" />', data)
24 vals['major'] = m.group(1)
25 m = re.search('<viewer version_minor="(\d+)" />', data)
26 vals['minor'] = m.group(1)
27 m = re.search('<viewer version_patch="(\d+)" />', data)
28 vals['patch'] = m.group(1)
29 m = re.search('<viewer version_test="(.*)" />', data)
30 vals['test'] = m.group(1)
31
32 version = "%(major)s.%(minor)s.%(patch)s" % vals
33
34 if len(vals['test']) > 0:
35 # Replace some puncuation and spaces with '-' in the test version
36 vals['test'] = re.sub('[ \t:;,+/\\"\'`]+', '-', vals['test'])
37 version += "-%(test)s" % vals
38
39 return version
40
41
42if __name__ == '__main__':
43 import sys
44
45 try:
46 for path in sys.argv[2:]:
47 name = os.path.join(path, sys.argv[1])
48 try:
49 print get_version(name)
50 break
51 except OSError, err:
52 if err.errno != errno.ENOENT:
53 raise
54 else:
55 print >> sys.stderr, 'File not found:', sys.argv[1]
56 sys.exit(1)
57 except AttributeError:
58 print >> sys.stderr, 'Error: malformatted file: ', name
59 sys.exit(1)
60 except IndexError:
61 print >> sys.stderr, ('Usage: %s llversion[...].h [directories]' %
62 sys.argv[0])