Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICARD-2751: Restore the ability to load compiled .pyc plugins #2309

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions picard/pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,13 @@ def _spec_from_zip(self, fullname, file_path):

@staticmethod
def _plugin_file_paths(plugin_dir, plugin_name):
yield os.path.join(plugin_dir, plugin_name, '__init__.py')
yield os.path.join(plugin_dir, plugin_name + '.py')
if hasattr(zipimport.zipimporter, 'find_spec'): # Python >= 3.10
yield os.path.join(plugin_dir, plugin_name + '.zip')
for entry in _PACKAGE_ENTRIES:
yield os.path.join(plugin_dir, plugin_name, entry)
for ext in _FILEEXTS:
# On Python < 3.10 ZIP file loading is handled in PluginManager._load_plugin
if ext == '.zip' and not hasattr(zipimport.zipimporter, 'find_spec'):
continue
yield os.path.join(plugin_dir, plugin_name + ext)


sys.meta_path.append(PluginMetaPathFinder())
Loading