Move lib/mudpy to mudpy for packaging preparation
[mudpy.git] / mudpy / __init__.py
1 """Core modules package for the mudpy engine."""
2
3 # Copyright (c) 2004-2015 Jeremy Stanley <fungi@yuggoth.org>. Permission
4 # to use, copy, modify, and distribute this software is granted under
5 # terms provided in the LICENSE file distributed with this software.
6
7 import imp  # noqa (referenced via exec of string literal below)
8
9 import mudpy  # noqa (referenced via exec of string literal below)
10
11
12 def load():
13     """Import/reload some modules (be careful, as this can result in loops)."""
14
15     # pick up the modules list from this package
16     global modules
17
18     # iterate over the list of modules provided
19     for module in modules:
20
21         # attempt to reload the module, assuming it was probably imported
22         # earlier
23         try:
24             exec("imp.reload(%s)" % module)
25
26         # must not have been, so import it now
27         except NameError:
28             exec("import mudpy.%s" % module)
29
30 # load the modules contained in this package
31 modules = ["data", "misc", "password", "telnet"]
32 load()