[gstreamer-bugs] [Bug 341799] New: patch to make gst-python work on OSes without dl.so

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sun May 14 22:02:57 PDT 2006


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=341799
 GStreamer | gst-python | Ver: HEAD CVS

           Summary: patch to make gst-python work on OSes without dl.so
           Product: GStreamer
           Version: HEAD CVS
          Platform: Other
        OS/Version: FreeBSD
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-python
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: yuri.pankov at gmail.com
         QAContact: johan at gnome.org
     GNOME version: 2.15/2.16
   GNOME milestone: Unspecified


Patch to make gst-python work on OSes without dl.so (FreeBSD/amd64 for
example). It's incomplete and may be not well written due to lack of python
knowledge.

--- __init__.py.orig    Mon May 15 08:12:50 2006
+++ __init__.py Mon May 15 08:58:32 2006
@@ -83,17 +83,36 @@
    def __repr__(self):
       return '<gst.Fraction %d/%d>' % (self.num, self.denom)

-import DLFCN, sys
+import sys
 dlsave = sys.getdlopenflags()
-sys.setdlopenflags(DLFCN.RTLD_LAZY | DLFCN.RTLD_GLOBAL)
+try:
+    from DLFCN import RTLD_GLOBAL, RTLD_LAZY
+except ImportError:
+    RTLD_GLOBAL = -1
+    RTLD_LAZY = -1
+    import os
+    osname = os.uname()[0]
+    if osname == 'FreeBSD':
+        RTLD_GLOBAL = 0x100
+        RTLD_LAZY = 0x1
+    elif osname == 'Linux':
+        RTLD_GLOBAL = 0x0 # dunno
+        RTLD_LAZY = 0x0 # dunno
+    # and so on
+    del os
+except:
+    RTLD_GLOBAL = -1
+    RTLD_LAZY = -1

-from _gst import *
-import interfaces
+if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
+    sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL)
+    from _gst import *
+    import interfaces

 version = get_gst_version

 sys.setdlopenflags(dlsave)
-del DLFCN, sys
+del sys

 # this restores previously installed importhooks, so we don't interfere
 # with other people's module importers


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list