GNOME Bugzilla – Bug 341799
patch to make gst-python work on OSes without dl.so
Last modified: 2006-05-27 12:19:18 UTC
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
Created attachment 65554 [details] [review] modified patch to include more OS
2006-05-27 Yuri Pankov <yuri.pankov@gmail.com> reviewed by: Edward Hervey <edward@fluendo.com> * gst/__init__.py: Make gst-python work on OS without dl.so Fixes #341799