aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share
diff options
context:
space:
mode:
authorDr Scofield2008-07-29 17:04:57 +0000
committerDr Scofield2008-07-29 17:04:57 +0000
commit9f600b378d475b5cbe2a8ac6d694e2a987e6ae92 (patch)
tree2516652df0ab06ba4040e2eef65ae3a48928f85f /share
parentmatrix.py is a little launcher tool that knows about the GridInfo (diff)
downloadopensim-SC_OLD-9f600b378d475b5cbe2a8ac6d694e2a987e6ae92.zip
opensim-SC_OLD-9f600b378d475b5cbe2a8ac6d694e2a987e6ae92.tar.gz
opensim-SC_OLD-9f600b378d475b5cbe2a8ac6d694e2a987e6ae92.tar.bz2
opensim-SC_OLD-9f600b378d475b5cbe2a8ac6d694e2a987e6ae92.tar.xz
adding copyright notice and help option to matrix.py.
Diffstat (limited to 'share')
-rw-r--r--share/python/matrix/matrix.py59
1 files changed, 58 insertions, 1 deletions
diff --git a/share/python/matrix/matrix.py b/share/python/matrix/matrix.py
index 0630a12..ea36cc9 100644
--- a/share/python/matrix/matrix.py
+++ b/share/python/matrix/matrix.py
@@ -1,5 +1,30 @@
1#!/usr/bin/python 1#!/usr/bin/python
2# -*- encoding: utf-8 -*- 2# -*- encoding: utf-8 -*-
3# Copyright (c) Contributors, http://opensimulator.org/
4# See CONTRIBUTORS.TXT for a full list of copyright holders.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are met:
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in the
12# documentation and/or other materials provided with the distribution.
13# * Neither the name of the OpenSim Project nor the
14# names of its contributors may be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20# DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 28
4import xml.etree.ElementTree as ET 29import xml.etree.ElementTree as ET
5import re 30import re
@@ -10,6 +35,32 @@ import optparse
10import os 35import os
11import sys 36import sys
12 37
38def longHelp():
39 print '''
40matrix.py is a little launcher tool that knows about the GridInfo
41protocol. it expects the grid coordinates to be passed as a
42command line argument either as a "matrix:" or as an "opensim:" style
43URI:
44
45 matrix://osgrid.org:8002/
46
47you can also provide region/X/Y/Z coordinates:
48
49 matrix://osgrid.org:8002/Wright%20Plaza/128/50/75
50
51and, it also understands avatar names and passwords:
52
53 matrix://mr%20smart:secretpassword@osgrid.org:8002/Wright%20Plaza/128/50/75
54
55when you run it the first time, it will complain about a missing
56.matrixcfg file --- this is needed so that it can remember where your
57secondlife client lives on your box. to generate that file, simply run
58
59 matrix.py --secondlife path-to-your-secondlife-client-executable
60
61 '''
62
63
13reURI = re.compile(r'''^(?P<scheme>[a-zA-Z0-9]+):// # scheme 64reURI = re.compile(r'''^(?P<scheme>[a-zA-Z0-9]+):// # scheme
14 ((?P<avatar>[^:@]+)(:(?P<password>[^@]+))?@)? # avatar name and password (optional) 65 ((?P<avatar>[^:@]+)(:(?P<password>[^@]+))?@)? # avatar name and password (optional)
15 (?P<host>[^:/]+)(:(?P<port>\d+))? # host, port (optional) 66 (?P<host>[^:/]+)(:(?P<port>\d+))? # host, port (optional)
@@ -25,10 +76,16 @@ if __name__ == '__main__':
25 parser = optparse.OptionParser() 76 parser = optparse.OptionParser()
26 parser.add_option('-c', '--config', dest = 'config', help = 'config file', metavar = 'CONFIG') 77 parser.add_option('-c', '--config', dest = 'config', help = 'config file', metavar = 'CONFIG')
27 parser.add_option('-s', '--secondlife', dest = 'client', help = 'location of secondlife client', metavar = 'SL-CLIENT') 78 parser.add_option('-s', '--secondlife', dest = 'client', help = 'location of secondlife client', metavar = 'SL-CLIENT')
79 parser.add_option('-l', '--longhelp', action='store_true', dest = 'longhelp', help = 'longhelp')
28 (options, args) = parser.parse_args() 80 (options, args) = parser.parse_args()
29 81
82 if options.longhelp:
83 parser.print_help()
84 longHelp()
85 sys.exit(0)
86
30 # 87 #
31 # we using ~/.matrixcfg to store the location of the secondlife client 88 # we are using ~/.matrixcfg to store the location of the secondlife client
32 # 89 #
33 if not options.config: 90 if not options.config:
34 options.config = '~/.matrixcfg' 91 options.config = '~/.matrixcfg'