| 1 |
import os |
| 2 |
import gi.overrides |
| 3 |
|
| 4 |
LOCAL_OVERRIDE_PATH = "gst-editing-services/bindings/python/gi/overrides/" |
| 5 |
FILE = os.path.realpath(__file__) |
| 6 |
if not gi.overrides.__path__[0].endswith(LOCAL_OVERRIDE_PATH): |
| 7 |
local_overrides = None |
| 8 |
# our overrides don't take precedence, let's fix it |
| 9 |
for i, path in enumerate(gi.overrides.__path__): |
| 10 |
if path.endswith(LOCAL_OVERRIDE_PATH): |
| 11 |
local_overrides = path |
| 12 |
|
| 13 |
if local_overrides: |
| 14 |
gi.overrides.__path__.remove(local_overrides) |
| 15 |
else: |
| 16 |
local_overrides = os.path.abspath(os.path.join(FILE, "../../../../../", LOCAL_OVERRIDE_PATH)) |
| 17 |
|
| 18 |
gi.overrides.__path__.insert(0, local_overrides) |
| 19 |
|
| 20 |
# Execute previously set sitecustomize.py script if it existed |
| 21 |
if os.environ.get("GST_ENV"): |
| 22 |
old_sitecustomize = os.path.join(os.path.dirname(__file__), |
| 23 |
"old.sitecustomize.gstuninstalled.py") |
| 24 |
if os.path.exists(old_sitecustomize): |
| 25 |
exec(compile(open(old_sitecustomize).read(), old_sitecustomize, 'exec')) |