From 370ec244d833b849f48c76100da0c8d73c821a09 Mon Sep 17 00:00:00 2001 From: Phill Ridout Date: Sun, 17 Dec 2017 15:25:54 +0000 Subject: [PATCH] Fix osx finding 'temp' files instead of the python source files Fixes: https://launchpad.net/bugs/1738047 --- openlp/core/common/__init__.py | 1 + openlp/core/lib/pluginmanager.py | 2 +- openlp/core/ui/media/mediacontroller.py | 3 ++- openlp/plugins/presentations/presentationplugin.py | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index 99e222041..b6d759f42 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -80,6 +80,7 @@ def extension_loader(glob_pattern, excluded_files=[]): extension_path = extension_path.relative_to(app_dir) if extension_path.name in excluded_files: continue + log.debug('Attempting to import %s', extension_path) module_name = path_to_module(extension_path) try: importlib.import_module(module_name) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index d4a02f8c0..c82e26eec 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -71,7 +71,7 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties): """ Scan a directory for objects inheriting from the ``Plugin`` class. """ - glob_pattern = os.path.join('plugins', '*', '*plugin.py') + glob_pattern = os.path.join('plugins', '*', '[!.]*plugin.py') extension_loader(glob_pattern) plugin_classes = Plugin.__subclasses__() plugin_objects = [] diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 10c384b0c..87d3a3063 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -181,7 +181,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): """ log.debug('_check_available_media_players') controller_dir = os.path.join('core', 'ui', 'media') - glob_pattern = os.path.join(controller_dir, '*player.py') + # Find all files that do not begin with '.' (lp:#1738047) and end with player.py + glob_pattern = os.path.join(controller_dir, '[!.]*player.py') extension_loader(glob_pattern, ['mediaplayer.py']) player_classes = MediaPlayer.__subclasses__() for player_class in player_classes: diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index a68a22176..c65971f11 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -129,7 +129,8 @@ class PresentationPlugin(Plugin): """ log.debug('check_pre_conditions') controller_dir = os.path.join('plugins', 'presentations', 'lib') - glob_pattern = os.path.join(controller_dir, '*controller.py') + # Find all files that do not begin with '.' (lp:#1738047) and end with controller.py + glob_pattern = os.path.join(controller_dir, '[!.]*controller.py') extension_loader(glob_pattern, ['presentationcontroller.py']) controller_classes = PresentationController.__subclasses__() for controller_class in controller_classes: