From 484d4abb3c651e869c98b0fce7531acb7cdf3f4f Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 26 Feb 2017 20:50:06 +0100 Subject: [PATCH] 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) --- src/messagetypes/__init__.py | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/messagetypes/__init__.py b/src/messagetypes/__init__.py index e455c61b..c3911dfd 100644 --- a/src/messagetypes/__init__.py +++ b/src/messagetypes/__init__.py @@ -28,23 +28,19 @@ def constructObject(data): else: return returnObj -mods = [] if paths.frozen is not None: - with open(path.join(path.dirname(path.dirname(__file__)), 'messagetypes.txt'), 'rt') as f: - for m in f.readlines(): - mods.append(m.rstrip()) + import messagetypes.message + import messagetypes.vote else: - mods = listdir(path.dirname(__file__)) - -for mod in mods: - if mod == "__init__.py": - continue - splitted = path.splitext(mod) - if splitted[1] != ".py": - continue - try: - import_module("." + splitted[0], "messagetypes") - except ImportError: - logger.error("Error importing %s", mod, exc_info=True) - else: - logger.debug("Imported message type module %s", mod) + for mod in listdir(path.dirname(__file__)): + if mod == "__init__.py": + continue + splitted = path.splitext(mod) + if splitted[1] != ".py": + continue + try: + import_module("." + splitted[0], "messagetypes") + except ImportError: + logger.error("Error importing %s", mod, exc_info=True) + else: + logger.debug("Imported message type module %s", mod)