annotate src/parpg.py @ 202:7747b0f73694

Removed waf scripts
author KarstenBock@gmx.net
date Thu, 12 Jan 2012 18:01:28 +0100
parents 54c4277ed905
children
rev   line source
180
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
1 #!/usr/bin/env python2
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
2 # This program is free software: you can redistribute it and/or modify
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
3 # it under the terms of the GNU General Public License as published by
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
4 # the Free Software Foundation, either version 3 of the License, or
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
5 # (at your option) any later version.
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
6
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
7 # This program is distributed in the hope that it will be useful,
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
10 # GNU General Public License for more details.
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
11
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
12 # You should have received a copy of the GNU General Public License
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
14
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
15 #TODO: Modularize this script
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
16 import sys
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
17 from optparse import OptionParser
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
18 from os import path
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
19
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
20 from parpg.main import main
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
21
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
22 usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n'
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
23 'The settings_path argument is mandatory and is the directory in \n'
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
24 'which your parpg.cfg file is located. Optionally, you may \n'
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
25 'specify where data files are located (system_path), and where \n'
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
26 'the user settings and data files should be saved to (user_path)\n\n'
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
27 'Example: python %prog .')
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
28
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
29 parser = OptionParser(description='PARPG Launcher Script', usage=usage)
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
30 parser.add_option('-f', '--logfile',
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
31 help='Name of log file to save to')
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
32 parser.add_option('-l', '--loglevel', default='critical',
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
33 help='desired output level for log file')
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
34 opts, args = parser.parse_args()
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
35
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
36 if not args:
181
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
37 if path.isfile("./parpg.cfg"):
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
38 args =(".")
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
39 else:
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
40 parser.print_help()
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
41 sys.exit(1)
54c4277ed905 The settings_path command line argument now defaults to the current directory, if the settings file is present there.
KarstenBock@gmx.net
parents: 180
diff changeset
42
180
59c4db30fe05 Created parpg.py and moved code from parpg\main.py to it.
KarstenBock@gmx.net
parents:
diff changeset
43 main(args, opts)