diff 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
line wrap: on
line diff
--- a/main.py	Mon Jun 06 15:56:14 2011 -1000
+++ b/main.py	Fri Jun 10 11:29:38 2011 -1000
@@ -53,16 +53,17 @@
 logger = logging.getLogger('parpg')
 
 try:
-    sys.path.insert(0, settings.parpg.FifePath) 
+    old_path = sys.path
+    sys.path = [settings.parpg.FifePath]
+    import fife
 except AttributeError:
     logger.warning('[parpg] section has no FifePath option')
-
-try:
-    from fife import fife
 except ImportError:
     logger.critical("Could not import fife module. Please install fife or add "
-                     "'FifePath' to the [parpg] section of your settings file")
+                    "'FifePath' to the [parpg] section of your settings file")
     sys.exit(1)
+finally:
+    sys.path = old_path
 
 from parpg.application import PARPGApplication
 from parpg.common import utils