comparison parpg.py @ 6:0897c89da4fe

Using fife settings module again instead of our own.
author Beliar <KarstenBock@gmx.net>
date Mon, 20 Feb 2012 16:50:10 +0100
parents 8da675d9f525
children 21714c459078
comparison
equal deleted inserted replaced
5:8da675d9f525 6:0897c89da4fe
1 #!/usr/bin/env python2 1 #!/usr/bin/env python
2 # This program is free software: you can redistribute it and/or modify 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 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 4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version. 5 # (at your option) any later version.
6 6
17 from optparse import OptionParser 17 from optparse import OptionParser
18 from os import path 18 from os import path
19 19
20 from parpg.main import main 20 from parpg.main import main
21 21
22 usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n' 22 usage = ('usage: %prog [options]'
23 'The settings_path argument is mandatory and is the directory in \n'
24 'which your parpg.cfg file is located. Optionally, you may \n'
25 'specify where data files are located (system_path), and where \n'
26 'the user settings and data files should be saved to (user_path)\n\n'
27 'Example: python %prog .') 23 'Example: python %prog .')
28 24
29 parser = OptionParser(description='PARPG Launcher Script', usage=usage) 25 parser = OptionParser(description='PARPG Launcher Script', usage=usage)
30 parser.add_option('-f', '--logfile', 26 parser.add_option('-f', '--logfile',
31 help='Name of log file to save to') 27 help='Name of log file to save to')
32 parser.add_option('-l', '--loglevel', default='critical', 28 parser.add_option('-l', '--loglevel', default='critical',
33 help='desired output level for log file') 29 help='desired output level for log file')
34 opts, args = parser.parse_args() 30 opts, args = parser.parse_args()
35 31
36 if not args:
37 if path.isfile("./parpg.cfg"):
38 args =(".")
39 elif path.isfile("./parpg.cfg.default"):
40 import shutil
41 shutil.copyfile("./parpg.cfg.default", "./parpg.cfg")
42 args =(".")
43 else:
44 parser.print_help()
45 sys.exit(1)
46
47 main(args, opts) 32 main(args, opts)