Fix osx finding 'temp' files instead of the python source files

Fixes: https://launchpad.net/bugs/1738047
This commit is contained in:
Phill Ridout 2017-12-17 15:25:54 +00:00
parent 8717d62188
commit 370ec244d8
4 changed files with 6 additions and 3 deletions

View File

@ -80,6 +80,7 @@ def extension_loader(glob_pattern, excluded_files=[]):
extension_path = extension_path.relative_to(app_dir) extension_path = extension_path.relative_to(app_dir)
if extension_path.name in excluded_files: if extension_path.name in excluded_files:
continue continue
log.debug('Attempting to import %s', extension_path)
module_name = path_to_module(extension_path) module_name = path_to_module(extension_path)
try: try:
importlib.import_module(module_name) importlib.import_module(module_name)

View File

@ -71,7 +71,7 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties):
""" """
Scan a directory for objects inheriting from the ``Plugin`` class. 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) extension_loader(glob_pattern)
plugin_classes = Plugin.__subclasses__() plugin_classes = Plugin.__subclasses__()
plugin_objects = [] plugin_objects = []

View File

@ -181,7 +181,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
""" """
log.debug('_check_available_media_players') log.debug('_check_available_media_players')
controller_dir = os.path.join('core', 'ui', 'media') 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']) extension_loader(glob_pattern, ['mediaplayer.py'])
player_classes = MediaPlayer.__subclasses__() player_classes = MediaPlayer.__subclasses__()
for player_class in player_classes: for player_class in player_classes:

View File

@ -129,7 +129,8 @@ class PresentationPlugin(Plugin):
""" """
log.debug('check_pre_conditions') log.debug('check_pre_conditions')
controller_dir = os.path.join('plugins', 'presentations', 'lib') 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']) extension_loader(glob_pattern, ['presentationcontroller.py'])
controller_classes = PresentationController.__subclasses__() controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes: for controller_class in controller_classes: