Ensure that loaded plugins are a shared library

This commit is contained in:
milutter
2023-03-14 14:15:41 -04:00
committed by mlutter
parent fe18e58ad2
commit 53ab95c792
+8
View File
@@ -54,8 +54,16 @@ PLUGIN_HANDLES = []
def _load_all_bundled_plugins(): def _load_all_bundled_plugins():
for directory, _, filenames in os.walk(PLUGINS_DIR): for directory, _, filenames in os.walk(PLUGINS_DIR):
for filename in filenames: for filename in filenames:
if os.path.splitext(filename)[-1] == ".so":
PLUGIN_HANDLES.append(ctypes.CDLL(os.path.join(directory, filename))) PLUGIN_HANDLES.append(ctypes.CDLL(os.path.join(directory, filename)))
elif filename == "__init__.py":
pass
else:
raise ValueError(f"Trying to load the plugin {os.path.join(directory, filename)}, "
"which is not a shared library.")
_load_all_bundled_plugins() _load_all_bundled_plugins()
__version__ = mj_versionString() # pylint: disable=undefined-variable __version__ = mj_versionString() # pylint: disable=undefined-variable