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