gstreamer/tests/check/python/overrides_hack.py
Thibault Saunier db827dbd00 python: Fix GES.Timelineset_child_property
Implementing it in the overrides as PyGObject won't be able to properly
convert python values to GValues in some cases. Using
g_object_set_property works as some logic is implemented inside
PyGObject for that particular case. This is a "regression" due
to https://bugzilla.gnome.org/review?bug=769789&attachment=348766 were
we end up with an OverflowError while setting G_TYPE_UINT children
properties.
2018-07-08 16:02:28 -04:00

25 lines
1,022 B
Python

import os
import gi.overrides
LOCAL_OVERRIDE_PATH = "gst-editing-services/bindings/python/gi/overrides/"
FILE = os.path.realpath(__file__)
if not gi.overrides.__path__[0].endswith(LOCAL_OVERRIDE_PATH):
local_overrides = None
# our overrides don't take precedence, let's fix it
for i, path in enumerate(gi.overrides.__path__):
if path.endswith(LOCAL_OVERRIDE_PATH):
local_overrides = path
if local_overrides:
gi.overrides.__path__.remove(local_overrides)
else:
local_overrides = os.path.abspath(os.path.join(FILE, "../../../../../", LOCAL_OVERRIDE_PATH))
gi.overrides.__path__.insert(0, local_overrides)
# Execute previously set sitecustomize.py script if it existed
if os.environ.get("GST_ENV"):
old_sitecustomize = os.path.join(os.path.dirname(__file__),
"old.sitecustomize.gstuninstalled.py")
if os.path.exists(old_sitecustomize):
exec(compile(open(old_sitecustomize).read(), old_sitecustomize, 'exec'))