Fix .zip file module loading.

This commit is contained in:
Bastian Kleineidam 2012-12-12 23:27:03 +01:00
parent fcbace28b4
commit de1b80fa4d

View file

@ -24,10 +24,10 @@ def get_modules(folder='plugins'):
# find modules in library.zip filename # find modules in library.zip filename
zipname = os.path.dirname(os.path.dirname(__file__)) zipname = os.path.dirname(os.path.dirname(__file__))
with zipfile.ZipFile(zipname, 'r') as f: with zipfile.ZipFile(zipname, 'r') as f:
modnames = [os.path.splitext(n[17:])[0] prefix = "dosagelib/%s/" % folder
modnames = [os.path.splitext(n[len(prefix):])[0]
for n in f.namelist() for n in f.namelist()
if n.startswith("dosagelib/%s" % folder) if n.startswith(prefix) and "__init__" not in n]
and "__init__" not in n]
else: else:
dirname = os.path.join(os.path.dirname(__file__), folder) dirname = os.path.join(os.path.dirname(__file__), folder)
modnames = get_importable_modules(dirname) modnames = get_importable_modules(dirname)