2015-04-24 08:35:14 +00:00
|
|
|
import os
|
2015-04-15 17:57:43 +00:00
|
|
|
import gi.overrides
|
|
|
|
|
2017-07-25 20:18:26 +00:00
|
|
|
try:
|
|
|
|
import mesonconfig
|
|
|
|
except ImportError:
|
|
|
|
mesonconfig = None
|
|
|
|
pass
|
|
|
|
|
2016-11-03 14:49:15 +00:00
|
|
|
FILE = os.path.realpath(__file__)
|
2015-04-15 17:57:43 +00:00
|
|
|
if not gi.overrides.__path__[0].endswith("gst-python/gi/overrides"):
|
|
|
|
local_overrides = None
|
|
|
|
# our overrides don't take precedence, let's fix it
|
|
|
|
for i, path in enumerate(gi.overrides.__path__):
|
|
|
|
if path.endswith("gst-python/gi/overrides"):
|
|
|
|
local_overrides = path
|
|
|
|
|
2015-04-24 08:35:14 +00:00
|
|
|
if local_overrides:
|
|
|
|
gi.overrides.__path__.remove(local_overrides)
|
|
|
|
else:
|
2016-11-03 14:49:15 +00:00
|
|
|
local_overrides = os.path.abspath(os.path.join(FILE, "../", "../", "gi", "overrides"))
|
2015-04-24 08:35:14 +00:00
|
|
|
|
2015-04-15 17:57:43 +00:00
|
|
|
gi.overrides.__path__.insert(0, local_overrides)
|
2016-11-03 14:49:15 +00:00
|
|
|
|
2017-07-25 20:18:26 +00:00
|
|
|
if mesonconfig:
|
|
|
|
gi.overrides.__path__.insert(0, os.path.abspath(os.path.join(mesonconfig.path, "gi", "overrides")))
|
2016-11-03 14:49:15 +00:00
|
|
|
# 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'))
|