mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-05 09:00:54 +00:00
1babccfe50
Since 547570cd79
we do not always build
PyGObject and our development environment is broken when trying to use
GStreamer python when built against system PyGObject with the following
error importing Gst in there:
```
12345678** (gst-plugin-scanner:710617): CRITICAL **: 11:45:02.343: can't find gi.repository.Gst
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/gi/repository/__init__.py", line 23, in <module>
from ..importer import DynamicImporter
File "/usr/lib64/python3.9/site-packages/gi/importer.py", line 33, in <module>
from .overrides import load_overrides
ImportError: cannot import name 'load_overrides' from 'gi.overrides' (/var/home/thiblahute/devel/gstreamer/gstreamer/subprojects/gst-editing-services/bindings/python/gi/overrides/__init__.py)
Factory Details:
```
The approach to fixing it is to implement override `gi` in
`gst-python/gi/` which we add to `PYTHONPATH`) and in there reset the
`gi` module to the right place and we get overrides from paths from
`_GI_OVERRIDES_PATH` we set in `gst-env.py` which points to all the
overrides that will be installed.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1155>
20 lines
577 B
Python
Executable file
20 lines
577 B
Python
Executable file
#!/usr/bin/python3
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import TestCase
|
|
from gi.repository import Gst
|
|
|
|
|
|
class TestBin(TestCase):
|
|
def test_overrides(self):
|
|
from gi.overrides import Gst
|
|
self.assertEqual(Path(Gst.__file__), Path(__file__).parents[2] / "subprojects/gst-python/gi/overrides/Gst.py")
|
|
|
|
def simple_functional_test(self):
|
|
Gst.init(None)
|
|
self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, [])
|
|
self.assertEqual(float(Gst.Fraction(1, 2)), 0.5)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|