1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-05 23:35:48 +03:00

changes for the 'usual' setup.py to allow building a libxml2-python module

* python/generator.py python/libxslt.c: changes for the 'usual'
  setup.py to allow building a libxml2-python
  module based on the same code. The initialization is however
  different the 2 .so files fo libxml2 and libxslt are identical and
  they entry point initialize both libraries. this is done to avoid
  some possible nasty problem since the Python don't merge the maps
  of all shared modules.
* python/libxsl.py: attempt to cope with the shared library loading
  problem when both modules are not merged.
Daniel
This commit is contained in:
Daniel Veillard
2002-02-22 22:58:47 +00:00
parent ac76027718
commit bd90990db2
4 changed files with 408 additions and 303 deletions

View File

@@ -1,6 +1,48 @@
import libxml2mod
import libxsltmod
import libxml2
#
# Both libxml2mod and libxsltmod have a dependancy on libxml2.so
# and they should share the same module, try to convince the python
# loader to work in that mode if feasible
#
import sys
try:
from dl import RTLD_GLOBAL, RTLD_NOW
except ImportError:
RTLD_GLOBAL = -1
RTLD_NOW = -1
try:
import os
osname = os.uname()[0]
if osname == 'Linux':
RTLD_GLOBAL = 0x00100
RTLD_NOW = 0x00002
#
# is there a better method ?
#
else:
print "libxslt could not guess RTLD_GLOBAL and RTLD_NOW " + \
"on this platform: %s" % (osname)
except:
print "libxslt could not guess RTLD_GLOBAL and RTLD_NOW " + \
"on this platform: %s" % (osname)
if RTLD_GLOBAL != -1 and RTLD_NOW != -1:
try:
flags = sys.getdlopenflags()
sys.setdlopenflags(RTLD_GLOBAL | RTLD_NOW)
try:
import libxml2mod
import libxsltmod
import libxml2
finally:
sys.setdlopenflags(flags)
except:
import libxml2mod
import libxsltmod
import libxml2
else:
import libxml2mod
import libxsltmod
import libxml2
#
# Everything below this point is automatically generated