mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
debug-viewer: Fix plugin loading machinery
The previous code was failing at least with Python 3.11 and Python 3.12. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6659>
This commit is contained in:
parent
a2254a4968
commit
83b1feb4f8
1 changed files with 3 additions and 7 deletions
|
@ -41,22 +41,18 @@ def _load_plugins(path):
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
files = glob.glob(os.path.join(path, "*.py"))
|
files = glob.glob(os.path.join(path, "*.py"))
|
||||||
|
|
||||||
for filename in files:
|
for filename in files:
|
||||||
|
|
||||||
name = os.path.basename(os.path.splitext(filename)[0])
|
name = os.path.basename(os.path.splitext(filename)[0])
|
||||||
if name == "__init__":
|
if name == "__init__":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
finder = importlib.machinery.PathFinder()
|
loader = importlib.machinery.SourceFileLoader(name, filename)
|
||||||
spec = finder.find_spec(
|
spec = importlib.util.spec_from_file_location(name, filename, loader=loader)
|
||||||
name,
|
|
||||||
os.environ.get('_GI_OVERRIDES_PATH', '').split(os.pathsep)
|
|
||||||
)
|
|
||||||
if spec is None:
|
if spec is None:
|
||||||
raise ModuleNotFoundError(name)
|
raise ModuleNotFoundError(name)
|
||||||
module = importlib.util.module_from_spec(spec)
|
module = importlib.util.module_from_spec(spec)
|
||||||
|
loader.exec_module(module)
|
||||||
yield module
|
yield module
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue