Files
KPK/v3.12/Lib/site-packages/kivy_deps/gstreamer/__init__.py
T
2026-06-23 15:20:56 +02:00

40 lines
1.0 KiB
Python

"""The following code is required to make the dependency binaries available to
kivy when it imports this package.
"""
import sys
import os
from os.path import join, isdir, dirname
import site
__all__ = ('dep_bins', )
__version__ = '0.3.4'
from os import environ
dep_bins = []
"""A list of paths that contain the binaries of this distribution.
Can be used e.g. with pyinstaller to ensure it copies all the binaries.
"""
for d in [sys.prefix, site.USER_BASE]:
p = join(d, 'share', 'gstreamer', 'bin')
if isdir(p):
os.environ["PATH"] = p + os.pathsep + os.environ["PATH"]
if hasattr(os, 'add_dll_directory'):
os.add_dll_directory(p)
dep_bins.append(p)
if dep_bins and isdir(dep_bins[0]):
if environ.get('GST_PLUGIN_PATH'):
environ['GST_PLUGIN_PATH'] = '{};{}'.format(environ['GST_PLUGIN_PATH'],dep_bins[0])
else:
environ['GST_PLUGIN_PATH'] = dep_bins[0]
if not environ.get('GST_REGISTRY'):
environ['GST_REGISTRY'] = join(dirname(dep_bins[0]), 'registry.bin')