From e9bf8a0868f64f677267c6bc636a112db97e54d8 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Sat, 8 Nov 2008 11:49:30 +0000 Subject: [PATCH] gst/__init__.py: Fix on systems that don't have dlopen or don't support RTLD_GLOBAL and Original commit message from CVS: reviewed by: Edward Hervey * gst/__init__.py: Fix on systems that don't have dlopen or don't support RTLD_GLOBAL and RTLD_LAZY. --- ChangeLog | 8 ++++++++ gst/__init__.py | 26 ++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff7f227f70..2431826f18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-08 Alessandro Decina + + reviewed by: Edward Hervey + + * gst/__init__.py: + Fix on systems that don't have dlopen or don't support RTLD_GLOBAL and + RTLD_LAZY. + 2008-11-07 Jan Schmidt * gst/gst.override: diff --git a/gst/__init__.py b/gst/__init__.py index a636f32672..42f164f02b 100644 --- a/gst/__init__.py +++ b/gst/__init__.py @@ -146,9 +146,13 @@ class Fraction(Value): return float(self.num) / float(self.denom) import sys -dlsave = sys.getdlopenflags() try: + dlsave = sys.getdlopenflags() from DLFCN import RTLD_GLOBAL, RTLD_LAZY +except AttributeError: + # windows doesn't have sys.getdlopenflags() + RTLD_GLOBAL = -1 + RTLD_LAZY = -1 except ImportError: RTLD_GLOBAL = -1 RTLD_LAZY = -1 @@ -172,18 +176,20 @@ except: if RTLD_GLOBAL != -1 and RTLD_LAZY != -1: sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL) - try: - import libxml2 - except: - pass - from _gst import * - import interfaces + +try: + import libxml2 +except: + pass +from _gst import * +import interfaces + +if RTLD_GLOBAL != -1 and RTLD_LAZY != -1: + sys.setdlopenflags(dlsave) +del sys version = get_gst_version -sys.setdlopenflags(dlsave) -del sys - # Fixes for API cleanups that would cause an API breakage. # See #446674