dr.botzo/modules/__init__.py

26 lines
521 B
Python
Raw Normal View History

2010-07-27 20:35:01 -05:00
import os
import sys
import glob
import re
files = glob.glob(os.path.dirname(__file__)+"/*.py")
__all__ = []
initre = re.compile('__init__')
for i in files:
if initre.search(i):
continue
2010-07-28 13:25:49 -05:00
2010-07-27 20:35:01 -05:00
i = os.path.basename(i)
lastDot = i.rfind(".")
i = i[0:lastDot]
__all__.append(i)
# This line is essentially: from i import *
2010-07-27 20:35:01 -05:00
__import__(i, locals(), globals(), ["*"])
__all__ = list(set(__all__))
2010-07-28 23:48:47 -05:00
# vi:tabstop=4:expandtab:autoindent
# kate: indent-mode python;indent-width 4;replace-tabs on;