gst/__init__.py: Make gst-python work on OS without dl.so

Original commit message from CVS:
reviewed by: Edward Hervey <edward@fluendo.com>
* gst/__init__.py:
Make gst-python work on OS without dl.so
Fixes #341799
This commit is contained in:
Edward Hervey 2006-05-27 12:18:54 +00:00
parent 78e97adb23
commit 20469390bd
2 changed files with 31 additions and 5 deletions

View file

@ -1,3 +1,11 @@
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
2006-04-27 Johan Rydberg <jrydberg@gnu.org> 2006-04-27 Johan Rydberg <jrydberg@gnu.org>
reviewed by: Edward Hervey <edward@fluendo.com> reviewed by: Edward Hervey <edward@fluendo.com>

View file

@ -83,17 +83,35 @@ class Fraction(Value):
def __repr__(self): def __repr__(self):
return '<gst.Fraction %d/%d>' % (self.num, self.denom) return '<gst.Fraction %d/%d>' % (self.num, self.denom)
import DLFCN, sys import sys
dlsave = sys.getdlopenflags() 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 == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD':
RTLD_GLOBAL = 0x100
RTLD_LAZY = 0x1
elif osname == 'Darwin':
RTLD_GLOBAL = 0x8
RTLD_LAZY = 0x1
del os
except:
RTLD_GLOBAL = -1
RTLD_LAZY = -1
from _gst import * if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
import interfaces sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL)
from _gst import *
import interfaces
version = get_gst_version version = get_gst_version
sys.setdlopenflags(dlsave) sys.setdlopenflags(dlsave)
del DLFCN, sys del sys
# this restores previously installed importhooks, so we don't interfere # this restores previously installed importhooks, so we don't interfere
# with other people's module importers # with other people's module importers