comparison main.py @ 3:06be71be07f1

Added a --fifepath option to the WAF build script. * Use the '--fifepath=<path/to/fife>' option to override the default search path and directly import the FIFE Python module from <path/to/fife>. * Modified the parpg.main module to support the new --fifepath option and ensure that the FIFE Python module pointed to by the --fifepath option is imported, regardless of whether multiple FIFE modules are already in the default search path.
author M. George Hansen <technopolitica@gmail.com>
date Fri, 10 Jun 2011 11:29:38 -1000
parents 06145a6ee387
children 86656563555e
comparison
equal deleted inserted replaced
2:06145a6ee387 3:06be71be07f1
51 #TODO: setup formating 51 #TODO: setup formating
52 logging.basicConfig(filename=opts.logfile, level=levels[opts.loglevel]) 52 logging.basicConfig(filename=opts.logfile, level=levels[opts.loglevel])
53 logger = logging.getLogger('parpg') 53 logger = logging.getLogger('parpg')
54 54
55 try: 55 try:
56 sys.path.insert(0, settings.parpg.FifePath) 56 old_path = sys.path
57 sys.path = [settings.parpg.FifePath]
58 import fife
57 except AttributeError: 59 except AttributeError:
58 logger.warning('[parpg] section has no FifePath option') 60 logger.warning('[parpg] section has no FifePath option')
59
60 try:
61 from fife import fife
62 except ImportError: 61 except ImportError:
63 logger.critical("Could not import fife module. Please install fife or add " 62 logger.critical("Could not import fife module. Please install fife or add "
64 "'FifePath' to the [parpg] section of your settings file") 63 "'FifePath' to the [parpg] section of your settings file")
65 sys.exit(1) 64 sys.exit(1)
65 finally:
66 sys.path = old_path
66 67
67 from parpg.application import PARPGApplication 68 from parpg.application import PARPGApplication
68 from parpg.common import utils 69 from parpg.common import utils
69 70
70 # enable psyco if available and in settings file 71 # enable psyco if available and in settings file