diff options
author | David Seikel | 2011-06-04 00:17:28 +1000 |
---|---|---|
committer | David Seikel | 2011-06-04 00:17:28 +1000 |
commit | 492eaaf4eec82327116f2605e3d8becf94bec1b3 (patch) | |
tree | dcddd674cb4861445c3ec5aaa59325b99a437614 /linden/scripts/viewer_info.py | |
parent | Set the real bare minimum prim size to 0.00001, as 0 sized objects cause bugs. (diff) | |
parent | Fixing the menu to actually use its color options reveals how broken the whol... (diff) | |
download | meta-impy-492eaaf4eec82327116f2605e3d8becf94bec1b3.zip meta-impy-492eaaf4eec82327116f2605e3d8becf94bec1b3.tar.gz meta-impy-492eaaf4eec82327116f2605e3d8becf94bec1b3.tar.bz2 meta-impy-492eaaf4eec82327116f2605e3d8becf94bec1b3.tar.xz |
Merge branch 'next' of git://github.com/jacek/imprudence into next
Conflicts (manually merged):
linden/indra/llcommon/llversionviewer.h
linden/indra/llvfs/lldir.cpp
linden/indra/llvfs/lldir_mac.cpp
linden/indra/newview/CMakeLists.txt
linden/indra/newview/English.lproj/InfoPlist.strings
linden/indra/newview/Info-Imprudence.plist
linden/indra/newview/Info-meta-impy.plist
linden/indra/newview/llappviewer.cpp
linden/indra/newview/llpanellogin.cpp
linden/indra/newview/packaging/mac/Info.plist.in
linden/indra/newview/res/viewerRes.rc
linden/indra/newview/skins/default/xui/en-us/floater_about.xml
linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml
linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml
linden/indra/newview/skins/default/xui/en-us/panel_preferences_skins.xml
linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
linden/indra/newview/skins/default/xui/zh/menu_viewer.xml
linden/indra/newview/skins/default/xui/zh/panel_group_general.xml
linden/indra/newview/viewer_manifest.py
linden/indra/newview/viewerversion.cpp
linden/indra/newview/viewerversion.h
linden/install.xml
Also some post merge tweaks.
Diffstat (limited to '')
-rwxr-xr-x | linden/scripts/viewer_info.py | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/linden/scripts/viewer_info.py b/linden/scripts/viewer_info.py new file mode 100755 index 0000000..53ea432 --- /dev/null +++ b/linden/scripts/viewer_info.py | |||
@@ -0,0 +1,101 @@ | |||
1 | #!/usr/bin/env python | ||
2 | # | ||
3 | # @file viewer_info.py | ||
4 | # @author Jacek Antonelli | ||
5 | # @brief Scans and prints the viewer name and/or version. | ||
6 | # | ||
7 | # Copyright (c) 2010, Jacek Antonelli | ||
8 | # | ||
9 | # Permission is hereby granted, free of charge, to any person | ||
10 | # obtaining a copy of this software and associated documentation files | ||
11 | # (the "Software"), to deal in the Software without restriction, | ||
12 | # including without limitation the rights to use, copy, modify, merge, | ||
13 | # publish, distribute, sublicense, and/or sell copies of the Software, | ||
14 | # and to permit persons to whom the Software is furnished to do so, | ||
15 | # subject to the following conditions: | ||
16 | # | ||
17 | # The above copyright notice and this permission notice shall be | ||
18 | # included in all copies or substantial portions of the Software. | ||
19 | # | ||
20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
21 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
23 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
24 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
25 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
26 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
27 | # SOFTWARE. | ||
28 | # | ||
29 | # | ||
30 | # Usage: | ||
31 | # | ||
32 | # viewer_info.py --name # viewer name (e.g. "Kokua") | ||
33 | # viewer_info.py --version # viewer version (e.g. "1.0.0-RC1" | ||
34 | # viewer_info.py --combined # name + version (e.g. "Kokua-1.0.0-RC1") | ||
35 | # | ||
36 | # You can pass multiple flags to print each thing on a separate line. | ||
37 | # E.g. `viewer_info.py --name --version' will print 2 lines, e.g.: | ||
38 | # | ||
39 | # Kokua | ||
40 | # 1.0.0-RC1 | ||
41 | # | ||
42 | |||
43 | import errno, os, re, string, sys | ||
44 | |||
45 | |||
46 | class ViewerInfo: | ||
47 | |||
48 | def __init__(self, filepath=None): | ||
49 | f = open(filepath or self.default_file()) | ||
50 | data = f.read() | ||
51 | f.close() | ||
52 | |||
53 | self.name = re.search('NAME\s*=\s*"([^"]*)"', data).group(1) | ||
54 | self.major = re.search('MAJOR\s*=\s*(\d+)', data).group(1) | ||
55 | self.minor = re.search('MINOR\s*=\s*(\d+)', data).group(1) | ||
56 | self.patch = re.search('PATCH\s*=\s*(\d+)', data).group(1) | ||
57 | self.extra = re.search('EXTRA\s*=\s*"([^"]*)"', data).group(1) | ||
58 | self.bundle_id = re.search('BUNDLE_ID\s*=\s*"([^"]*)"', data).group(1) | ||
59 | |||
60 | self.version = "%s.%s.%s"%(self.major, self.minor, self.patch) | ||
61 | if len(self.extra) > 0: | ||
62 | # Replace spaces and some puncuation with '-' in extra | ||
63 | extra = re.sub('[- \t:;,!+/\\"\'`]+', '-', self.extra) | ||
64 | # Strip any leading or trailing "-"s | ||
65 | extra = string.strip(extra, '-') | ||
66 | self.version += "-" + extra | ||
67 | |||
68 | self.combined = self.name + "-" + self.version | ||
69 | |||
70 | @classmethod | ||
71 | def default_file(klass): | ||
72 | scripts_dir = sys.path[0] # directory containing this script | ||
73 | viewerinfo = os.path.join('indra', 'newview', 'viewerinfo.cpp') | ||
74 | filepath = os.path.join(scripts_dir, '..', viewerinfo) | ||
75 | return os.path.abspath(filepath) | ||
76 | |||
77 | |||
78 | if __name__ == '__main__': | ||
79 | |||
80 | try: | ||
81 | info = ViewerInfo() | ||
82 | except IOError, err: | ||
83 | if err.errno == errno.ENOENT: | ||
84 | print >> sys.stderr, 'File not found:', ViewerInfo.default_file() | ||
85 | sys.exit(1) | ||
86 | else: | ||
87 | raise | ||
88 | |||
89 | args = sys.argv[1:] | ||
90 | |||
91 | if not args: | ||
92 | print "Usage: %s [--name] [--version] [--combined]"%(sys.argv[0]) | ||
93 | for arg in args: | ||
94 | if '--name' == arg: | ||
95 | print info.name | ||
96 | elif '--version' == arg: | ||
97 | print info.version | ||
98 | elif '--combined' == arg: | ||
99 | print info.combined | ||
100 | elif '--bundle-id' == arg: | ||
101 | print info.bundle_id | ||