Frozen mode message type static

- I can't get the dynamic loading to work on OSX in frozen mode
- I think that if someone wants to build a frozen executable with custom
  messagetypes modules, he can edit the file
- so now it lists the existing types manually (for frozen mode only)
This commit is contained in:
Peter Šurda 2017-02-26 20:50:06 +01:00
parent 511b89ebbe
commit 484d4abb3c
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -28,23 +28,19 @@ def constructObject(data):
else: else:
return returnObj return returnObj
mods = []
if paths.frozen is not None: if paths.frozen is not None:
with open(path.join(path.dirname(path.dirname(__file__)), 'messagetypes.txt'), 'rt') as f: import messagetypes.message
for m in f.readlines(): import messagetypes.vote
mods.append(m.rstrip())
else: else:
mods = listdir(path.dirname(__file__)) for mod in listdir(path.dirname(__file__)):
if mod == "__init__.py":
for mod in mods: continue
if mod == "__init__.py": splitted = path.splitext(mod)
continue if splitted[1] != ".py":
splitted = path.splitext(mod) continue
if splitted[1] != ".py": try:
continue import_module("." + splitted[0], "messagetypes")
try: except ImportError:
import_module("." + splitted[0], "messagetypes") logger.error("Error importing %s", mod, exc_info=True)
except ImportError: else:
logger.error("Error importing %s", mod, exc_info=True) logger.debug("Imported message type module %s", mod)
else:
logger.debug("Imported message type module %s", mod)