comparison bin/parpg.py @ 208:daa87d01adb9

Moved parpg.py and settings-dist.xml from parpg-app to the bin directory. Removed outdated parpg.bat.in and parpg.sh.in files.
author Beliar <KarstenBock@gmx.net>
date Tue, 20 Mar 2012 14:00:34 +0100
parents
children
comparison
equal deleted inserted replaced
207:ae2b8aac429e 208:daa87d01adb9
1 #!/usr/bin/env python
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
6
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
15 #TODO: Modularize this script
16 import sys
17 from optparse import OptionParser
18 from os import path
19
20 usage = ('usage: %prog [options] '
21 'Example: python %prog .')
22
23 parser = OptionParser(description='PARPG Launcher Script', usage=usage)
24 parser.add_option('-f', '--logfile',
25 help='Name of log file to save to')
26 parser.add_option('-l', '--loglevel', default='critical',
27 help='desired output level for log file')
28 parser.add_option('-p', '--fife-path',
29 help='Path to the fife module')
30 parser.add_option('-m', '--parpg-path',
31 help='Path to the parpg module')
32
33 opts, args = parser.parse_args()
34
35 try:
36 old_path = sys.path
37 if opts.parpg_path:
38 sys.path = [opts.parpg_path]
39 import parpg
40 except ImportError:
41 print("Could not import parpg module. Please install parpg or set the --parpg-path command line value")
42 parser.print_help()
43 sys.exit(1)
44 finally:
45 sys.path = old_path
46
47
48 from parpg.main import main
49 main(parser)