mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 15:36:35 +00:00
42 lines
847 B
Python
42 lines
847 B
Python
|
|
__all__ = ["_", "FeatureBase", "PluginBase"]
|
|
|
|
import os.path
|
|
from gettext import gettext as _
|
|
|
|
def load (paths = ()):
|
|
|
|
for path in paths:
|
|
for plugin_module in _load_plugins (path):
|
|
yield plugin_module.Plugin
|
|
|
|
def _load_plugins (path):
|
|
|
|
import imp, glob
|
|
|
|
files = glob.glob (os.path.join (path, "*.py"))
|
|
|
|
for filename in files:
|
|
|
|
name = os.path.basename (os.path.splitext (filename)[0])
|
|
if name == "__init__":
|
|
continue
|
|
fp, pathname, description = imp.find_module (name, [path])
|
|
module = imp.load_module (name, fp, pathname, description)
|
|
yield module
|
|
|
|
class FeatureBase (object):
|
|
|
|
state_section_name = None
|
|
|
|
def register_lazy_sentinel (self, sentinel):
|
|
|
|
pass
|
|
|
|
class PluginBase (object):
|
|
|
|
features = ()
|
|
|
|
def __init__ (self):
|
|
|
|
pass
|