Imported from archive.
[mudpy.git] / muff
1 #!/usr/bin/python
2 """Skeletal executable for the MUFF Engine"""
3
4 # Copyright (c) 2005 mudpy, Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
5 # Licensed per terms in the LICENSE file distributed with this software.
6
7 # muff uses the ini-style configs supported by the ConfigParser module
8 import ConfigParser
9
10 # need the sys module to alter the import path appropriately
11 import sys
12
13 def get_main_loop():
14         """Find and return the main loop function"""
15
16         # figure out where to find our main configuration file
17         config_data = ConfigParser.SafeConfigParser()
18         config_dirs = [".", "./etc", "/usr/local/muff", "/usr/local/muff/etc", "/etc/muff", "/etc" ]
19         config_name = "muff.conf"
20         config_files = []
21         for each_dir in config_dirs:
22                 config_files.append(each_dir + "/" + config_name)
23
24         # load the config file, get the module path and add it to sys.path
25         config_data.read(config_files)
26         module_path = config_data.get("files", "modules")
27         sys.path.append(module_path)
28
29         # import the main loop function
30         from muff.muffmain import main
31         return main
32
33 # load the main loop and run it
34 main = get_main_loop()
35 main()
36